@innovixx/eslint-config 4.0.1 → 5.0.0-alpha.1
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/config/configs/base/index.mjs +3 -3
- package/config/configs/base/rules/imports.mjs +43 -43
- package/config/configs/react/index.mjs +2 -2
- package/config/configs/react/rules/react-a11y.mjs +12 -217
- package/config/configs/typescript/index.mjs +5 -0
- package/config/configs/typescript/settings/typescript.mjs +1 -1
- package/config/index.mjs +0 -8
- package/demo/src/components/ComponentTest/index.tsx +5 -1
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { importX } from 'eslint-plugin-import-x';
|
|
2
2
|
import sortExportAllPlugin from 'eslint-plugin-sort-export-all';
|
|
3
3
|
import nodePlugin from 'eslint-plugin-n';
|
|
4
4
|
import globals from 'globals';
|
|
@@ -46,7 +46,7 @@ export const index = deepMerge(
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
plugins: {
|
|
49
|
-
import:
|
|
49
|
+
'import-x': importX,
|
|
50
50
|
'sort-export-all': sortExportAllPlugin,
|
|
51
51
|
...nodePlugin.configs['flat/recommended'].plugins,
|
|
52
52
|
},
|
|
@@ -56,7 +56,7 @@ export const index = deepMerge(
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
rules: {
|
|
59
|
-
'import/extensions': 'off',
|
|
59
|
+
'import-x/extensions': 'off',
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import globals from 'globals';
|
|
2
|
-
import importPlugin from 'eslint-plugin-import';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import-x';
|
|
3
3
|
|
|
4
4
|
/** @type {import('eslint').Linter.Config} */
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ const importRules = {
|
|
|
19
19
|
import: importPlugin,
|
|
20
20
|
},
|
|
21
21
|
settings: {
|
|
22
|
-
'import/resolver': {
|
|
22
|
+
'import-x/resolver': {
|
|
23
23
|
node: {
|
|
24
24
|
extensions: [
|
|
25
25
|
'.ts',
|
|
@@ -35,84 +35,84 @@ const importRules = {
|
|
|
35
35
|
|
|
36
36
|
// ensure imports point to files/modules that can be resolved
|
|
37
37
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
|
|
38
|
-
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
|
|
38
|
+
'import-x/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
|
|
39
39
|
|
|
40
40
|
// ensure named imports coupled with named exports
|
|
41
41
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
|
|
42
|
-
'import/named': 'error',
|
|
42
|
+
'import-x/named': 'error',
|
|
43
43
|
|
|
44
44
|
// ensure default import coupled with default export
|
|
45
45
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
|
|
46
|
-
'import/default': 'off',
|
|
46
|
+
'import-x/default': 'off',
|
|
47
47
|
|
|
48
48
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
|
|
49
|
-
'import/namespace': 'off',
|
|
49
|
+
'import-x/namespace': 'off',
|
|
50
50
|
|
|
51
51
|
// Helpful warnings:
|
|
52
52
|
|
|
53
53
|
// disallow invalid exports, e.g. multiple defaults
|
|
54
54
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
|
|
55
|
-
'import/export': 'error',
|
|
55
|
+
'import-x/export': 'error',
|
|
56
56
|
|
|
57
57
|
// do not allow a default import name to match a named export
|
|
58
58
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
|
|
59
|
-
'import/no-named-as-default': 'error',
|
|
59
|
+
'import-x/no-named-as-default': 'error',
|
|
60
60
|
|
|
61
61
|
// warn on accessing default export property names that are also named exports
|
|
62
62
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
|
|
63
|
-
'import/no-named-as-default-member': 'error',
|
|
63
|
+
'import-x/no-named-as-default-member': 'error',
|
|
64
64
|
|
|
65
65
|
// disallow use of jsdoc-marked-deprecated imports
|
|
66
66
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
|
|
67
|
-
'import/no-deprecated': 'off',
|
|
67
|
+
'import-x/no-deprecated': 'off',
|
|
68
68
|
|
|
69
69
|
// Forbid the use of extraneous packages
|
|
70
70
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
71
71
|
// paths are treated both as absolute paths, and relative to process.cwd()
|
|
72
|
-
'import/no-extraneous-dependencies': ['error'],
|
|
72
|
+
'import-x/no-extraneous-dependencies': ['error'],
|
|
73
73
|
|
|
74
74
|
// Forbid mutable exports
|
|
75
75
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
|
|
76
|
-
'import/no-mutable-exports': 'error',
|
|
76
|
+
'import-x/no-mutable-exports': 'error',
|
|
77
77
|
|
|
78
78
|
// Module systems:
|
|
79
79
|
|
|
80
80
|
// disallow require()
|
|
81
81
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
|
|
82
|
-
'import/no-commonjs': 'off',
|
|
82
|
+
'import-x/no-commonjs': 'off',
|
|
83
83
|
|
|
84
84
|
// disallow AMD require/define
|
|
85
85
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
|
|
86
|
-
'import/no-amd': 'error',
|
|
86
|
+
'import-x/no-amd': 'error',
|
|
87
87
|
|
|
88
88
|
// No Node.js builtin modules
|
|
89
89
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
|
|
90
90
|
// TODO: enable?
|
|
91
|
-
'import/no-nodejs-modules': 'off',
|
|
91
|
+
'import-x/no-nodejs-modules': 'off',
|
|
92
92
|
|
|
93
93
|
// Style guide:
|
|
94
94
|
|
|
95
95
|
// disallow non-import statements appearing before import statements
|
|
96
96
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
|
|
97
|
-
'import/first': 'error',
|
|
97
|
+
'import-x/first': 'error',
|
|
98
98
|
|
|
99
99
|
// disallow non-import statements appearing before import statements
|
|
100
100
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
|
|
101
101
|
// deprecated: use `import/first`
|
|
102
|
-
'import/imports-first': 'off',
|
|
102
|
+
'import-x/imports-first': 'off',
|
|
103
103
|
|
|
104
104
|
// disallow duplicate imports
|
|
105
105
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
106
|
-
'import/no-duplicates': 'error',
|
|
106
|
+
'import-x/no-duplicates': 'error',
|
|
107
107
|
|
|
108
108
|
// disallow namespace imports
|
|
109
109
|
// TODO: enable?
|
|
110
110
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
|
|
111
|
-
'import/no-namespace': 'off',
|
|
111
|
+
'import-x/no-namespace': 'off',
|
|
112
112
|
|
|
113
113
|
// Ensure consistent use of file extension within the import path
|
|
114
114
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
|
115
|
-
'import/extensions': [
|
|
115
|
+
'import-x/extensions': [
|
|
116
116
|
'error',
|
|
117
117
|
'ignorePackages',
|
|
118
118
|
{
|
|
@@ -126,35 +126,35 @@ const importRules = {
|
|
|
126
126
|
// ensure absolute imports are above relative imports and that unassigned imports are ignored
|
|
127
127
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
|
|
128
128
|
// TODO: enforce a stricter convention in module import order?
|
|
129
|
-
'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
|
|
129
|
+
'import-x/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
|
|
130
130
|
|
|
131
131
|
// Require a newline after the last import/require in a group
|
|
132
132
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
|
|
133
|
-
'import/newline-after-import': 'error',
|
|
133
|
+
'import-x/newline-after-import': 'error',
|
|
134
134
|
|
|
135
135
|
// Require modules with a single export to use a default export
|
|
136
136
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
|
|
137
|
-
'import/prefer-default-export': 'off',
|
|
137
|
+
'import-x/prefer-default-export': 'off',
|
|
138
138
|
|
|
139
139
|
// Restrict which files can be imported in a given folder
|
|
140
140
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
|
|
141
|
-
'import/no-restricted-paths': 'off',
|
|
141
|
+
'import-x/no-restricted-paths': 'off',
|
|
142
142
|
|
|
143
143
|
// Forbid modules to have too many dependencies
|
|
144
144
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
|
|
145
|
-
'import/max-dependencies': ['off', { max: 10 }],
|
|
145
|
+
'import-x/max-dependencies': ['off', { max: 10 }],
|
|
146
146
|
|
|
147
147
|
// Forbid import of modules using absolute paths
|
|
148
148
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
|
|
149
|
-
'import/no-absolute-path': 'error',
|
|
149
|
+
'import-x/no-absolute-path': 'error',
|
|
150
150
|
|
|
151
151
|
// Forbid require() calls with expressions
|
|
152
152
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
|
|
153
|
-
'import/no-dynamic-require': 'error',
|
|
153
|
+
'import-x/no-dynamic-require': 'error',
|
|
154
154
|
|
|
155
155
|
// prevent importing the submodules of other modules
|
|
156
156
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
|
|
157
|
-
'import/no-internal-modules': ['off', {
|
|
157
|
+
'import-x/no-internal-modules': ['off', {
|
|
158
158
|
allow: [],
|
|
159
159
|
}],
|
|
160
160
|
|
|
@@ -163,24 +163,24 @@ const importRules = {
|
|
|
163
163
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
|
|
164
164
|
// this should not be enabled until this proposal has at least been *presented* to TC39.
|
|
165
165
|
// At the moment, it's not a thing.
|
|
166
|
-
'import/unambiguous': 'off',
|
|
166
|
+
'import-x/unambiguous': 'off',
|
|
167
167
|
|
|
168
168
|
// Forbid Webpack loader syntax in imports
|
|
169
169
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
170
|
-
'import/no-webpack-loader-syntax': 'error',
|
|
170
|
+
'import-x/no-webpack-loader-syntax': 'error',
|
|
171
171
|
|
|
172
172
|
// Prevent unassigned imports
|
|
173
173
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
|
|
174
174
|
// importing for side effects is perfectly acceptable, if you need side effects.
|
|
175
|
-
'import/no-unassigned-import': 'off',
|
|
175
|
+
'import-x/no-unassigned-import': 'off',
|
|
176
176
|
|
|
177
177
|
// Prevent importing the default as if it were named
|
|
178
178
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
|
|
179
|
-
'import/no-named-default': 'error',
|
|
179
|
+
'import-x/no-named-default': 'error',
|
|
180
180
|
|
|
181
181
|
// Reports if a module's default export is unnamed
|
|
182
182
|
// https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
|
|
183
|
-
'import/no-anonymous-default-export': ['off', {
|
|
183
|
+
'import-x/no-anonymous-default-export': ['off', {
|
|
184
184
|
allowArray: false,
|
|
185
185
|
allowArrowFunction: false,
|
|
186
186
|
allowAnonymousClass: false,
|
|
@@ -192,49 +192,49 @@ const importRules = {
|
|
|
192
192
|
// This rule enforces that all exports are declared at the bottom of the file.
|
|
193
193
|
// https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
|
|
194
194
|
// TODO: enable?
|
|
195
|
-
'import/exports-last': 'off',
|
|
195
|
+
'import-x/exports-last': 'off',
|
|
196
196
|
|
|
197
197
|
// Reports when named exports are not grouped together in a single export declaration
|
|
198
198
|
// or when multiple assignments to CommonJS module.exports or exports object are present
|
|
199
199
|
// in a single file.
|
|
200
200
|
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
|
|
201
|
-
'import/group-exports': 'off',
|
|
201
|
+
'import-x/group-exports': 'off',
|
|
202
202
|
|
|
203
203
|
// forbid default exports. this is a terrible rule, do not use it.
|
|
204
204
|
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
|
|
205
|
-
'import/no-default-export': 'off',
|
|
205
|
+
'import-x/no-default-export': 'off',
|
|
206
206
|
|
|
207
207
|
// Prohibit named exports. this is a terrible rule, do not use it.
|
|
208
208
|
// https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
|
|
209
|
-
'import/no-named-export': 'off',
|
|
209
|
+
'import-x/no-named-export': 'off',
|
|
210
210
|
|
|
211
211
|
// Forbid a module from importing itself
|
|
212
212
|
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
|
|
213
|
-
'import/no-self-import': 'error',
|
|
213
|
+
'import-x/no-self-import': 'error',
|
|
214
214
|
|
|
215
215
|
// Forbid cyclical dependencies between modules
|
|
216
216
|
// https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
|
|
217
|
-
'import/no-cycle': ['error', { maxDepth: Infinity }],
|
|
217
|
+
'import-x/no-cycle': ['error', { maxDepth: Infinity }],
|
|
218
218
|
|
|
219
219
|
// Ensures that there are no useless path segments
|
|
220
220
|
// https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
|
|
221
|
-
'import/no-useless-path-segments': ['error', { commonjs: true }],
|
|
221
|
+
'import-x/no-useless-path-segments': ['error', { commonjs: true }],
|
|
222
222
|
|
|
223
223
|
// dynamic imports require a leading comment with a webpackChunkName
|
|
224
224
|
// https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
|
|
225
|
-
'import/dynamic-import-chunkname': ['off', {
|
|
225
|
+
'import-x/dynamic-import-chunkname': ['off', {
|
|
226
226
|
importFunctions: [],
|
|
227
227
|
webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
|
|
228
228
|
}],
|
|
229
229
|
|
|
230
230
|
// Use this rule to prevent imports to folders in relative parent paths.
|
|
231
231
|
// https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
|
|
232
|
-
'import/no-relative-parent-imports': 'off',
|
|
232
|
+
'import-x/no-relative-parent-imports': 'off',
|
|
233
233
|
|
|
234
234
|
// Reports modules without any exports, or with unused exports
|
|
235
235
|
// https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
|
|
236
236
|
// TODO: enable, semver-major
|
|
237
|
-
'import/no-unused-modules': ['off', {
|
|
237
|
+
'import-x/no-unused-modules': ['off', {
|
|
238
238
|
ignoreExports: [],
|
|
239
239
|
missingExports: true,
|
|
240
240
|
unusedExports: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import eslintReact from '@eslint-react/eslint-plugin';
|
|
2
2
|
import stylistic from '@stylistic/eslint-plugin';
|
|
3
|
-
import
|
|
3
|
+
import jsxA11yX from 'eslint-plugin-jsx-a11y-x';
|
|
4
4
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
5
5
|
import globals from 'globals';
|
|
6
6
|
import reactRules from './rules/react.mjs';
|
|
@@ -25,7 +25,7 @@ export const index = {
|
|
|
25
25
|
plugins: {
|
|
26
26
|
'@eslint-react': eslintReact,
|
|
27
27
|
'@stylistic': stylistic,
|
|
28
|
-
'jsx-a11y':
|
|
28
|
+
'jsx-a11y-x': jsxA11yX,
|
|
29
29
|
'react-hooks': reactHooks,
|
|
30
30
|
...customReactConfig.plugins,
|
|
31
31
|
},
|
|
@@ -1,233 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import jsxA11yX from 'eslint-plugin-jsx-a11y-x';
|
|
2
2
|
|
|
3
|
+
/** @type {import('eslint').Linter.Config} */
|
|
3
4
|
const reactA11yRules = {
|
|
4
5
|
rules: {
|
|
5
|
-
|
|
6
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
|
|
7
|
-
'jsx-a11y/anchor-has-content': ['error', { components: [] }],
|
|
8
|
-
|
|
9
|
-
// Require ARIA roles to be valid and non-abstract
|
|
10
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
|
|
11
|
-
'jsx-a11y/aria-role': ['error', { ignoreNonDom: false }],
|
|
6
|
+
...jsxA11yX.configs.strict.rules,
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'jsx-a11y/aria-
|
|
8
|
+
'jsx-a11y-x/anchor-ambiguous-text': 'error',
|
|
9
|
+
'jsx-a11y-x/control-has-associated-label': 'error',
|
|
10
|
+
'jsx-a11y-x/no-aria-hidden-on-focusable': 'error',
|
|
11
|
+
'jsx-a11y-x/prefer-tag-over-role': 'error',
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
|
|
19
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
20
|
-
|
|
21
|
-
// Enforce that elements that do not support ARIA roles, states, and
|
|
22
|
-
// properties do not have those attributes.
|
|
23
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
|
|
24
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
25
|
-
|
|
26
|
-
// Enforce that all elements that require alternative text have meaningful information
|
|
27
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
|
|
28
|
-
'jsx-a11y/alt-text': ['error', {
|
|
29
|
-
elements: ['img', 'object', 'area', 'input[type="image"]'],
|
|
30
|
-
img: [],
|
|
31
|
-
object: [],
|
|
32
|
-
area: [],
|
|
33
|
-
'input[type="image"]': [],
|
|
34
|
-
}],
|
|
35
|
-
|
|
36
|
-
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
37
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
|
|
38
|
-
'jsx-a11y/img-redundant-alt': 'error',
|
|
39
|
-
|
|
40
|
-
// require that JSX labels use "htmlFor"
|
|
41
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
|
|
42
|
-
// deprecated: replaced by `label-has-associated-control` rule
|
|
43
|
-
'jsx-a11y/label-has-for': ['off', {
|
|
44
|
-
components: [],
|
|
45
|
-
required: {
|
|
46
|
-
every: ['nesting', 'id'],
|
|
47
|
-
},
|
|
48
|
-
allowChildren: false,
|
|
49
|
-
}],
|
|
50
|
-
|
|
51
|
-
// Enforce that a label tag has a text label and an associated control.
|
|
52
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
|
|
53
|
-
'jsx-a11y/label-has-associated-control': ['error', {
|
|
54
|
-
labelComponents: [],
|
|
55
|
-
labelAttributes: [],
|
|
56
|
-
controlComponents: [],
|
|
13
|
+
'jsx-a11y-x/label-has-associated-control': ['error', {
|
|
57
14
|
assert: 'both',
|
|
58
15
|
depth: 25,
|
|
59
16
|
}],
|
|
60
17
|
|
|
61
|
-
|
|
62
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
|
|
63
|
-
'jsx-a11y/control-has-associated-label': ['error', {
|
|
64
|
-
labelAttributes: ['label'],
|
|
65
|
-
controlComponents: [],
|
|
66
|
-
ignoreElements: [
|
|
67
|
-
'audio',
|
|
68
|
-
'canvas',
|
|
69
|
-
'embed',
|
|
70
|
-
'input',
|
|
71
|
-
'textarea',
|
|
72
|
-
'tr',
|
|
73
|
-
'video',
|
|
74
|
-
],
|
|
75
|
-
ignoreRoles: [
|
|
76
|
-
'grid',
|
|
77
|
-
'listbox',
|
|
78
|
-
'menu',
|
|
79
|
-
'menubar',
|
|
80
|
-
'radiogroup',
|
|
81
|
-
'row',
|
|
82
|
-
'tablist',
|
|
83
|
-
'toolbar',
|
|
84
|
-
'tree',
|
|
85
|
-
'treegrid',
|
|
86
|
-
],
|
|
87
|
-
depth: 5,
|
|
88
|
-
}],
|
|
89
|
-
|
|
90
|
-
// require that mouseover/out come with focus/blur, for keyboard-only users
|
|
91
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
|
|
92
|
-
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
93
|
-
|
|
94
|
-
// Prevent use of `accessKey`
|
|
95
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
|
|
96
|
-
'jsx-a11y/no-access-key': 'error',
|
|
97
|
-
|
|
98
|
-
// require onBlur instead of onChange
|
|
99
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
|
|
100
|
-
'jsx-a11y/no-onchange': 'off',
|
|
101
|
-
|
|
102
|
-
// Elements with an interactive role and interaction handlers must be focusable
|
|
103
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
|
|
104
|
-
'jsx-a11y/interactive-supports-focus': 'error',
|
|
105
|
-
|
|
106
|
-
// Enforce that elements with ARIA roles must have all required attributes
|
|
107
|
-
// for that role.
|
|
108
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
|
|
109
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
110
|
-
|
|
111
|
-
// Enforce that elements with explicit or implicit roles defined contain
|
|
112
|
-
// only aria-* properties supported by that role.
|
|
113
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
|
|
114
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
115
|
-
|
|
116
|
-
// Enforce tabIndex value is not greater than zero.
|
|
117
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
|
|
118
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
119
|
-
|
|
120
|
-
// ensure <hX> tags have content and are not aria-hidden
|
|
121
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
|
|
122
|
-
'jsx-a11y/heading-has-content': ['error', { components: [''] }],
|
|
123
|
-
|
|
124
|
-
// require HTML elements to have a "lang" prop
|
|
125
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
|
|
126
|
-
'jsx-a11y/html-has-lang': 'error',
|
|
127
|
-
|
|
128
|
-
// require HTML element's lang prop to be valid
|
|
129
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
|
|
130
|
-
'jsx-a11y/lang': 'error',
|
|
131
|
-
|
|
132
|
-
// prevent distracting elements, like <marquee> and <blink>
|
|
133
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
|
|
134
|
-
'jsx-a11y/no-distracting-elements': ['error', {
|
|
135
|
-
elements: ['marquee', 'blink'],
|
|
136
|
-
}],
|
|
137
|
-
|
|
138
|
-
// only allow <th> to have the "scope" attr
|
|
139
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
|
|
140
|
-
'jsx-a11y/scope': 'error',
|
|
141
|
-
|
|
142
|
-
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
143
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
|
|
144
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
145
|
-
|
|
146
|
-
// Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
147
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
|
|
148
|
-
'jsx-a11y/no-static-element-interactions': ['error', {
|
|
149
|
-
handlers: [
|
|
150
|
-
'onClick',
|
|
151
|
-
'onMouseDown',
|
|
152
|
-
'onMouseUp',
|
|
153
|
-
'onKeyPress',
|
|
154
|
-
'onKeyDown',
|
|
155
|
-
'onKeyUp',
|
|
156
|
-
],
|
|
157
|
-
}],
|
|
158
|
-
|
|
159
|
-
// A non-interactive element does not support event handlers (mouse and key handlers)
|
|
160
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
|
|
161
|
-
'jsx-a11y/no-noninteractive-element-interactions': ['error', {
|
|
162
|
-
handlers: [
|
|
163
|
-
'onClick',
|
|
164
|
-
'onMouseDown',
|
|
165
|
-
'onMouseUp',
|
|
166
|
-
'onKeyPress',
|
|
167
|
-
'onKeyDown',
|
|
168
|
-
'onKeyUp',
|
|
169
|
-
],
|
|
170
|
-
}],
|
|
171
|
-
|
|
172
|
-
// ensure emoji are accessible
|
|
173
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
|
|
174
|
-
'jsx-a11y/accessible-emoji': 'error',
|
|
175
|
-
|
|
176
|
-
// elements with aria-activedescendant must be tabbable
|
|
177
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
|
|
178
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
179
|
-
|
|
180
|
-
// ensure iframe elements have a unique title
|
|
181
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
|
|
182
|
-
'jsx-a11y/iframe-has-title': 'error',
|
|
183
|
-
|
|
184
|
-
// prohibit autoFocus prop
|
|
185
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
|
|
186
|
-
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
|
|
187
|
-
|
|
188
|
-
// ensure HTML elements do not specify redundant ARIA roles
|
|
189
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
|
|
190
|
-
'jsx-a11y/no-redundant-roles': 'error',
|
|
191
|
-
|
|
192
|
-
// media elements must have captions
|
|
193
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
|
|
194
|
-
'jsx-a11y/media-has-caption': ['error', {
|
|
195
|
-
audio: [],
|
|
196
|
-
video: [],
|
|
197
|
-
track: [],
|
|
198
|
-
}],
|
|
199
|
-
|
|
200
|
-
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
201
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
|
|
202
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': ['error', {
|
|
203
|
-
tr: ['none', 'presentation'],
|
|
204
|
-
}],
|
|
205
|
-
|
|
206
|
-
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
207
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
|
|
208
|
-
'jsx-a11y/no-noninteractive-element-to-interactive-role': ['error', {
|
|
209
|
-
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
210
|
-
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
211
|
-
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
212
|
-
table: ['grid'],
|
|
213
|
-
td: ['gridcell'],
|
|
214
|
-
}],
|
|
215
|
-
|
|
216
|
-
// Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
217
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
|
|
218
|
-
'jsx-a11y/no-noninteractive-tabindex': ['error', {
|
|
219
|
-
tags: [],
|
|
220
|
-
roles: ['tabpanel'],
|
|
221
|
-
}],
|
|
222
|
-
|
|
223
|
-
// ensure <a> tags are valid
|
|
224
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
|
|
225
|
-
'jsx-a11y/anchor-is-valid': ['error', {
|
|
18
|
+
'jsx-a11y-x/anchor-is-valid': ['error', {
|
|
226
19
|
components: ['Link'],
|
|
227
20
|
specialLink: ['to'],
|
|
228
21
|
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
229
22
|
}],
|
|
23
|
+
|
|
24
|
+
'jsx-a11y-x/no-noninteractive-element-interactions': 'error',
|
|
230
25
|
},
|
|
231
26
|
};
|
|
232
27
|
|
|
233
|
-
export default reactA11yRules;
|
|
28
|
+
export default reactA11yRules;
|
|
@@ -3,10 +3,15 @@ import tsParser from '@typescript-eslint/parser';
|
|
|
3
3
|
import typeScriptSettings from './settings/typescript.mjs';
|
|
4
4
|
import allRules from './rules/all.mjs';
|
|
5
5
|
import { deepMerge } from '../../deepMerge.mjs';
|
|
6
|
+
import { importX } from 'eslint-plugin-import-x';
|
|
6
7
|
|
|
7
8
|
/** @type {import('eslint').Linter.Config} */
|
|
8
9
|
|
|
9
10
|
export const index = deepMerge(
|
|
11
|
+
{
|
|
12
|
+
settings: importX.flatConfigs.typescript.settings,
|
|
13
|
+
rules: importX.flatConfigs.typescript.rules,
|
|
14
|
+
},
|
|
10
15
|
{
|
|
11
16
|
files: ['**/*.{ts,tsx}'],
|
|
12
17
|
settings: typeScriptSettings.settings,
|
package/config/index.mjs
CHANGED
|
@@ -20,13 +20,6 @@ const baseRules = {
|
|
|
20
20
|
'no-useless-escape': 'warn',
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const reactA11yRules = {
|
|
24
|
-
'jsx-a11y/anchor-is-valid': 'warn',
|
|
25
|
-
'jsx-a11y/control-has-associated-label': 'warn',
|
|
26
|
-
'jsx-a11y/no-static-element-interactions': 'warn',
|
|
27
|
-
'jsx-a11y/label-has-associated-control': 'warn',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
23
|
const typeScriptRules = {
|
|
31
24
|
'@typescript-eslint/no-use-before-define': 'off',
|
|
32
25
|
|
|
@@ -121,7 +114,6 @@ export const rootEslintConfig = [
|
|
|
121
114
|
rules: {
|
|
122
115
|
...baseRules,
|
|
123
116
|
...typeScriptRules,
|
|
124
|
-
...reactA11yRules,
|
|
125
117
|
},
|
|
126
118
|
},
|
|
127
119
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innovixx/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.1",
|
|
4
4
|
"main": "config/index.mjs",
|
|
5
5
|
"repository": "git@github.com:innovixx/eslint-config.git",
|
|
6
6
|
"description": "Opinionated ESLint config for JavaScript developers",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
|
25
25
|
"@typescript-eslint/parser": "^8.72.1",
|
|
26
26
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
27
|
-
"eslint-plugin-import": "^
|
|
27
|
+
"eslint-plugin-import-x": "^4.18.0",
|
|
28
28
|
"eslint-plugin-jest": "^29.17.0",
|
|
29
29
|
"eslint-plugin-jest-dom": "^5.10.1",
|
|
30
|
-
"eslint-plugin-jsx-a11y": "^
|
|
30
|
+
"eslint-plugin-jsx-a11y-x": "^0.2.0",
|
|
31
31
|
"eslint-plugin-n": "^18.5.0",
|
|
32
32
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
33
33
|
"eslint-plugin-sort-export-all": "^2.1.0",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@types/react-dom": "^19.3.0",
|
|
47
47
|
"eslint": "10.14.0",
|
|
48
48
|
"graphql": "^16",
|
|
49
|
+
"react": "^19.3.1",
|
|
49
50
|
"typescript": "6.0.3"
|
|
50
51
|
}
|
|
51
52
|
}
|