Skip to content

Commit 6d3360f

Browse files
committed
docs: introduce CHANGELOG.md, update README with instructions for flat config
1 parent 1e09a7b commit 6d3360f

File tree

2 files changed

+161
-2
lines changed

2 files changed

+161
-2
lines changed

CHANGELOG.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Grafana Eslint config changelog
2+
3+
## 8.0.0
4+
5+
- **Breaking**: Migrate dependencies to peerDependencies. Please make sure to install peerDependencies when using this package.
6+
- Add flat config for Eslint 9 support.
7+
8+
## 7.0.0
9+
10+
- Bump dependencies.
11+
12+
## 6.0.1
13+
14+
- Remove @typescript-eslint/explicit-member-accessibility rule.
15+
16+
## 6.0.0
17+
18+
- Bump dependencies.
19+
20+
## 5.1.0
21+
22+
- Bump dependencies to support Node 18.
23+
24+
## 5.0.0
25+
26+
- Add no-var rule.
27+
28+
## 4.0.0
29+
30+
- Bump dependencies.
31+
32+
## 3.0.0
33+
34+
- Remove eslint-plugin-prettier.
35+
36+
## 2.5.2
37+
38+
- Bump dependencies.
39+
40+
## 2.5.1
41+
42+
- Update eslint-config-prettier and eslint-plugin-jsdoc.
43+
- Report react-hooks/exhaustive-deps as error.
44+
45+
## 2.5.0
46+
47+
- Update typescript to 4.3.4.
48+
- Update @typescript-eslint/eslint-plugin and @typescript-eslint/parser.
49+
50+
## 2.4.0
51+
52+
- Update typescript to 4.2.4.
53+
- Update @typescript-eslint/eslint-plugin and @typescript-eslint/parser.
54+
55+
## 2.3.0
56+
57+
- Update Eslint dependency.
58+
59+
## 2.2.1
60+
61+
- Bump dependencies.
62+
63+
## 2.2.0
64+
65+
- Add no-duplicate-imports.
66+
67+
## 2.1.1
68+
69+
- Update eslint-plugin-prettier.
70+
71+
## 2.1.0
72+
73+
- Update Prettier and eslint-config-prettier.
74+
75+
## 2.0.6
76+
77+
- Adds eslint-plugin-react with recommended setings enabled.
78+
79+
## 2.0.5
80+
81+
- Allow console info statements.
82+
83+
## 2.0.4
84+
85+
- Bump eslint-plugin-react-hooks to 4.1.2.
86+
87+
## 2.0.3
88+
89+
- Pin dependencies to specific versions.
90+
91+
## 2.0.2
92+
93+
- Migrate peerDependencies to dependencies.
94+
95+
## 2.0.1
96+
97+
- Bump dependencies.
98+
99+
## 2.0.0
100+
101+
- Bump dependencies.
102+
103+
## 1.0.0-rc1
104+
105+
Initial release candidate.

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Don't forget to install peerDependencies.
2222
npm info "@grafana/eslint-config@latest" peerDependencies
2323
```
2424

25-
If using **npm 5+**, use this shortcut
25+
If using **npm 5+**, use this command:
2626

2727
```sh
2828
npx install-peerdeps --dev @grafana/eslint-config
@@ -31,7 +31,9 @@ npx install-peerdeps --dev @grafana/eslint-config
3131
If using **yarn**, you can also use the shortcut described above if you have npm 5+ installed on your machine, as the command will detect that you are using yarn and will act accordingly.
3232
Otherwise, run `npm info "@grafana/eslint-config@latest" peerDependencies` to list the peer dependencies and versions, then run `yarn add --dev <dependency>@<version>` for each listed peer dependency.
3333

34-
## Usage
34+
## Configuration (legacy: .eslintrc\*)
35+
36+
Extend our configuration to get reasonable defaults:
3537

3638
```json
3739
{
@@ -41,6 +43,58 @@ Otherwise, run `npm info "@grafana/eslint-config@latest" peerDependencies` to li
4143

4244
It will automatically handle `*.(js|ts|tsx)` files.
4345

46+
## Configuration (new: eslint.config.js)
47+
48+
From v8.21.0, Eslint supported a new flat config system where `eslint.config.js` replaces `.eslintrc*` as the default config file name. [email protected] supports both systems, while [email protected] only supports the new flat config.
49+
50+
A guide on how to migrate to a flat config can be found [here](https://eslint.org/docs/latest/extend/plugin-migration-flat-config).
51+
52+
The following official blog posts are available for interested parties:
53+
54+
- https://eslint.org/blog/2022/08/new-config-system-part-1/
55+
- https://eslint.org/blog/2022/08/new-config-system-part-2/
56+
- https://eslint.org/blog/2022/08/new-config-system-part-3/
57+
58+
This package contains a single flat config object which can be imported like so:
59+
60+
```js
61+
const grafanaConfig = require("@grafana/eslint-config/flat");
62+
63+
/**
64+
* @type {Array<import('eslint').Linter.Config>}
65+
*/
66+
module.exports = [
67+
{
68+
grafanaConfig,
69+
},
70+
];
71+
```
72+
73+
You are then free to add/override properties.
74+
75+
Note: Our shareable configs does not preconfigure `files`, `ignore`, or `languageOptions.globals`. For most of the cases, you probably want to configure some properties for your project.
76+
77+
```js
78+
const grafanaConfig = require("@grafana/eslint-config/flat");
79+
80+
/**
81+
* @type {Array<import('eslint').Linter.Config>}
82+
*/
83+
module.exports = [
84+
{
85+
ignores: [".github", ".yarn", "**/build/", "**/compiled/", "**/dist/"],
86+
},
87+
grafanaConfig,
88+
{
89+
name: "myproject/defaults",
90+
files: ["**/*.{ts,tsx,js,jsx}"],
91+
rules: {
92+
// add custom rules here.
93+
},
94+
},
95+
];
96+
```
97+
4498
## Publishing
4599

46100
Publishing is handled by github actions which is triggered by a merge to master that contains a change to the version property in the `package.json` file. You can either do that manually or use the command below to version bump, commit and tag.

0 commit comments

Comments
 (0)