@lumelabs/eslint-config 0.1.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.
@@ -0,0 +1,297 @@
1
+ module.exports = {
2
+ plugins: ["import"],
3
+
4
+ extends: ["plugin:import/recommended", "plugin:import/typescript"],
5
+
6
+ settings: {
7
+ "import/parsers": {
8
+ "@typescript-eslint/parser": [".ts", ".tsx"],
9
+ },
10
+ "import/extensions": [".js", ".mjs", ".jsx", ".ts", ".tsx"],
11
+ "import/resolver": {
12
+ typescript: {},
13
+ node: {
14
+ extensions: [".mjs", ".js", ".jsx", ".ts", ".tsx", ".json"],
15
+ },
16
+ },
17
+ "import/ignore": ["node_modules", "\\.(coffee|scss|css|less|hbs|svg|json)$"],
18
+ },
19
+
20
+ rules: {
21
+ // Static analysis:
22
+
23
+ // ensure imports point to files/modules that can be resolved
24
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
25
+ "import/no-unresolved": ["error", { commonjs: true, caseSensitive: true }],
26
+
27
+ // ensure named imports coupled with named exports
28
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
29
+ "import/named": "error",
30
+
31
+ // ensure default import coupled with default export
32
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
33
+ "import/default": "off",
34
+
35
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md
36
+ "import/namespace": "off",
37
+
38
+ // Helpful warnings:
39
+
40
+ // disallow invalid exports, e.g. multiple defaults
41
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
42
+ "import/export": "error",
43
+
44
+ // do not allow a default import name to match a named export
45
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
46
+ "import/no-named-as-default": "error",
47
+
48
+ // warn on accessing default export property names that are also named exports
49
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
50
+ "import/no-named-as-default-member": "off",
51
+
52
+ // disallow use of jsdoc-marked-deprecated imports
53
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
54
+ "import/no-deprecated": "off",
55
+
56
+ // Forbid the use of extraneous packages
57
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
58
+ // paths are treated both as absolute paths, and relative to process.cwd()
59
+ "import/no-extraneous-dependencies": "off",
60
+ // "import/no-extraneous-dependencies": [
61
+ // "error",
62
+ // {
63
+ // devDependencies: [
64
+ // "test/**", // tape, common npm pattern
65
+ // "tests/**", // also common npm pattern
66
+ // "spec/**", // mocha, rspec-like pattern
67
+ // "**/__tests__/**", // jest pattern
68
+ // "**/__mocks__/**", // jest pattern
69
+ // "test.{js,jsx}", // repos with a single test file
70
+ // "test-*.{js,jsx}", // repos with multiple top-level test files
71
+ // "**/*{.,_}{test,spec}.{js,jsx}", // tests where the extension or filename suffix denotes that it is a test
72
+ // "**/jest.config.js", // jest config
73
+ // "**/jest.setup.js", // jest setup
74
+ // "**/vue.config.js", // vue-cli config
75
+ // "**/webpack.config.js", // webpack config
76
+ // "**/webpack.config.*.js", // webpack config
77
+ // "**/rollup.config.js", // rollup config
78
+ // "**/rollup.config.*.js", // rollup config
79
+ // "**/gulpfile.js", // gulp config
80
+ // "**/gulpfile.*.js", // gulp config
81
+ // "**/Gruntfile{,.js}", // grunt config
82
+ // "**/protractor.conf.js", // protractor config
83
+ // "**/protractor.conf.*.js", // protractor config
84
+ // "**/karma.conf.js", // karma config
85
+ // "**/.eslintrc.js", // eslint config
86
+ // ],
87
+ // optionalDependencies: false,
88
+ // },
89
+ // ],
90
+
91
+ // Forbid mutable exports
92
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
93
+ "import/no-mutable-exports": "error",
94
+
95
+ // Module systems:
96
+
97
+ // disallow require()
98
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
99
+ "import/no-commonjs": "off",
100
+
101
+ // disallow AMD require/define
102
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
103
+ "import/no-amd": "error",
104
+
105
+ // No Node.js builtin modules
106
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
107
+ // TODO: enable?
108
+ "import/no-nodejs-modules": "off",
109
+
110
+ // Style guide:
111
+
112
+ // disallow non-import statements appearing before import statements
113
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
114
+ "import/first": "error",
115
+
116
+ // disallow non-import statements appearing before import statements
117
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md
118
+ // deprecated: use `import/first`
119
+ "import/imports-first": "off",
120
+
121
+ // disallow duplicate imports
122
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
123
+ "import/no-duplicates": "error",
124
+
125
+ // disallow namespace imports
126
+ // TODO: enable?
127
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
128
+ "import/no-namespace": "off",
129
+
130
+ // Ensure consistent use of file extension within the import path
131
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
132
+ "import/extensions": [
133
+ "error",
134
+ "ignorePackages",
135
+ {
136
+ js: "never",
137
+ mjs: "never",
138
+ jsx: "never",
139
+ ts: "never",
140
+ tsx: "never",
141
+ },
142
+ ],
143
+
144
+ // ensure absolute imports are above relative imports and that unassigned imports are ignored
145
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
146
+ // TODO: enforce a stricter convention in module import order?
147
+ "import/order": "off",
148
+ // "import/order": ["error", { groups: [["builtin", "external", "internal"]] }],
149
+
150
+ // Require a newline after the last import/require in a group
151
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
152
+ "import/newline-after-import": "error",
153
+
154
+ // Require modules with a single export to use a default export
155
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
156
+ "import/prefer-default-export": "off",
157
+
158
+ // Restrict which files can be imported in a given folder
159
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
160
+ "import/no-restricted-paths": "off",
161
+
162
+ // Forbid modules to have too many dependencies
163
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
164
+ "import/max-dependencies": ["off", { max: 10 }],
165
+
166
+ // Forbid import of modules using absolute paths
167
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
168
+ "import/no-absolute-path": "error",
169
+
170
+ // Forbid require() calls with expressions
171
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
172
+ "import/no-dynamic-require": "error",
173
+
174
+ // prevent importing the submodules of other modules
175
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
176
+ "import/no-internal-modules": [
177
+ "off",
178
+ {
179
+ allow: [],
180
+ },
181
+ ],
182
+
183
+ // Warn if a module could be mistakenly parsed as a script by a consumer
184
+ // leveraging Unambiguous JavaScript Grammar
185
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
186
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
187
+ // At the moment, it's not a thing.
188
+ "import/unambiguous": "off",
189
+
190
+ // Forbid Webpack loader syntax in imports
191
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
192
+ "import/no-webpack-loader-syntax": "error",
193
+
194
+ // Prevent unassigned imports
195
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
196
+ // importing for side effects is perfectly acceptable, if you need side effects.
197
+ "import/no-unassigned-import": "off",
198
+
199
+ // Prevent importing the default as if it were named
200
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
201
+ "import/no-named-default": "error",
202
+
203
+ // Reports if a module's default export is unnamed
204
+ // https://github.com/import-js/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
205
+ "import/no-anonymous-default-export": [
206
+ "off",
207
+ {
208
+ allowArray: false,
209
+ allowArrowFunction: false,
210
+ allowAnonymousClass: false,
211
+ allowAnonymousFunction: false,
212
+ allowLiteral: false,
213
+ allowObject: false,
214
+ },
215
+ ],
216
+
217
+ // This rule enforces that all exports are declared at the bottom of the file.
218
+ // https://github.com/import-js/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
219
+ // TODO: enable?
220
+ "import/exports-last": "off",
221
+
222
+ // Reports when named exports are not grouped together in a single export declaration
223
+ // or when multiple assignments to CommonJS module.exports or exports object are present
224
+ // in a single file.
225
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
226
+ "import/group-exports": "off",
227
+
228
+ // forbid default exports. this is a terrible rule, do not use it.
229
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
230
+ "import/no-default-export": "error",
231
+
232
+ // Prohibit named exports. this is a terrible rule, do not use it.
233
+ // https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
234
+ "import/no-named-export": "off",
235
+
236
+ // Forbid a module from importing itself
237
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
238
+ "import/no-self-import": "error",
239
+
240
+ // Forbid cyclical dependencies between modules
241
+ // https://github.com/import-js/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
242
+ "import/no-cycle": ["error", { maxDepth: "∞" }],
243
+
244
+ // Ensures that there are no useless path segments
245
+ // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
246
+ "import/no-useless-path-segments": ["error", { commonjs: true }],
247
+
248
+ // dynamic imports require a leading comment with a webpackChunkName
249
+ // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
250
+ "import/dynamic-import-chunkname": [
251
+ "off",
252
+ {
253
+ importFunctions: [],
254
+ webpackChunknameFormat: "[0-9a-zA-Z-_/.]+",
255
+ },
256
+ ],
257
+
258
+ // Use this rule to prevent imports to folders in relative parent paths.
259
+ // https://github.com/import-js/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
260
+ "import/no-relative-parent-imports": "off",
261
+
262
+ // Reports modules without any exports, or with unused exports
263
+ // https://github.com/import-js/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
264
+ // TODO: enable once it supports CJS
265
+ "import/no-unused-modules": [
266
+ "off",
267
+ {
268
+ ignoreExports: [],
269
+ missingExports: true,
270
+ unusedExports: true,
271
+ },
272
+ ],
273
+
274
+ // Reports the use of import declarations with CommonJS exports in any module except for the main module.
275
+ // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
276
+ "import/no-import-module-exports": [
277
+ "error",
278
+ {
279
+ exceptions: [],
280
+ },
281
+ ],
282
+
283
+ // Use this rule to prevent importing packages through relative paths.
284
+ // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md
285
+ "import/no-relative-packages": "error",
286
+
287
+ // enforce a consistent style for type specifiers (inline or top-level)
288
+ // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md
289
+ // TODO, semver-major: enable (just in case)
290
+ "import/consistent-type-specifier-style": ["off", "prefer-inline"],
291
+
292
+ // Reports the use of empty named import blocks.
293
+ // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md
294
+ // TODO, semver-minor: enable
295
+ "import/no-empty-named-blocks": "off",
296
+ },
297
+ }
package/rules/node.js ADDED
@@ -0,0 +1,39 @@
1
+ module.exports = {
2
+ rules: {
3
+ // enforce return after a callback
4
+ "callback-return": "off",
5
+
6
+ // require all requires be top-level
7
+ // https://eslint.org/docs/rules/global-require
8
+ "global-require": "error",
9
+
10
+ // enforces error handling in callbacks (node environment)
11
+ "handle-callback-err": "off",
12
+
13
+ // disallow use of the Buffer() constructor
14
+ // https://eslint.org/docs/rules/no-buffer-constructor
15
+ "no-buffer-constructor": "error",
16
+
17
+ // disallow mixing regular variable and require declarations
18
+ "no-mixed-requires": ["off", false],
19
+
20
+ // disallow use of new operator with the require function
21
+ "no-new-require": "error",
22
+
23
+ // disallow string concatenation with __dirname and __filename
24
+ // https://eslint.org/docs/rules/no-path-concat
25
+ "no-path-concat": "error",
26
+
27
+ // disallow use of process.env
28
+ "no-process-env": "off",
29
+
30
+ // disallow process.exit()
31
+ "no-process-exit": "off",
32
+
33
+ // restrict usage of specified node modules
34
+ "no-restricted-modules": "off",
35
+
36
+ // disallow use of synchronous methods (off by default)
37
+ "no-sync": "off",
38
+ },
39
+ }
@@ -0,0 +1,284 @@
1
+ module.exports = {
2
+ plugins: ["jsx-a11y"],
3
+
4
+ extends: ["plugin:jsx-a11y/recommended"],
5
+
6
+ rules: {
7
+ // ensure emoji are accessible
8
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
9
+ // disabled; rule is deprecated
10
+ "jsx-a11y/accessible-emoji": "off",
11
+
12
+ // Enforce that all elements that require alternative text have meaningful information
13
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
14
+ "jsx-a11y/alt-text": [
15
+ "error",
16
+ {
17
+ elements: ["img", "object", "area", 'input[type="image"]'],
18
+ img: [],
19
+ object: [],
20
+ area: [],
21
+ 'input[type="image"]': [],
22
+ },
23
+ ],
24
+
25
+ // Enforce that anchors have content
26
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
27
+ "jsx-a11y/anchor-has-content": ["error", { components: [] }],
28
+
29
+ // ensure <a> tags are valid
30
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
31
+ "jsx-a11y/anchor-is-valid": [
32
+ "error",
33
+ {
34
+ components: ["Link"],
35
+ specialLink: ["to"],
36
+ aspects: ["noHref", "invalidHref", "preferButton"],
37
+ },
38
+ ],
39
+
40
+ // elements with aria-activedescendant must be tabbable
41
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
42
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
43
+
44
+ // Enforce all aria-* props are valid.
45
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
46
+ "jsx-a11y/aria-props": "error",
47
+
48
+ // Enforce ARIA state and property values are valid.
49
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
50
+ "jsx-a11y/aria-proptypes": "error",
51
+
52
+ // Require ARIA roles to be valid and non-abstract
53
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
54
+ "jsx-a11y/aria-role": ["error", { ignoreNonDOM: false }],
55
+
56
+ // Enforce that elements that do not support ARIA roles, states, and
57
+ // properties do not have those attributes.
58
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
59
+ "jsx-a11y/aria-unsupported-elements": "error",
60
+
61
+ // Ensure the autocomplete attribute is correct and suitable for the form field it is used with
62
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md
63
+ "jsx-a11y/autocomplete-valid": [
64
+ "off",
65
+ {
66
+ inputComponents: [],
67
+ },
68
+ ],
69
+
70
+ // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
71
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
72
+ "jsx-a11y/click-events-have-key-events": "off",
73
+ // "jsx-a11y/click-events-have-key-events": "error",
74
+
75
+ // Enforce that a control (an interactive element) has a text label.
76
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
77
+ "jsx-a11y/control-has-associated-label": "off",
78
+ // "jsx-a11y/control-has-associated-label": [
79
+ // "error",
80
+ // {
81
+ // labelAttributes: ["label"],
82
+ // controlComponents: [],
83
+ // ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
84
+ // ignoreRoles: [
85
+ // "grid",
86
+ // "listbox",
87
+ // "menu",
88
+ // "menubar",
89
+ // "radiogroup",
90
+ // "row",
91
+ // "tablist",
92
+ // "toolbar",
93
+ // "tree",
94
+ // "treegrid",
95
+ // ],
96
+ // depth: 5,
97
+ // },
98
+ // ],
99
+
100
+ // ensure <hX> tags have content and are not aria-hidden
101
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
102
+ "jsx-a11y/heading-has-content": ["error", { components: [""] }],
103
+
104
+ // require HTML elements to have a "lang" prop
105
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
106
+ "jsx-a11y/html-has-lang": "error",
107
+
108
+ // ensure iframe elements have a unique title
109
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
110
+ "jsx-a11y/iframe-has-title": "error",
111
+
112
+ // Prevent img alt text from containing redundant words like "image", "picture", or "photo"
113
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
114
+ "jsx-a11y/img-redundant-alt": "error",
115
+
116
+ // Elements with an interactive role and interaction handlers must be focusable
117
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
118
+ "jsx-a11y/interactive-supports-focus": "error",
119
+
120
+ // Enforce that a label tag has a text label and an associated control.
121
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
122
+ "jsx-a11y/label-has-associated-control": [
123
+ "error",
124
+ {
125
+ labelComponents: [],
126
+ labelAttributes: [],
127
+ controlComponents: [],
128
+ assert: "both",
129
+ depth: 25,
130
+ },
131
+ ],
132
+
133
+ // require HTML element's lang prop to be valid
134
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
135
+ "jsx-a11y/lang": "error",
136
+
137
+ // media elements must have captions
138
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
139
+ "jsx-a11y/media-has-caption": [
140
+ "error",
141
+ {
142
+ audio: [],
143
+ video: [],
144
+ track: [],
145
+ },
146
+ ],
147
+
148
+ // require that mouseover/out come with focus/blur, for keyboard-only users
149
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
150
+ "jsx-a11y/mouse-events-have-key-events": "error",
151
+
152
+ // Prevent use of `accessKey`
153
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
154
+ "jsx-a11y/no-access-key": "error",
155
+
156
+ // prohibit autoFocus prop
157
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
158
+ "jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
159
+
160
+ // prevent distracting elements, like <marquee> and <blink>
161
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
162
+ "jsx-a11y/no-distracting-elements": [
163
+ "error",
164
+ {
165
+ elements: ["marquee", "blink"],
166
+ },
167
+ ],
168
+
169
+ // WAI-ARIA roles should not be used to convert an interactive element to non-interactive
170
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
171
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": [
172
+ "error",
173
+ {
174
+ tr: ["none", "presentation"],
175
+ },
176
+ ],
177
+
178
+ // A non-interactive element does not support event handlers (mouse and key handlers)
179
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
180
+ "jsx-a11y/no-noninteractive-element-interactions": [
181
+ "error",
182
+ {
183
+ handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
184
+ },
185
+ ],
186
+
187
+ // WAI-ARIA roles should not be used to convert a non-interactive element to interactive
188
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
189
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
190
+ "error",
191
+ {
192
+ ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
193
+ ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
194
+ li: ["menuitem", "option", "row", "tab", "treeitem"],
195
+ table: ["grid"],
196
+ td: ["gridcell"],
197
+ },
198
+ ],
199
+
200
+ // Tab key navigation should be limited to elements on the page that can be interacted with.
201
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
202
+ "jsx-a11y/no-noninteractive-tabindex": [
203
+ "error",
204
+ {
205
+ tags: [],
206
+ roles: ["tabpanel"],
207
+ allowExpressionValues: true,
208
+ },
209
+ ],
210
+
211
+ // require onBlur instead of onChange
212
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
213
+ "jsx-a11y/no-onchange": "off",
214
+
215
+ // ensure HTML elements do not specify redundant ARIA roles
216
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
217
+ "jsx-a11y/no-redundant-roles": [
218
+ "error",
219
+ {
220
+ nav: ["navigation"],
221
+ },
222
+ ],
223
+
224
+ // Enforce that DOM elements without semantic behavior not have interaction handlers
225
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
226
+ "jsx-a11y/no-static-element-interactions": [
227
+ "error",
228
+ {
229
+ handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
230
+ },
231
+ ],
232
+
233
+ // Enforce that elements with ARIA roles must have all required attributes
234
+ // for that role.
235
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
236
+ "jsx-a11y/role-has-required-aria-props": "error",
237
+
238
+ // Enforce that elements with explicit or implicit roles defined contain
239
+ // only aria-* properties supported by that role.
240
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
241
+ "jsx-a11y/role-supports-aria-props": "error",
242
+
243
+ // only allow <th> to have the "scope" attr
244
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
245
+ "jsx-a11y/scope": "error",
246
+
247
+ // Enforce tabIndex value is not greater than zero.
248
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
249
+ "jsx-a11y/tabindex-no-positive": "error",
250
+
251
+ // ----------------------------------------------------
252
+ // Rules that no longer exist in eslint-plugin-jsx-a11y
253
+ // ----------------------------------------------------
254
+
255
+ // require that JSX labels use "htmlFor"
256
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
257
+ // deprecated: replaced by `label-has-associated-control` rule
258
+ "jsx-a11y/label-has-for": [
259
+ "off",
260
+ {
261
+ components: [],
262
+ required: {
263
+ every: ["nesting", "id"],
264
+ },
265
+ allowChildren: false,
266
+ },
267
+ ],
268
+
269
+ // Ensures anchor text is not ambiguous
270
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/anchor-ambiguous-text.md
271
+ // TODO: semver-major, enable
272
+ "jsx-a11y/anchor-ambiguous-text": "off",
273
+
274
+ // Enforce that aria-hidden="true" is not set on focusable elements.
275
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/no-aria-hidden-on-focusable.md
276
+ // TODO: semver-major, enable
277
+ "jsx-a11y/no-aria-hidden-on-focusable": "off",
278
+
279
+ // Enforces using semantic DOM elements over the ARIA role property.
280
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/prefer-tag-over-role.md
281
+ // TODO: semver-major, enable
282
+ "jsx-a11y/prefer-tag-over-role": "off",
283
+ },
284
+ }
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ plugins: ["react-hooks"],
3
+
4
+ extends: ["plugin:react-hooks/recommended"],
5
+
6
+ rules: {
7
+ // Verify the list of the dependencies for Hooks like useEffect and similar
8
+ // https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
9
+ "react-hooks/exhaustive-deps": "warn",
10
+
11
+ "react-hooks/immutability": "off",
12
+ },
13
+ }