@ethberry/eslint-config 5.0.9 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/manual.yml +3 -3
- package/README.md +36 -3
- package/package.json +14 -14
- package/presets/js.mjs +1 -1
- package/presets/jsx.mjs +1 -1
- package/presets/ts.mjs +2 -2
- package/presets/tsx.mjs +1 -2
- package/rules/common.mjs +4 -3
- package/rules/import.mjs +12 -12
- package/rules/prettier.mjs +2 -4
- package/rules/react.mjs +2 -1
- package/rules/typescript.mjs +1 -1
- package/tests/testing-library.mjs +2 -2
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
11
|
# BEGIN INSTALL
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
13
|
|
|
14
14
|
- name: Install Packages npm i
|
|
15
15
|
run: npm i
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
- name: Version by NPM
|
|
37
37
|
run: npm version patch -m "[Manual release] [skip ci] %s"
|
|
38
38
|
|
|
39
|
-
- uses: JS-DevTools/npm-publish@
|
|
39
|
+
- uses: JS-DevTools/npm-publish@v4
|
|
40
40
|
with:
|
|
41
41
|
token: ${{ secrets.GITHUBTOKEN }}
|
|
42
42
|
registry: "https://npm.pkg.github.com"
|
|
@@ -59,7 +59,7 @@ jobs:
|
|
|
59
59
|
- name: Authenticate check via npm NPM
|
|
60
60
|
run: npm whoami --registry=https://registry.npmjs.org/
|
|
61
61
|
|
|
62
|
-
- uses: JS-DevTools/npm-publish@
|
|
62
|
+
- uses: JS-DevTools/npm-publish@v4
|
|
63
63
|
with:
|
|
64
64
|
registry: "https://registry.npmjs.org"
|
|
65
65
|
token: ${{ secrets.NPM_TOKEN }}
|
package/README.md
CHANGED
|
@@ -2,14 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
This is sharable ESLint config which we use across of all our repositories. It is amazing.
|
|
4
4
|
|
|
5
|
+
### Requirements
|
|
6
|
+
|
|
7
|
+
- **ESLint 10** and **Node.js** [supported by ESLint 10](https://eslint.org/docs/latest/use/migrate-to-10.0.0#nodejs--v2019-v21-v23-are-no-longer-supported) (this package declares `engines.node` `>=22.13.0`).
|
|
8
|
+
- **Flat config only** — `.eslintrc` / `ESLINT_USE_FLAT_CONFIG=false` are not supported in ESLint 10.
|
|
9
|
+
|
|
10
|
+
### Prettier at lint time
|
|
11
|
+
|
|
12
|
+
Presets include [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) (`prettier/prettier` as `error`) plus [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) so formatting rules do not fight Prettier. Run **`eslint --fix`** (this repo’s `npm run lint`) to apply Prettier’s output. Add a [Prettier config](https://prettier.io/docs/configuration) in consuming projects when you need options beyond defaults.
|
|
13
|
+
|
|
14
|
+
### ESLint 10 notes for consumers
|
|
15
|
+
|
|
16
|
+
- **Config lookup** starts from each **linted file’s directory** and walks up (not from the current working directory). In monorepos, put an `eslint.config.*` in each package or pass `--config` explicitly when needed.
|
|
17
|
+
- **`eslint:recommended`** enables [`no-unassigned-vars`](https://eslint.org/docs/latest/rules/no-unassigned-vars), [`no-useless-assignment`](https://eslint.org/docs/latest/rules/no-useless-assignment), and [`preserve-caught-error`](https://eslint.org/docs/latest/rules/preserve-caught-error). Fix new findings or turn rules off in your overlay config if you need stricter control.
|
|
18
|
+
- Remove **`/* eslint-env … */`** comments; ESLint 10 reports them as errors. Use `languageOptions.globals` (e.g. from the [`globals`](https://www.npmjs.com/package/globals) package) instead.
|
|
19
|
+
- **Type-checked TypeScript** (`recommendedTypeChecked` in this preset): merge a block that sets parser options, for example:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import {defineConfig} from "eslint/config";
|
|
23
|
+
import typescriptRules from "./presets/ts.mjs"; // or your path to this preset
|
|
24
|
+
|
|
25
|
+
export default defineConfig([
|
|
26
|
+
...typescriptRules,
|
|
27
|
+
{
|
|
28
|
+
files: ["**/*.{ts,mts,tsx,mtsx}"],
|
|
29
|
+
languageOptions: {
|
|
30
|
+
parserOptions: {
|
|
31
|
+
projectService: true,
|
|
32
|
+
tsconfigRootDir: import.meta.dirname,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
```
|
|
38
|
+
|
|
5
39
|
### Usage
|
|
6
40
|
|
|
7
41
|
eslint.config.mjs
|
|
8
42
|
|
|
9
43
|
```js
|
|
44
|
+
import {defineConfig} from "eslint/config";
|
|
10
45
|
import typescriptRules from "./presets/tsx.mjs";
|
|
11
46
|
|
|
12
|
-
export default [
|
|
13
|
-
...typescriptRules,
|
|
14
|
-
];
|
|
47
|
+
export default defineConfig([...typescriptRules]);
|
|
15
48
|
```
|
package/package.json
CHANGED
|
@@ -8,26 +8,26 @@
|
|
|
8
8
|
"url": "https://github.com/ethberry/eslint-config/issues"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@eslint/js": "
|
|
12
|
-
"@stylistic/eslint-plugin": "5.
|
|
13
|
-
"eslint": "
|
|
11
|
+
"@eslint/js": "10.0.1",
|
|
12
|
+
"@stylistic/eslint-plugin": "5.10.0",
|
|
13
|
+
"eslint": "10.0.3",
|
|
14
14
|
"eslint-config-prettier": "10.1.8",
|
|
15
15
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
16
16
|
"eslint-plugin-import": "2.32.0",
|
|
17
|
-
"eslint-plugin-jest": "29.0
|
|
18
|
-
"eslint-plugin-mocha": "11.
|
|
19
|
-
"eslint-plugin-n": "17.
|
|
20
|
-
"eslint-plugin-prettier": "5.5.
|
|
17
|
+
"eslint-plugin-jest": "29.15.0",
|
|
18
|
+
"eslint-plugin-mocha": "11.2.0",
|
|
19
|
+
"eslint-plugin-n": "17.24.0",
|
|
20
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
21
21
|
"eslint-plugin-promise": "7.2.1",
|
|
22
22
|
"eslint-plugin-react": "7.37.5",
|
|
23
|
-
"eslint-plugin-testing-library": "7.
|
|
24
|
-
"globals": "
|
|
25
|
-
"prettier": "3.
|
|
26
|
-
"typescript": "5.9.
|
|
27
|
-
"typescript-eslint": "8.
|
|
23
|
+
"eslint-plugin-testing-library": "7.16.1",
|
|
24
|
+
"globals": "17.4.0",
|
|
25
|
+
"prettier": "3.8.1",
|
|
26
|
+
"typescript": "5.9.3",
|
|
27
|
+
"typescript-eslint": "8.57.1"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=22"
|
|
30
|
+
"node": ">=22.13.0"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [],
|
|
33
33
|
"license": "MIT",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"title": "EthBerry ESLint config",
|
|
49
|
-
"version": "
|
|
49
|
+
"version": "6.0.3"
|
|
50
50
|
}
|
package/presets/js.mjs
CHANGED
package/presets/jsx.mjs
CHANGED
package/presets/ts.mjs
CHANGED
package/presets/tsx.mjs
CHANGED
package/rules/common.mjs
CHANGED
|
@@ -8,6 +8,7 @@ export default [
|
|
|
8
8
|
// overrides
|
|
9
9
|
{
|
|
10
10
|
rules: {
|
|
11
|
+
curly: ["error", "all"],
|
|
11
12
|
"no-console": [
|
|
12
13
|
"error",
|
|
13
14
|
{
|
|
@@ -24,7 +25,7 @@ export default [
|
|
|
24
25
|
},
|
|
25
26
|
],
|
|
26
27
|
"no-void": "off",
|
|
27
|
-
}
|
|
28
|
+
},
|
|
28
29
|
},
|
|
29
30
|
|
|
30
31
|
// stylistic
|
|
@@ -39,7 +40,7 @@ export default [
|
|
|
39
40
|
code: 120,
|
|
40
41
|
ignoreRegExpLiterals: true,
|
|
41
42
|
ignoreTemplateLiterals: true,
|
|
42
|
-
ignorePattern:
|
|
43
|
+
ignorePattern: '^\\s+d="', // ignore path in svg icons
|
|
43
44
|
},
|
|
44
45
|
],
|
|
45
46
|
"arrow-parens": ["error", "as-needed"],
|
|
@@ -67,4 +68,4 @@ export default [
|
|
|
67
68
|
semi: ["error", "always"],
|
|
68
69
|
},
|
|
69
70
|
},
|
|
70
|
-
]
|
|
71
|
+
];
|
package/rules/import.mjs
CHANGED
|
@@ -5,10 +5,10 @@ export default [
|
|
|
5
5
|
importPlugin.flatConfigs.typescript,
|
|
6
6
|
{
|
|
7
7
|
rules: {
|
|
8
|
-
|
|
8
|
+
"import/order": [
|
|
9
9
|
"error",
|
|
10
10
|
{
|
|
11
|
-
|
|
11
|
+
groups: [
|
|
12
12
|
"builtin",
|
|
13
13
|
"external",
|
|
14
14
|
"internal",
|
|
@@ -16,17 +16,17 @@ export default [
|
|
|
16
16
|
"index",
|
|
17
17
|
"object",
|
|
18
18
|
],
|
|
19
|
-
|
|
19
|
+
pathGroups: [
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
21
|
+
pattern: "@{ethberry,framework}/**",
|
|
22
|
+
group: "external",
|
|
23
|
+
position: "after",
|
|
24
|
+
},
|
|
25
25
|
],
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
pathGroupsExcludedImportTypes: ["builtin"],
|
|
27
|
+
"newlines-between": "always",
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
]
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
package/rules/prettier.mjs
CHANGED
package/rules/react.mjs
CHANGED
package/rules/typescript.mjs
CHANGED
|
@@ -4,10 +4,10 @@ export default [
|
|
|
4
4
|
{
|
|
5
5
|
files: ["**/*.spec.tsx", "**/*.spec.jsx"],
|
|
6
6
|
...testingLibraryPlugin.configs["flat/dom"],
|
|
7
|
-
...testingLibraryPlugin.configs[
|
|
7
|
+
...testingLibraryPlugin.configs["flat/react"],
|
|
8
8
|
rules: {
|
|
9
9
|
...testingLibraryPlugin.configs["flat/dom"].rules,
|
|
10
|
-
...testingLibraryPlugin.configs[
|
|
10
|
+
...testingLibraryPlugin.configs["flat/react"].rules,
|
|
11
11
|
"testing-library/await-async-queries": "error",
|
|
12
12
|
"testing-library/no-await-sync-queries": "error",
|
|
13
13
|
"testing-library/no-debugging-utils": "warn",
|