@viclafouch/eslint-config-viclafouch 4.22.1-beta.4 → 4.22.1-beta.5
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/.claude/settings.local.json +4 -1
- package/CLAUDE.md +39 -45
- package/README.md +113 -185
- package/bin/init.js +77 -0
- package/eslint.config.mjs +2 -2
- package/index.d.ts +0 -1
- package/index.mjs +0 -1
- package/package.json +4 -1
- package/rules/typescript.mjs +927 -100
- package/templates/nextjs.js +19 -0
- package/templates/react.js +26 -0
- package/templates/typescript.js +15 -0
- package/base.mjs +0 -36
- package/rules/best-practices.mjs +0 -517
- package/rules/errors.mjs +0 -46
- package/rules/es6.mjs +0 -218
- package/rules/node.mjs +0 -24
- package/rules/style.mjs +0 -43
- package/rules/variables.mjs +0 -81
package/rules/es6.mjs
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import pluginPromise from 'eslint-plugin-promise'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import("eslint").Linter.Config}
|
|
5
|
-
*/
|
|
6
|
-
export default {
|
|
7
|
-
name: 'es6',
|
|
8
|
-
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
9
|
-
plugins: {
|
|
10
|
-
promise: pluginPromise
|
|
11
|
-
},
|
|
12
|
-
languageOptions: {
|
|
13
|
-
parserOptions: {
|
|
14
|
-
ecmaFeatures: {
|
|
15
|
-
jsx: true
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
ecmaVersion: 'latest',
|
|
19
|
-
sourceType: 'module'
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
// Require braces around arrow function bodies
|
|
23
|
-
// https://eslint.org/docs/rules/arrow-body-style
|
|
24
|
-
'arrow-body-style': ['error', 'always'],
|
|
25
|
-
|
|
26
|
-
// Require parens in arrow function arguments
|
|
27
|
-
// https://eslint.org/docs/rules/arrow-parens
|
|
28
|
-
'arrow-parens': ['error', 'always'],
|
|
29
|
-
|
|
30
|
-
// Require space before/after arrow function's arrow
|
|
31
|
-
// https://eslint.org/docs/rules/arrow-spacing
|
|
32
|
-
'arrow-spacing': ['error', { before: true, after: true }],
|
|
33
|
-
|
|
34
|
-
// Verify super() callings in constructors
|
|
35
|
-
'constructor-super': 'error',
|
|
36
|
-
|
|
37
|
-
// Disallow modifying variables of class declarations
|
|
38
|
-
// https://eslint.org/docs/rules/no-class-assign
|
|
39
|
-
'no-class-assign': 'error',
|
|
40
|
-
|
|
41
|
-
// Disallow duplicate class members
|
|
42
|
-
// https://eslint.org/docs/latest/rules/no-dupe-class-members
|
|
43
|
-
'no-dupe-class-members': 'error',
|
|
44
|
-
|
|
45
|
-
// Disallow arrow functions where they could be confused with comparisons
|
|
46
|
-
// https://eslint.org/docs/rules/no-confusing-arrow
|
|
47
|
-
'no-confusing-arrow': [
|
|
48
|
-
'error',
|
|
49
|
-
{
|
|
50
|
-
allowParens: true
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
// Disallow modifying variables that are declared using const
|
|
55
|
-
// https://eslint.org/docs/latest/rules/no-const-assign
|
|
56
|
-
'no-const-assign': 'error',
|
|
57
|
-
|
|
58
|
-
// Disallow importing from the same path more than once
|
|
59
|
-
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
60
|
-
// Replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
61
|
-
'no-duplicate-imports': 'off',
|
|
62
|
-
|
|
63
|
-
// Disallow new operators with global non-constructor functions
|
|
64
|
-
// https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
|
|
65
|
-
'no-new-native-nonconstructor': 'error',
|
|
66
|
-
|
|
67
|
-
// Disallow returning values from Promise executor functions
|
|
68
|
-
// https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
69
|
-
'no-promise-executor-return': 'error',
|
|
70
|
-
|
|
71
|
-
// Disallow invalid regular expression strings in RegExp constructors
|
|
72
|
-
// https://eslint.org/docs/latest/rules/no-invalid-regexp
|
|
73
|
-
'no-invalid-regexp': 'error',
|
|
74
|
-
|
|
75
|
-
// Disallow specified names in exports
|
|
76
|
-
// https://eslint.org/docs/rules/no-restricted-exports
|
|
77
|
-
'no-restricted-exports': [
|
|
78
|
-
'error',
|
|
79
|
-
{
|
|
80
|
-
restrictedNamedExports: [
|
|
81
|
-
// Use `export default` to provide a default export
|
|
82
|
-
'default',
|
|
83
|
-
// This will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
84
|
-
'then'
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
|
|
89
|
-
// Disallow this/super before calling super() in constructors
|
|
90
|
-
// https://eslint.org/docs/rules/no-this-before-super
|
|
91
|
-
'no-this-before-super': 'error',
|
|
92
|
-
|
|
93
|
-
// Disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
94
|
-
// https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
|
|
95
|
-
'no-unsafe-optional-chaining': 'error',
|
|
96
|
-
|
|
97
|
-
// Disallow control flow statements in finally blocks
|
|
98
|
-
// https://eslint.org/docs/latest/rules/no-unsafe-finally
|
|
99
|
-
'no-unsafe-finally': 'error',
|
|
100
|
-
|
|
101
|
-
// Disallow useless computed property keys
|
|
102
|
-
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
103
|
-
'no-useless-computed-key': 'error',
|
|
104
|
-
|
|
105
|
-
// Disallow unnecessary constructor
|
|
106
|
-
// https://eslint.org/docs/rules/no-useless-constructor
|
|
107
|
-
'no-useless-constructor': 'error',
|
|
108
|
-
|
|
109
|
-
// Disallow renaming import, export, and destructured assignments to the same name
|
|
110
|
-
// https://eslint.org/docs/rules/no-useless-rename
|
|
111
|
-
'no-useless-rename': [
|
|
112
|
-
'error',
|
|
113
|
-
{
|
|
114
|
-
ignoreDestructuring: false,
|
|
115
|
-
ignoreImport: false,
|
|
116
|
-
ignoreExport: false
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
|
|
120
|
-
// Require let or const instead of var
|
|
121
|
-
'no-var': 'error',
|
|
122
|
-
|
|
123
|
-
// Require method and property shorthand syntax for object literals
|
|
124
|
-
// https://eslint.org/docs/rules/object-shorthand
|
|
125
|
-
'object-shorthand': [
|
|
126
|
-
'error',
|
|
127
|
-
'always',
|
|
128
|
-
{
|
|
129
|
-
ignoreConstructors: false,
|
|
130
|
-
avoidQuotes: true
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
|
|
134
|
-
// Suggest using arrow functions as callbacks
|
|
135
|
-
'prefer-arrow-callback': [
|
|
136
|
-
'error',
|
|
137
|
-
{
|
|
138
|
-
allowNamedFunctions: false,
|
|
139
|
-
allowUnboundThis: true
|
|
140
|
-
}
|
|
141
|
-
],
|
|
142
|
-
|
|
143
|
-
// Suggest using of const declaration for variables that are never modified after declared
|
|
144
|
-
'prefer-const': [
|
|
145
|
-
'error',
|
|
146
|
-
{
|
|
147
|
-
destructuring: 'any',
|
|
148
|
-
ignoreReadBeforeAssign: true
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
|
|
152
|
-
// Prefer destructuring from arrays and objects
|
|
153
|
-
// https://eslint.org/docs/rules/prefer-destructuring
|
|
154
|
-
'prefer-destructuring': [
|
|
155
|
-
'error',
|
|
156
|
-
{
|
|
157
|
-
VariableDeclarator: {
|
|
158
|
-
array: false,
|
|
159
|
-
object: true
|
|
160
|
-
},
|
|
161
|
-
AssignmentExpression: {
|
|
162
|
-
array: true,
|
|
163
|
-
object: false
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
enforceForRenamedProperties: false
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
|
|
171
|
-
// Disallow parseInt() in favor of binary, octal, and hexadecimal literals
|
|
172
|
-
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
173
|
-
'prefer-numeric-literals': 'error',
|
|
174
|
-
|
|
175
|
-
// Suggest using Reflect methods where applicable
|
|
176
|
-
// https://eslint.org/docs/rules/prefer-reflect
|
|
177
|
-
'prefer-reflect': 'off',
|
|
178
|
-
|
|
179
|
-
// Use rest parameters instead of arguments
|
|
180
|
-
// https://eslint.org/docs/rules/prefer-rest-params
|
|
181
|
-
'prefer-rest-params': 'error',
|
|
182
|
-
|
|
183
|
-
// Suggest using the spread syntax instead of .apply()
|
|
184
|
-
// https://eslint.org/docs/rules/prefer-spread
|
|
185
|
-
'prefer-spread': 'error',
|
|
186
|
-
|
|
187
|
-
// Suggest using template literals instead of string concatenation
|
|
188
|
-
// https://eslint.org/docs/rules/prefer-template
|
|
189
|
-
'prefer-template': 'error',
|
|
190
|
-
|
|
191
|
-
// Enforce spacing between object rest-spread
|
|
192
|
-
// https://eslint.org/docs/rules/rest-spread-spacing
|
|
193
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
194
|
-
|
|
195
|
-
// Enforce usage of spacing in template strings
|
|
196
|
-
// https://eslint.org/docs/rules/template-curly-spacing
|
|
197
|
-
'template-curly-spacing': 'error',
|
|
198
|
-
|
|
199
|
-
// Disallow unnecessary return await
|
|
200
|
-
// https://eslint.org/docs/latest/rules/no-return-await
|
|
201
|
-
'no-return-await': 'error',
|
|
202
|
-
|
|
203
|
-
// Disallow async functions which have no await expression
|
|
204
|
-
// https://eslint.org/docs/latest/rules/require-await
|
|
205
|
-
'require-await': 'off',
|
|
206
|
-
|
|
207
|
-
// Prefer to use async/await for Promises
|
|
208
|
-
'promise/prefer-await-to-then': 'off',
|
|
209
|
-
|
|
210
|
-
// Disallow using an async function as a Promise executor
|
|
211
|
-
// https://eslint.org/docs/latest/rules/no-async-promise-executor
|
|
212
|
-
'no-async-promise-executor': 'error',
|
|
213
|
-
|
|
214
|
-
// Disallow template literal placeholder syntax in regular strings
|
|
215
|
-
// https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
216
|
-
'no-template-curly-in-string': 'error'
|
|
217
|
-
}
|
|
218
|
-
}
|
package/rules/node.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import globals from 'globals'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import("eslint").Linter.Config}
|
|
5
|
-
*/
|
|
6
|
-
export default {
|
|
7
|
-
name: 'node',
|
|
8
|
-
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: {
|
|
11
|
-
...globals.node,
|
|
12
|
-
...globals.vitest
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
// Require all requires be top-level
|
|
17
|
-
// https://eslint.org/docs/rules/global-require
|
|
18
|
-
'global-require': 'error',
|
|
19
|
-
|
|
20
|
-
// Enforce usage of the `node:` prefix for builtin imports
|
|
21
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
22
|
-
'unicorn/prefer-node-protocol': 'error'
|
|
23
|
-
}
|
|
24
|
-
}
|
package/rules/style.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import("eslint").Linter.Config}
|
|
3
|
-
*/
|
|
4
|
-
export default {
|
|
5
|
-
name: 'style',
|
|
6
|
-
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
7
|
-
rules: {
|
|
8
|
-
// Enforce camelcase naming convention
|
|
9
|
-
// https://eslint.org/docs/latest/rules/camelcase
|
|
10
|
-
camelcase: 'error',
|
|
11
|
-
|
|
12
|
-
// "red" === color is a "Yoda" condition, prefer color === "red" instead
|
|
13
|
-
// https://eslint.org/docs/latest/rules/yoda
|
|
14
|
-
yoda: 'error',
|
|
15
|
-
|
|
16
|
-
// Disallow the unary operators ++ and --
|
|
17
|
-
// https://eslint.org/docs/latest/rules/no-plusplus
|
|
18
|
-
'no-plusplus': 'error',
|
|
19
|
-
|
|
20
|
-
// Disallow inline comments after code
|
|
21
|
-
// https://eslint.org/docs/latest/rules/no-inline-comments
|
|
22
|
-
'no-inline-comments': 'error',
|
|
23
|
-
|
|
24
|
-
// Require or disallow an empty line between class members
|
|
25
|
-
// https://eslint.org/docs/latest/rules/lines-between-class-members
|
|
26
|
-
'lines-between-class-members': ['error', 'always'],
|
|
27
|
-
|
|
28
|
-
// Require or disallow padding lines between statements
|
|
29
|
-
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
30
|
-
'padding-line-between-statements': [
|
|
31
|
-
2,
|
|
32
|
-
// We always want a blank line before a `return` statement or a multi-line
|
|
33
|
-
// Block.
|
|
34
|
-
{
|
|
35
|
-
blankLine: 'always',
|
|
36
|
-
prev: '*',
|
|
37
|
-
next: ['return', 'multiline-block-like']
|
|
38
|
-
},
|
|
39
|
-
// We always want a blank line after a multi-line block.
|
|
40
|
-
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' }
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
}
|
package/rules/variables.mjs
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import("eslint").Linter.Config}
|
|
3
|
-
*/
|
|
4
|
-
export default {
|
|
5
|
-
name: 'variables',
|
|
6
|
-
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
7
|
-
rules: {
|
|
8
|
-
// Enforce or disallow variable initializations at definition
|
|
9
|
-
'init-declarations': 'off',
|
|
10
|
-
|
|
11
|
-
// Disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
12
|
-
'no-catch-shadow': 'off',
|
|
13
|
-
|
|
14
|
-
// Disallow deletion of variables
|
|
15
|
-
// https://eslint.org/docs/latest/rules/no-delete-var
|
|
16
|
-
'no-delete-var': 'error',
|
|
17
|
-
|
|
18
|
-
// Disallow labels that share a name with a variable
|
|
19
|
-
// https://eslint.org/docs/rules/no-label-var
|
|
20
|
-
'no-label-var': 'error',
|
|
21
|
-
|
|
22
|
-
// Disallow declaration of variables already declared in the outer scope
|
|
23
|
-
'no-shadow': 'error',
|
|
24
|
-
|
|
25
|
-
// For code readability, prevent creating unclear naming
|
|
26
|
-
'id-length': [
|
|
27
|
-
'error',
|
|
28
|
-
{ min: 2, max: Infinity, exceptions: ['t', '_'], properties: 'never' }
|
|
29
|
-
],
|
|
30
|
-
|
|
31
|
-
// Require the second parameter when using `parseInt`.
|
|
32
|
-
// Ref: https://eslint.org/docs/rules/radix
|
|
33
|
-
radix: 2,
|
|
34
|
-
|
|
35
|
-
// Prefer object shorthands for properties.
|
|
36
|
-
// Ref: https://eslint.org/docs/rules/object-shorthand
|
|
37
|
-
'object-shorthand': [2, 'properties'],
|
|
38
|
-
|
|
39
|
-
// Disallow shadowing of names such as arguments
|
|
40
|
-
'no-shadow-restricted-names': 'error',
|
|
41
|
-
|
|
42
|
-
// Disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
43
|
-
'no-undef': ['error', { typeof: true }],
|
|
44
|
-
|
|
45
|
-
// Disallow use of undefined when initializing variables
|
|
46
|
-
'no-undef-init': 'error',
|
|
47
|
-
|
|
48
|
-
// Most common naming that is not always understandable
|
|
49
|
-
'id-denylist': [
|
|
50
|
-
'error',
|
|
51
|
-
'err',
|
|
52
|
-
'cb',
|
|
53
|
-
'arr',
|
|
54
|
-
'acc',
|
|
55
|
-
'idx',
|
|
56
|
-
'ctx',
|
|
57
|
-
'res',
|
|
58
|
-
'val',
|
|
59
|
-
'obj',
|
|
60
|
-
'el',
|
|
61
|
-
'elem',
|
|
62
|
-
'req',
|
|
63
|
-
'str'
|
|
64
|
-
],
|
|
65
|
-
|
|
66
|
-
// Disallow declaration of variables that are not used in the code
|
|
67
|
-
'no-unused-vars': [
|
|
68
|
-
'error',
|
|
69
|
-
{
|
|
70
|
-
vars: 'all',
|
|
71
|
-
args: 'after-used',
|
|
72
|
-
caughtErrors: 'none',
|
|
73
|
-
argsIgnorePattern: '^_',
|
|
74
|
-
ignoreRestSiblings: true
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
|
|
78
|
-
// Disallow use of variables before they are defined
|
|
79
|
-
'no-use-before-define': 'off'
|
|
80
|
-
}
|
|
81
|
-
}
|