@viclafouch/eslint-config-viclafouch 4.17.0 → 4.17.1-beta.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/imports.js DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['./rules/imports.js'].map(require.resolve),
6
- rules: {}
7
- }
package/index.js DELETED
@@ -1,22 +0,0 @@
1
- // This is a patch so that eslint will load the plugins as dependencies. Otherwise we can to install EVERYTHING in th root project
2
- require('@rushstack/eslint-patch/modern-module-resolution')
3
-
4
- /**
5
- * @type {import("eslint").Linter.Config}
6
- */
7
- module.exports = {
8
- extends: [
9
- './rules/best-practices',
10
- './rules/node',
11
- './rules/errors',
12
- './rules/imports',
13
- './rules/style',
14
- './rules/variables',
15
- './rules/es6'
16
- ].map(require.resolve),
17
- parserOptions: {
18
- ecmaVersion: 2022,
19
- sourceType: 'module'
20
- },
21
- rules: {}
22
- }
package/next.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['./react.js', './hooks.js']
6
- .map(require.resolve)
7
- .concat(['plugin:@next/next/recommended']),
8
- rules: {
9
- // No error for anchor inside a Next Link
10
- 'jsx-a11y/anchor-is-valid': [
11
- 'error',
12
- {
13
- components: ['Link'],
14
- specialLink: ['hrefLeft', 'hrefRight'],
15
- aspects: ['invalidHref', 'preferButton']
16
- }
17
- ]
18
- }
19
- }
package/prettier.js DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['prettier'],
6
- plugins: ['prettier'],
7
- rules: {
8
- 'prettier/prettier': [
9
- 'error',
10
- {
11
- plugins: ['prettier-plugin-curly'],
12
- semi: false,
13
- singleQuote: true,
14
- printWidth: 80,
15
- tabWidth: 2,
16
- jsxSingleQuote: false,
17
- trailingComma: 'none',
18
- endOfLine: 'auto',
19
- bracketSameLine: false,
20
- arrowParens: 'always'
21
- }
22
- ]
23
- }
24
- }
package/react.js DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['./rules/react.js'].map(require.resolve),
6
- rules: {}
7
- }
package/rules/react.js DELETED
@@ -1,399 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['plugin:jsx-a11y/recommended'],
6
- plugins: ['react'],
7
- settings: {
8
- react: {
9
- version: 'detect'
10
- }
11
- },
12
- parserOptions: {
13
- ecmaFeatures: {
14
- jsx: true
15
- }
16
- },
17
- // View link below for react rules documentation
18
- // https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
19
- rules: {
20
- // Specify whether double or single quotes should be used in JSX attributes
21
- // https://eslint.org/docs/rules/jsx-quotes
22
- 'jsx-quotes': ['error', 'prefer-double'],
23
-
24
- // Forbid the use of Proptypes
25
- 'react/prop-types': 'off',
26
-
27
- // defaultProps is deprecated
28
- 'react/require-default-props': [
29
- 'error',
30
- {
31
- functions: 'defaultArguments'
32
- }
33
- ],
34
-
35
- // Forbid certain props on DOM Nodes
36
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
37
- 'react/forbid-dom-props': ['off', { forbid: [] }],
38
-
39
- // Enforce boolean attributes notation in JSX
40
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
41
- 'react/jsx-boolean-value': 'error',
42
-
43
- // Validate closing bracket location in JSX
44
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
45
- 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
46
-
47
- // Validate closing tag location in JSX
48
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
49
- 'react/jsx-closing-tag-location': 'error',
50
-
51
- // Enforce or disallow spaces inside of curly braces in JSX attributes
52
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
53
- 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
54
-
55
- // Validate props indentation in JSX
56
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
57
- 'react/jsx-indent-props': ['error', 2],
58
-
59
- // Validate JSX has key prop when in array or iterator
60
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
61
- // Turned off because it has too many false positives
62
- 'react/jsx-key': 'off',
63
-
64
- // Limit maximum of props on a single line in JSX
65
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
66
- 'react/jsx-max-props-per-line': [
67
- 'error',
68
- { maximum: 1, when: 'multiline' }
69
- ],
70
-
71
- // Prevent usage of .bind() in JSX props
72
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
73
- 'react/jsx-no-bind': [
74
- 'error',
75
- {
76
- ignoreRefs: true,
77
- allowArrowFunctions: true,
78
- allowFunctions: false,
79
- allowBind: false,
80
- ignoreDOMComponents: true
81
- }
82
- ],
83
-
84
- // Prevent duplicate props in JSX
85
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
86
- 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
87
-
88
- // Prevent usage of unwrapped JSX strings
89
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
90
- 'react/jsx-no-literals': ['off', { noStrings: true }],
91
-
92
- // Disallow undeclared variables in JSX
93
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
94
- 'react/jsx-no-undef': 'error',
95
-
96
- // Enforce PascalCase for user-defined JSX components
97
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
98
- 'react/jsx-pascal-case': [
99
- 'error',
100
- {
101
- allowAllCaps: true,
102
- ignore: []
103
- }
104
- ],
105
-
106
- // Enforce defaultProps declarations alphabetical sorting
107
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
108
- 'react/jsx-sort-default-props': [
109
- 'off',
110
- {
111
- ignoreCase: true
112
- }
113
- ],
114
-
115
- // Prevent variables used in JSX to be incorrectly marked as unused
116
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
117
- 'react/jsx-uses-vars': 'error',
118
-
119
- // Prevent usage of dangerous JSX properties
120
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
121
- 'react/no-danger': 'warn',
122
-
123
- // Prevent usage of deprecated methods
124
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
125
- 'react/no-deprecated': ['error'],
126
-
127
- // Prevent direct mutation of this.state
128
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
129
- 'react/no-direct-mutation-state': 'off',
130
-
131
- // Prevent multiple component definition per file
132
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
133
- 'react/no-multi-comp': 'off',
134
-
135
- // Prevent using string references
136
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
137
- 'react/no-string-refs': 'error',
138
-
139
- // Prevent usage of unknown DOM property
140
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
141
- 'react/no-unknown-property': 'error',
142
-
143
- // Require stateless functions when not using lifecycle methods, setState or ref
144
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
145
- 'react/prefer-stateless-function': [
146
- 'error',
147
- { ignorePureComponents: true }
148
- ],
149
-
150
- // Prevent extra closing tags for components without children
151
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
152
- 'react/self-closing-comp': 'error',
153
-
154
- // Prevent missing parentheses around multilines JSX
155
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
156
- 'react/jsx-wrap-multilines': [
157
- 'error',
158
- {
159
- declaration: 'parens-new-line',
160
- assignment: 'parens-new-line',
161
- return: 'parens-new-line',
162
- arrow: 'parens-new-line',
163
- condition: 'parens-new-line',
164
- logical: 'parens-new-line',
165
- prop: 'parens-new-line'
166
- }
167
- ],
168
-
169
- // Require that the first prop in a JSX element be on a new line when the element is multiline
170
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
171
- 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
172
-
173
- // Enforce spacing around jsx equals signs
174
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
175
- 'react/jsx-equals-spacing': ['error', 'never'],
176
-
177
- // Enforce JSX indentation
178
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
179
- 'react/jsx-indent': ['error', 2],
180
-
181
- // Disallow target="_blank" on links
182
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
183
- 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
184
-
185
- // only .jsx files may have JSX
186
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
187
- 'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
188
-
189
- // prevent accidental JS comments from being injected into JSX as text
190
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
191
- 'react/jsx-no-comment-textnodes': 'error',
192
-
193
- // disallow using React.render/ReactDOM.render's return value
194
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
195
- 'react/no-render-return-value': 'error',
196
-
197
- // Forbid certain props on Components
198
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
199
- 'react/forbid-component-props': ['off', { forbid: [] }],
200
-
201
- // Prevent problem with children and props.dangerouslySetInnerHTML
202
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
203
- 'react/no-danger-with-children': 'error',
204
-
205
- // Prevent unused propType definitions
206
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
207
- 'react/no-unused-prop-types': [
208
- 'error',
209
- {
210
- customValidators: [],
211
- skipShapeProps: true
212
- }
213
- ],
214
-
215
- // Require style prop value be an object or var
216
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
217
- 'react/style-prop-object': 'error',
218
-
219
- // Prevent invalid characters from appearing in markup
220
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
221
- 'react/no-unescaped-entities': 'error',
222
-
223
- // Prevent passing of children as props
224
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
225
- 'react/no-children-prop': 'error',
226
-
227
- // Validate whitespace in and around the JSX opening and closing brackets
228
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
229
- 'react/jsx-tag-spacing': [
230
- 'error',
231
- {
232
- closingSlash: 'never',
233
- beforeSelfClosing: 'always',
234
- afterOpening: 'never',
235
- beforeClosing: 'never'
236
- }
237
- ],
238
-
239
- // Enforce spaces before the closing bracket of self-closing JSX elements
240
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
241
- // Deprecated in favor of jsx-tag-spacing
242
- 'react/jsx-space-before-closing': ['off', 'always'],
243
-
244
- // Prevent usage of Array index in keys
245
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
246
- 'react/no-array-index-key': 'error',
247
-
248
- // Prevent unused state values
249
- // https://github.com/jsx-eslint/eslint-plugin-react/pull/1103/
250
- 'react/no-unused-state': 'error',
251
-
252
- // Enforces consistent naming for boolean props
253
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
254
- 'react/boolean-prop-naming': [
255
- 'off',
256
- {
257
- propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
258
- rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
259
- message: ''
260
- }
261
- ],
262
-
263
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
264
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
265
- 'react/jsx-curly-brace-presence': [
266
- 'error',
267
- { props: 'never', children: 'never' }
268
- ],
269
-
270
- // One JSX Element Per Line
271
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
272
- 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
273
-
274
- // Enforce consistent usage of destructuring assignment of props, state, and context
275
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
276
- 'react/destructuring-assignment': ['error', 'always'],
277
-
278
- // Prevent usage of button elements without an explicit type attribute
279
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
280
- 'react/button-has-type': [
281
- 'error',
282
- {
283
- button: true,
284
- submit: true,
285
- reset: false
286
- }
287
- ],
288
-
289
- // Ensures inline tags are not rendered without spaces between them
290
- 'react/jsx-child-element-spacing': 'off',
291
-
292
- // Disallow multiple spaces between inline JSX props
293
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
294
- 'react/jsx-props-no-multi-spaces': 'error',
295
-
296
- // Enforce shorthand or standard form for React fragments
297
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
298
- 'react/jsx-fragments': ['error', 'syntax'],
299
-
300
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
301
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
302
- 'react/jsx-curly-newline': [
303
- 'error',
304
- {
305
- multiline: 'consistent',
306
- singleline: 'consistent'
307
- }
308
- ],
309
-
310
- // Disallow unnecessary fragments
311
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
312
- 'react/jsx-no-useless-fragment': [
313
- 'error',
314
- {
315
- allowExpressions: true
316
- }
317
- ],
318
-
319
- // This rule is turned off with the new JSX transform
320
- // since `eslint-plugin-react` is used.
321
- // Ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform
322
- 'react/jsx-uses-react': 'off',
323
-
324
- // This rule is turned off with the new JSX transform
325
- // since `eslint-plugin-react` is used.
326
- // Ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform
327
- 'react/react-in-jsx-scope': 'off',
328
-
329
- // Enforce a specific function type for function components
330
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
331
- 'react/function-component-definition': [
332
- 'error',
333
- { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }
334
- ],
335
-
336
- // Prevent react contexts from taking non-stable values
337
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
338
- 'react/jsx-no-constructed-context-values': 'error',
339
-
340
- // Lifecycle methods should be methods on the prototype, not class fields
341
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
342
- 'react/no-arrow-function-lifecycle': 'error',
343
-
344
- // Prevent usage of invalid attributes
345
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
346
- 'react/no-invalid-html-attribute': 'error',
347
-
348
- // Enforce sandbox attribute on iframe elements
349
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/docs/rules/iframe-missing-sandbox.md
350
- 'react/iframe-missing-sandbox': 'error',
351
-
352
- // Prevent problematic leaked values from being rendered
353
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/c42b624d0fb9ad647583a775ab9751091eec066f/docs/rules/jsx-no-leaked-render.md
354
- 'react/jsx-no-leaked-render': [
355
- 'error',
356
- {
357
- validStrategies: ['ternary']
358
- }
359
- ],
360
-
361
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/no-object-type-as-default-prop.md
362
- 'react/no-object-type-as-default-prop': 'error',
363
-
364
- 'class-methods-use-this': [
365
- 'error',
366
- {
367
- exceptMethods: [
368
- 'render',
369
- 'componentDidCatch',
370
- 'getSnapshotBeforeUpdate'
371
- ]
372
- }
373
- ],
374
-
375
- // Don't require captions for video / audio
376
- 'jsx-a11y/media-has-caption': 'off',
377
-
378
- // Disable spreading props in components more than once
379
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.35.0/docs/rules/jsx-props-no-spread-multi.md
380
- 'react/jsx-props-no-spread-multi': 'off'
381
- },
382
- overrides: [
383
- {
384
- // JSX in .tsx files instead of .jsx
385
- files: ['*.ts?(x)'],
386
- rules: {
387
- 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }]
388
- }
389
- },
390
- {
391
- // Enable eslint-plugin-testing-library rules or preset only for matching files!
392
- files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
393
- extends: ['plugin:testing-library/react'],
394
- rules: {
395
- 'testing-library/render-result-naming-convention': 0
396
- }
397
- }
398
- ]
399
- }