eslint-config-any 2.4.2 → 3.0.0-alpha.0
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/README.md +19 -1
- package/package.json +33 -31
- package/src/configs/base/index.js +2 -2
- package/src/configs/base/plugins/{import → import-x}/index.js +2 -2
- package/src/configs/base/plugins/import-x/rules/index.js +175 -0
- package/src/configs/base/plugins/regexp/index.js +2 -2
- package/src/configs/index.js +1 -1
- package/src/configs/react/index.js +9 -15
- package/src/configs/react/rules/index.js +43 -31
- package/src/configs/typescript/rules/index.js +7 -0
- package/src/configs/base/plugins/import/rules/index.js +0 -25
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
This package provides strict linting and formatting rules for (almost) all sorts of JavaScript stack projects, like React, Vue, Vanilla, Node and their variants in TypeScript.
|
|
10
10
|
|
|
11
|
+
Requires **ESLint 10+** and **Node 22+**.
|
|
12
|
+
|
|
11
13
|
## Setup
|
|
12
14
|
|
|
13
15
|
**Plug-and-paly**: this is designed to be as simple as possible to setup, so you can invest your time in your project.
|
|
@@ -39,7 +41,7 @@ This package provides strict linting and formatting rules for (almost) all sorts
|
|
|
39
41
|
|
|
40
42
|
This package is designed to make you write the less code as possible, so you don't need to deal with scaffold-hell and learning how to setup a ESlint or Prettier configuration.
|
|
41
43
|
|
|
42
|
-
With
|
|
44
|
+
With ESLint 10+ and its [Flat Configuration](https://eslint.org/blog/2022/08/new-config-system-part-1/), things got a little more complicated to setup, specially if you seek stricter rules for linting and formatting (like I do). However, things got way more flexible, allowing plugins and configs to apply only to certain files that actually use them for linting. For example, you'll only need `eslint-plugin-vue` for `*.vue` files, ot TypeScript-specific rules in files that actually use TS, and so on.
|
|
43
45
|
|
|
44
46
|
So you'll' just need to select one generalized preset and make small compositions in a few cases.
|
|
45
47
|
|
|
@@ -71,11 +73,27 @@ export default [
|
|
|
71
73
|
rules: {
|
|
72
74
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
73
75
|
'no-console': 'off',
|
|
76
|
+
'import-x/no-duplicates': 'off',
|
|
77
|
+
'jsx-a11y-x/no-autofocus': 'error',
|
|
74
78
|
},
|
|
75
79
|
},
|
|
76
80
|
];
|
|
77
81
|
```
|
|
78
82
|
|
|
83
|
+
React/import/a11y overrides use `@eslint-react/*`, `import-x/*`, and `jsx-a11y-x/*` (not `react/*`, `react-hooks/*`, `import/*`, or `jsx-a11y/*`).
|
|
84
|
+
|
|
85
|
+
## ESLint 10 notes
|
|
86
|
+
|
|
87
|
+
- `eslint:recommended` now includes `no-unassigned-vars`, `no-useless-assignment`, and `preserve-caught-error`. This package leaves them on.
|
|
88
|
+
- `/* eslint-env */` comments are errors; use `languageOptions.globals` or these presets.
|
|
89
|
+
- Config files are resolved from each linted file upward (monorepos: put `eslint.config.*` where the files live, or pass `--config`).
|
|
90
|
+
- `.eslintignore` is gone; if you need gitignore-driven ignores, use `includeIgnoreFile()` from `eslint/config` in **your** config.
|
|
91
|
+
- JSX components count as variable references (`no-unused-vars` / `no-undef`).
|
|
92
|
+
- `no-shadow-restricted-names` reports `globalThis` by default.
|
|
93
|
+
- React rules are `@eslint-react/*`, not `react/*` / `react-hooks/*`. Import rules are `import-x/*`, not `import/*`. A11y rules are `jsx-a11y-x/*`.
|
|
94
|
+
- `import-x/extensions` omits JS/TS/Vue extensions. That fights `moduleResolution: "node16"` / `"nodenext"` (TypeScript requires `.js` in import specifiers). Override to `'off'` or `'always'` in that case.
|
|
95
|
+
- On `*.ts` / `*.vue`, `import-x/named`, `namespace`, `default`, `no-unresolved`, and `no-named-as-default-member` are off — `tsc` already covers them.
|
|
96
|
+
|
|
79
97
|
## Contribute
|
|
80
98
|
|
|
81
99
|
Feel free to submit a Pull Request to this project and suggest stricter rules, plugins, fixes and documentation enhancements.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-any",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"description": "ESLint configuration for JavaScript, TypeScript, React & Vue projects, by Julio L. Muller",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"vitest",
|
|
20
20
|
"commonjs"
|
|
21
21
|
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"tag": "next"
|
|
25
|
+
},
|
|
22
26
|
"repository": {
|
|
23
27
|
"type": "git",
|
|
24
28
|
"url": "git+https://github.com/LacusSolutions/eslint-config-any.git"
|
|
@@ -28,52 +32,50 @@
|
|
|
28
32
|
},
|
|
29
33
|
"homepage": "https://github.com/LacusSolutions/eslint-config-any#readme",
|
|
30
34
|
"engines": {
|
|
31
|
-
"node": ">=
|
|
32
|
-
"bun": ">=1.
|
|
35
|
+
"node": ">=22",
|
|
36
|
+
"bun": ">=1.4"
|
|
33
37
|
},
|
|
34
38
|
"type": "module",
|
|
35
39
|
"main": "dist/index.js",
|
|
36
40
|
"scripts": {
|
|
37
|
-
"prepare": "
|
|
41
|
+
"prepare": "husky",
|
|
38
42
|
"commit": "git-cz",
|
|
39
43
|
"lint": "eslint --fix src/ eslint.config.js"
|
|
40
44
|
},
|
|
41
45
|
"peerDependencies": {
|
|
42
|
-
"eslint": "
|
|
43
|
-
"prettier": ">=3.5.0",
|
|
46
|
+
"eslint": "^10.3.0 <11.0.0",
|
|
44
47
|
"typescript": ">=5.8.0"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
48
|
-
"@eslint/
|
|
49
|
-
"@eslint/
|
|
50
|
-
"@eslint/
|
|
50
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
51
|
+
"@eslint-react/eslint-plugin": "^5.19.1",
|
|
52
|
+
"@eslint/js": "^10.0.1",
|
|
53
|
+
"@eslint/json": "^2.1.0",
|
|
54
|
+
"@eslint/markdown": "^8.0.3",
|
|
51
55
|
"eslint-config-prettier": "^10.1.8",
|
|
52
|
-
"eslint-plugin-array-func": "^5.1.
|
|
53
|
-
"eslint-plugin-import": "^2.
|
|
54
|
-
"eslint-plugin-import-
|
|
55
|
-
"eslint-plugin-jsx-a11y": "^
|
|
56
|
-
"eslint-plugin-perfectionist": "^5.
|
|
57
|
-
"eslint-plugin-prettier": "^5.5.
|
|
58
|
-
"eslint-plugin-
|
|
59
|
-
"eslint-plugin-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"vue-eslint-parser": "^10.4.0"
|
|
56
|
+
"eslint-plugin-array-func": "^5.1.1",
|
|
57
|
+
"eslint-plugin-import-helpers": "^2.0.2",
|
|
58
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
59
|
+
"eslint-plugin-jsx-a11y-x": "^0.2.0",
|
|
60
|
+
"eslint-plugin-perfectionist": "^5.11.1",
|
|
61
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
62
|
+
"eslint-plugin-regexp": "^3.3.0",
|
|
63
|
+
"eslint-plugin-vue": "^10.11.0",
|
|
64
|
+
"globals": "^17.12.0",
|
|
65
|
+
"prettier": "^3.9.8",
|
|
66
|
+
"prettier-plugin-jsdoc": "^1.8.1",
|
|
67
|
+
"typescript-eslint": "^8.70.0",
|
|
68
|
+
"vue-eslint-parser": "^10.4.1"
|
|
66
69
|
},
|
|
67
70
|
"devDependencies": {
|
|
68
|
-
"@commitlint/cli": "^20.
|
|
69
|
-
"@commitlint/config-conventional": "^20.
|
|
70
|
-
"@types/bun": "^1.
|
|
71
|
-
"commitizen": "^4.3.
|
|
71
|
+
"@commitlint/cli": "^20.5.3",
|
|
72
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
73
|
+
"@types/bun": "^1.4.2",
|
|
74
|
+
"commitizen": "^4.3.2",
|
|
72
75
|
"cz-conventional-changelog": "^3.3.0",
|
|
73
|
-
"eslint": "^
|
|
76
|
+
"eslint": "^10.11.0",
|
|
74
77
|
"husky": "^9.1.7",
|
|
75
|
-
"lint-staged": "^16.
|
|
76
|
-
"prettier": "^3.8.1",
|
|
78
|
+
"lint-staged": "^16.4.0",
|
|
77
79
|
"typescript": "^5.9.3"
|
|
78
80
|
}
|
|
79
81
|
}
|
|
@@ -5,7 +5,7 @@ import { JS, TS, VUE } from '../../utils/index.js';
|
|
|
5
5
|
import eslintCommentsConfigs from './plugins/@eslint-community___eslint-comments/index.js';
|
|
6
6
|
import arrayFuncConfigs from './plugins/array-func/index.js';
|
|
7
7
|
import importHelpersConfigs from './plugins/import-helpers/index.js';
|
|
8
|
-
import
|
|
8
|
+
import importXConfigs from './plugins/import-x/index.js';
|
|
9
9
|
import jsonConfigs from './plugins/json/index.js';
|
|
10
10
|
import markdownConfigs from './plugins/markdown/index.js';
|
|
11
11
|
import perfectionistConfigs from './plugins/perfectionist/index.js';
|
|
@@ -27,7 +27,7 @@ export default defineConfig([
|
|
|
27
27
|
...markdownConfigs,
|
|
28
28
|
...eslintCommentsConfigs,
|
|
29
29
|
...arrayFuncConfigs,
|
|
30
|
-
...
|
|
30
|
+
...importXConfigs,
|
|
31
31
|
...importHelpersConfigs,
|
|
32
32
|
...perfectionistConfigs,
|
|
33
33
|
...regexpConfigs,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { importX } from 'eslint-plugin-import-x';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
4
|
import { JS, TS, VUE } from '../../../../utils/index.js';
|
|
@@ -10,7 +10,7 @@ export default defineConfig([
|
|
|
10
10
|
{
|
|
11
11
|
files: matchingFilesPattern,
|
|
12
12
|
plugins: {
|
|
13
|
-
import:
|
|
13
|
+
'import-x': importX,
|
|
14
14
|
},
|
|
15
15
|
rules,
|
|
16
16
|
},
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
|
|
3
|
+
'import-x/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
4
|
+
|
|
5
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/default.md
|
|
6
|
+
'import-x/default': 'error',
|
|
7
|
+
|
|
8
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/dynamic-import-chunkname.md
|
|
9
|
+
'import-x/dynamic-import-chunkname': 'off',
|
|
10
|
+
|
|
11
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
|
|
12
|
+
'import-x/export': 'error',
|
|
13
|
+
|
|
14
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
|
|
15
|
+
'import-x/exports-last': 'off',
|
|
16
|
+
|
|
17
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
18
|
+
'import-x/extensions': [
|
|
19
|
+
'warn',
|
|
20
|
+
'always',
|
|
21
|
+
{
|
|
22
|
+
ignorePackages: true,
|
|
23
|
+
pattern: {
|
|
24
|
+
js: 'never',
|
|
25
|
+
cjs: 'never',
|
|
26
|
+
mjs: 'never',
|
|
27
|
+
jsx: 'never',
|
|
28
|
+
mjsx: 'never',
|
|
29
|
+
ts: 'never',
|
|
30
|
+
mts: 'never',
|
|
31
|
+
tsx: 'never',
|
|
32
|
+
mtsx: 'never',
|
|
33
|
+
vue: 'never',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
|
|
39
|
+
'import-x/first': 'error',
|
|
40
|
+
|
|
41
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
|
|
42
|
+
'import-x/group-exports': 'off',
|
|
43
|
+
|
|
44
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
48
|
+
'import-x/imports-first': 'off',
|
|
49
|
+
|
|
50
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
|
|
51
|
+
'import-x/max-dependencies': 'off',
|
|
52
|
+
|
|
53
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md
|
|
54
|
+
'import-x/named': 'error',
|
|
55
|
+
|
|
56
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/namespace.md
|
|
57
|
+
'import-x/namespace': 'error',
|
|
58
|
+
|
|
59
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
|
|
60
|
+
'import-x/newline-after-import': [
|
|
61
|
+
'warn',
|
|
62
|
+
{
|
|
63
|
+
considerComments: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
|
|
68
|
+
'import-x/no-absolute-path': 'error',
|
|
69
|
+
|
|
70
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
|
|
71
|
+
'import-x/no-amd': 'error',
|
|
72
|
+
|
|
73
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-anonymous-default-export.md
|
|
74
|
+
'import-x/no-anonymous-default-export': [
|
|
75
|
+
'error',
|
|
76
|
+
{
|
|
77
|
+
allowArray: true,
|
|
78
|
+
allowArrowFunction: true,
|
|
79
|
+
allowAnonymousClass: false,
|
|
80
|
+
allowAnonymousFunction: false,
|
|
81
|
+
allowCallExpression: true,
|
|
82
|
+
allowNew: true,
|
|
83
|
+
allowLiteral: false,
|
|
84
|
+
allowObject: true,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-commonjs.md
|
|
89
|
+
'import-x/no-commonjs': 'off',
|
|
90
|
+
|
|
91
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
|
|
92
|
+
'import-x/no-cycle': 'off',
|
|
93
|
+
|
|
94
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-default-export.md
|
|
95
|
+
'import-x/no-default-export': 'off',
|
|
96
|
+
|
|
97
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
|
|
98
|
+
'import-x/no-deprecated': 'off',
|
|
99
|
+
|
|
100
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
101
|
+
'import-x/no-duplicates': [
|
|
102
|
+
'warn',
|
|
103
|
+
{
|
|
104
|
+
'prefer-inline': true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
|
|
109
|
+
'import-x/no-dynamic-require': 'warn',
|
|
110
|
+
|
|
111
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
|
|
112
|
+
'import-x/no-empty-named-blocks': 'error',
|
|
113
|
+
|
|
114
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
115
|
+
'import-x/no-extraneous-dependencies': 'off',
|
|
116
|
+
|
|
117
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
|
|
118
|
+
'import-x/no-import-module-exports': 'off',
|
|
119
|
+
|
|
120
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
|
|
121
|
+
'import-x/no-named-as-default-member': 'error',
|
|
122
|
+
|
|
123
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
|
|
124
|
+
'import-x/no-named-as-default': 'warn',
|
|
125
|
+
|
|
126
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
|
|
127
|
+
'import-x/no-named-default': 'error',
|
|
128
|
+
|
|
129
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-export.md
|
|
130
|
+
'import-x/no-named-export': 'off',
|
|
131
|
+
|
|
132
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-namespace.md
|
|
133
|
+
'import-x/no-namespace': 'off',
|
|
134
|
+
|
|
135
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-restricted-paths.md
|
|
136
|
+
'import-x/no-restricted-paths': 'off',
|
|
137
|
+
|
|
138
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
|
|
139
|
+
'import-x/no-self-import': 'error',
|
|
140
|
+
|
|
141
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
|
|
142
|
+
'import-x/no-unassigned-import': 'off',
|
|
143
|
+
|
|
144
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
|
|
145
|
+
'import-x/no-unresolved': [
|
|
146
|
+
'error',
|
|
147
|
+
{
|
|
148
|
+
caseSensitiveStrict: true,
|
|
149
|
+
caseSensitive: true,
|
|
150
|
+
commonjs: true,
|
|
151
|
+
amd: true,
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
|
|
155
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unused-modules.md
|
|
156
|
+
'import-x/no-unused-modules': 'off',
|
|
157
|
+
|
|
158
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
|
|
159
|
+
'import-x/no-useless-path-segments': 'off',
|
|
160
|
+
|
|
161
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
162
|
+
'import-x/no-webpack-loader-syntax': 'warn',
|
|
163
|
+
|
|
164
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
165
|
+
'import-x/order': 'off',
|
|
166
|
+
|
|
167
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
|
|
168
|
+
'import-x/prefer-default-export': 'off',
|
|
169
|
+
|
|
170
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-namespace-import.md
|
|
171
|
+
'import-x/prefer-namespace-import': 'off',
|
|
172
|
+
|
|
173
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/unambiguous.md
|
|
174
|
+
'import-x/unambiguous': 'off',
|
|
175
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configs as regexpPluginConfigs } from 'eslint-plugin-regexp';
|
|
2
2
|
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
4
|
import { JS, TS, VUE } from '../../../../utils/index.js';
|
|
5
5
|
import rules from './rules/index.js';
|
|
6
6
|
|
|
7
7
|
const matchingFilesPattern = [JS, TS, VUE];
|
|
8
|
-
const baseRegExpConfig =
|
|
8
|
+
const baseRegExpConfig = regexpPluginConfigs.recommended;
|
|
9
9
|
|
|
10
10
|
export default defineConfig([
|
|
11
11
|
{
|
package/src/configs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import tsConfigs from './typescript/index.js';
|
|
|
6
6
|
import vueConfigs from './vue/index.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @typedef {import('eslint').
|
|
9
|
+
* @typedef {import('eslint/config').ConfigObject[]} EslintFlatConfig
|
|
10
10
|
*
|
|
11
11
|
* @typedef {Object} EslintFlatConfigSetup
|
|
12
12
|
* @property {EslintFlatConfig} commonjs
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
1
|
+
import reactPlugin from '@eslint-react/eslint-plugin';
|
|
2
|
+
import jsxA11yXPlugin from 'eslint-plugin-jsx-a11y-x';
|
|
4
3
|
import { defineConfig } from 'eslint/config';
|
|
5
4
|
import globals from 'globals';
|
|
6
5
|
|
|
@@ -8,23 +7,18 @@ import { JS, TS } from '../../utils/index.js';
|
|
|
8
7
|
import rules from './rules/index.js';
|
|
9
8
|
|
|
10
9
|
const matchingFilesPattern = [JS, TS];
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const baseJsxA11yConfig =
|
|
10
|
+
const baseReactJsConfig = reactPlugin.configs.strict;
|
|
11
|
+
const baseReactTsConfig = reactPlugin.configs['strict-type-checked'];
|
|
12
|
+
const baseJsxA11yConfig = jsxA11yXPlugin.configs.strict;
|
|
14
13
|
|
|
15
14
|
export default defineConfig([
|
|
16
15
|
{
|
|
17
|
-
...
|
|
18
|
-
files:
|
|
19
|
-
settings: {
|
|
20
|
-
react: {
|
|
21
|
-
version: 'detect',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
16
|
+
...baseReactJsConfig,
|
|
17
|
+
files: [JS],
|
|
24
18
|
},
|
|
25
19
|
{
|
|
26
|
-
...
|
|
27
|
-
files:
|
|
20
|
+
...baseReactTsConfig,
|
|
21
|
+
files: [TS],
|
|
28
22
|
},
|
|
29
23
|
{
|
|
30
24
|
...baseJsxA11yConfig,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
// https://github.com/
|
|
3
|
-
'jsx-a11y/no-autofocus': 'off',
|
|
2
|
+
// https://github.com/es-tooling/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-autofocus.md
|
|
3
|
+
'jsx-a11y-x/no-autofocus': 'off',
|
|
4
4
|
|
|
5
|
-
// https://
|
|
6
|
-
'react/jsx-boolean-value': ['warn', 'never'],
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'react/jsx-closing-bracket-location': ['warn', 'tag-aligned'],
|
|
10
|
-
|
|
11
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
12
|
-
'react/jsx-curly-brace-presence': [
|
|
5
|
+
// https://eslint-react.xyz/docs/migrating-from-eslint-plugin-react
|
|
6
|
+
'@eslint-react/kit/jsx-boolean-value': ['warn', 'never'],
|
|
7
|
+
'@stylistic/jsx-closing-bracket-location': 'warn',
|
|
8
|
+
'@stylistic/jsx-curly-brace-presence': [
|
|
13
9
|
'warn',
|
|
14
10
|
{
|
|
15
11
|
children: 'never',
|
|
@@ -17,34 +13,50 @@ export default {
|
|
|
17
13
|
propElementValues: 'always',
|
|
18
14
|
},
|
|
19
15
|
],
|
|
20
|
-
|
|
21
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
22
|
-
'react/jsx-curly-spacing': [
|
|
16
|
+
'@stylistic/jsx-curly-spacing': [
|
|
23
17
|
'warn',
|
|
24
18
|
{
|
|
25
19
|
when: 'never',
|
|
26
20
|
},
|
|
27
21
|
],
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
33
|
-
'react/jsx-filename-extension': [
|
|
22
|
+
'@stylistic/jsx-equals-spacing': ['warn', 'never'],
|
|
23
|
+
'@stylistic/nonblock-statement-body-position': ['warn', 'beside'],
|
|
24
|
+
'@stylistic/padding-line-between-statements': [
|
|
34
25
|
'error',
|
|
35
26
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
blankLine: 'always',
|
|
28
|
+
prev: '*',
|
|
29
|
+
next: 'return',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
blankLine: 'always',
|
|
33
|
+
prev: '*',
|
|
34
|
+
next: ['if', 'while', 'do', 'switch', 'try'],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
blankLine: 'always',
|
|
38
|
+
prev: ['if', 'while', 'do', 'switch', 'try'],
|
|
39
|
+
next: '*',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
blankLine: 'always',
|
|
43
|
+
prev: { selector: 'ExpressionStatement:has(CallExpression)' },
|
|
44
|
+
next: ['const', 'let', 'var'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
blankLine: 'always',
|
|
48
|
+
prev: ['const', 'let', 'var'],
|
|
49
|
+
next: { selector: 'ExpressionStatement:has(CallExpression)' },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
blankLine: 'always',
|
|
53
|
+
prev: '*',
|
|
54
|
+
next: ['class', 'enum', 'interface'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
blankLine: 'always',
|
|
58
|
+
prev: ['class', 'enum', 'interface'],
|
|
59
|
+
next: '*',
|
|
39
60
|
},
|
|
40
61
|
],
|
|
41
|
-
|
|
42
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
43
|
-
'react/jsx-uses-react': 'off',
|
|
44
|
-
|
|
45
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
46
|
-
'react/prop-types': 'off',
|
|
47
|
-
|
|
48
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
49
|
-
'react/react-in-jsx-scope': 'off',
|
|
50
62
|
};
|
|
@@ -29,4 +29,11 @@ export default {
|
|
|
29
29
|
|
|
30
30
|
// https://typescript-eslint.io/rules/triple-slash-reference
|
|
31
31
|
'@typescript-eslint/triple-slash-reference': 'off',
|
|
32
|
+
|
|
33
|
+
// Rules covered by TSC
|
|
34
|
+
'import-x/default': 'off',
|
|
35
|
+
'import-x/named': 'off',
|
|
36
|
+
'import-x/namespace': 'off',
|
|
37
|
+
'import-x/no-named-as-default-member': 'off',
|
|
38
|
+
'import-x/no-unresolved': 'off',
|
|
32
39
|
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md
|
|
3
|
-
'import/no-unresolved': 'off',
|
|
4
|
-
|
|
5
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/named.md
|
|
6
|
-
'import/named': 'error',
|
|
7
|
-
|
|
8
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md
|
|
9
|
-
'import/namespace': 'error',
|
|
10
|
-
|
|
11
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/default.md
|
|
12
|
-
'import/default': 'error',
|
|
13
|
-
|
|
14
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/export.md
|
|
15
|
-
'import/export': 'error',
|
|
16
|
-
|
|
17
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default.md
|
|
18
|
-
'import/no-named-as-default': 'warn',
|
|
19
|
-
|
|
20
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md
|
|
21
|
-
'import/no-named-as-default-member': 'warn',
|
|
22
|
-
|
|
23
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md
|
|
24
|
-
'import/no-duplicates': 'warn',
|
|
25
|
-
};
|