@dartess/eslint-plugin 0.0.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/CHANGELOG.md +7 -0
- package/README.md +134 -0
- package/dist/configs/mobx.d.ts +3 -0
- package/dist/configs/mobx.js +13 -0
- package/dist/configs/next.d.ts +3 -0
- package/dist/configs/next.js +17 -0
- package/dist/configs/react.d.ts +3 -0
- package/dist/configs/react.js +78 -0
- package/dist/configs/recommended.d.ts +3 -0
- package/dist/configs/recommended.js +211 -0
- package/dist/configs/storybook.d.ts +3 -0
- package/dist/configs/storybook.js +20 -0
- package/dist/configs/vendor-rules/best-practices.d.ts +120 -0
- package/dist/configs/vendor-rules/best-practices.js +248 -0
- package/dist/configs/vendor-rules/errors.d.ts +40 -0
- package/dist/configs/vendor-rules/errors.js +92 -0
- package/dist/configs/vendor-rules/es6.d.ts +47 -0
- package/dist/configs/vendor-rules/es6.js +108 -0
- package/dist/configs/vendor-rules/imports.d.ts +41 -0
- package/dist/configs/vendor-rules/imports.js +119 -0
- package/dist/configs/vendor-rules/next-config.d.ts +16 -0
- package/dist/configs/vendor-rules/next-config.js +22 -0
- package/dist/configs/vendor-rules/react-hooks.d.ts +10 -0
- package/dist/configs/vendor-rules/react-hooks.js +17 -0
- package/dist/configs/vendor-rules/react.d.ts +228 -0
- package/dist/configs/vendor-rules/react.js +513 -0
- package/dist/configs/vendor-rules/strict.d.ts +4 -0
- package/dist/configs/vendor-rules/strict.js +9 -0
- package/dist/configs/vendor-rules/style.d.ts +34 -0
- package/dist/configs/vendor-rules/style.js +78 -0
- package/dist/configs/vendor-rules/typescript-disablings.d.ts +5 -0
- package/dist/configs/vendor-rules/typescript-disablings.js +13 -0
- package/dist/configs/vendor-rules/typescript.d.ts +40 -0
- package/dist/configs/vendor-rules/typescript.js +69 -0
- package/dist/configs/vendor-rules/variables.d.ts +28 -0
- package/dist/configs/vendor-rules/variables.js +39 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -0
- package/dist/rules/jsx-text-as-child.d.ts +13 -0
- package/dist/rules/jsx-text-as-child.js +90 -0
- package/dist/rules/max-parent-import-depth.d.ts +3 -0
- package/dist/rules/max-parent-import-depth.js +50 -0
- package/dist/rules/prevent-mixing-external-and-internal-classes.d.ts +13 -0
- package/dist/rules/prevent-mixing-external-and-internal-classes.js +72 -0
- package/dist/rules/require-observer.d.ts +3 -0
- package/dist/rules/require-observer.js +138 -0
- package/dist/rules/stories-export-meta.d.ts +3 -0
- package/dist/rules/stories-export-meta.js +37 -0
- package/dist/rules/stories-export-typed.d.ts +3 -0
- package/dist/rules/stories-export-typed.js +51 -0
- package/dist/rules/strict-observable-components-declaration.d.ts +14 -0
- package/dist/rules/strict-observable-components-declaration.js +118 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/parse-git-ignore.d.ts +2 -0
- package/dist/utils/parse-git-ignore.js +7 -0
- package/docs/rules/jsx-text-as-child.md +101 -0
- package/docs/rules/max-parent-import-depth.md +31 -0
- package/docs/rules/prevent-mixing-external-and-internal-classes.md +42 -0
- package/docs/rules/require-observer.md +43 -0
- package/docs/rules/stories-export-meta.md +37 -0
- package/docs/rules/stories-export-typed.md +42 -0
- package/docs/rules/strict-observable-components-declaration.md +57 -0
- package/package.json +91 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/best-practices.js
|
|
5
|
+
const rules = {
|
|
6
|
+
// enforces return statements in callbacks of array's methods
|
|
7
|
+
// https://eslint.org/docs/rules/array-callback-return
|
|
8
|
+
'array-callback-return': ['error', { allowImplicit: true }],
|
|
9
|
+
// treat var statements as if they were block scoped
|
|
10
|
+
// https://eslint.org/docs/rules/block-scoped-var
|
|
11
|
+
'block-scoped-var': 'error',
|
|
12
|
+
// require default case in switch statements
|
|
13
|
+
// https://eslint.org/docs/rules/default-case
|
|
14
|
+
'default-case': ['error', { commentPattern: '^no default$' }],
|
|
15
|
+
// Enforce default clauses in switch statements to be last
|
|
16
|
+
// https://eslint.org/docs/rules/default-case-last
|
|
17
|
+
'default-case-last': 'error',
|
|
18
|
+
// https://eslint.org/docs/rules/default-param-last
|
|
19
|
+
'default-param-last': 'error',
|
|
20
|
+
// require the use of === and !==
|
|
21
|
+
// https://eslint.org/docs/rules/eqeqeq
|
|
22
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
23
|
+
// Require grouped accessor pairs in object literals and classes
|
|
24
|
+
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
25
|
+
'grouped-accessor-pairs': 'error',
|
|
26
|
+
// make sure for-in loops have an if statement
|
|
27
|
+
// https://eslint.org/docs/rules/guard-for-in
|
|
28
|
+
'guard-for-in': 'error',
|
|
29
|
+
// enforce a maximum number of classes per file
|
|
30
|
+
// https://eslint.org/docs/rules/max-classes-per-file
|
|
31
|
+
'max-classes-per-file': ['error', 1],
|
|
32
|
+
// disallow the use of alert, confirm, and prompt
|
|
33
|
+
// https://eslint.org/docs/rules/no-alert
|
|
34
|
+
'no-alert': 'error',
|
|
35
|
+
// disallow use of arguments.caller or arguments.callee
|
|
36
|
+
// https://eslint.org/docs/rules/no-caller
|
|
37
|
+
'no-caller': 'error',
|
|
38
|
+
// disallow lexical declarations in case/default clauses
|
|
39
|
+
// https://eslint.org/docs/rules/no-case-declarations
|
|
40
|
+
'no-case-declarations': 'error',
|
|
41
|
+
// Disallow returning value in constructor
|
|
42
|
+
// https://eslint.org/docs/rules/no-constructor-return
|
|
43
|
+
'no-constructor-return': 'error',
|
|
44
|
+
// disallow else after a return in an if
|
|
45
|
+
// https://eslint.org/docs/rules/no-else-return
|
|
46
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
47
|
+
// disallow empty functions, except for standalone funcs/arrows
|
|
48
|
+
// https://eslint.org/docs/rules/no-empty-function
|
|
49
|
+
'no-empty-function': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
// disallow empty destructuring patterns
|
|
56
|
+
// https://eslint.org/docs/rules/no-empty-pattern
|
|
57
|
+
'no-empty-pattern': 'error',
|
|
58
|
+
// disallow use of eval()
|
|
59
|
+
// https://eslint.org/docs/rules/no-eval
|
|
60
|
+
'no-eval': 'error',
|
|
61
|
+
// disallow adding to native types
|
|
62
|
+
// https://eslint.org/docs/rules/no-extend-native
|
|
63
|
+
'no-extend-native': 'error',
|
|
64
|
+
// disallow unnecessary function binding
|
|
65
|
+
// https://eslint.org/docs/rules/no-extra-bind
|
|
66
|
+
'no-extra-bind': 'error',
|
|
67
|
+
// disallow Unnecessary Labels
|
|
68
|
+
// https://eslint.org/docs/rules/no-extra-label
|
|
69
|
+
'no-extra-label': 'error',
|
|
70
|
+
// disallow fallthrough of case statements
|
|
71
|
+
// https://eslint.org/docs/rules/no-fallthrough
|
|
72
|
+
'no-fallthrough': 'error',
|
|
73
|
+
// disallow reassignments of native objects or read-only globals
|
|
74
|
+
// https://eslint.org/docs/rules/no-global-assign
|
|
75
|
+
'no-global-assign': ['error', { exceptions: [] }],
|
|
76
|
+
// disallow usage of __iterator__ property
|
|
77
|
+
// https://eslint.org/docs/rules/no-iterator
|
|
78
|
+
'no-iterator': 'error',
|
|
79
|
+
// disallow use of labels for anything other than loops and switches
|
|
80
|
+
// https://eslint.org/docs/rules/no-labels
|
|
81
|
+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
82
|
+
// disallow unnecessary nested blocks
|
|
83
|
+
// https://eslint.org/docs/rules/no-lone-blocks
|
|
84
|
+
'no-lone-blocks': 'error',
|
|
85
|
+
// disallow creation of functions within loops
|
|
86
|
+
// https://eslint.org/docs/rules/no-loop-func
|
|
87
|
+
'no-loop-func': 'error',
|
|
88
|
+
// disallow use of multiline strings
|
|
89
|
+
// https://eslint.org/docs/rules/no-multi-str
|
|
90
|
+
'no-multi-str': 'error',
|
|
91
|
+
// disallow use of new operator when not part of the assignment or comparison
|
|
92
|
+
// https://eslint.org/docs/rules/no-new
|
|
93
|
+
'no-new': 'error',
|
|
94
|
+
// disallows creating new instances of String, Number, and Boolean
|
|
95
|
+
// https://eslint.org/docs/rules/no-new-wrappers
|
|
96
|
+
'no-new-wrappers': 'error',
|
|
97
|
+
// Disallow \8 and \9 escape sequences in string literals
|
|
98
|
+
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
99
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
100
|
+
// Disallow calls to the Object constructor without an argument
|
|
101
|
+
// https://eslint.org/docs/latest/rules/no-object-constructor
|
|
102
|
+
'no-object-constructor': 'error',
|
|
103
|
+
// disallow use of (old style) octal literals
|
|
104
|
+
// https://eslint.org/docs/rules/no-octal
|
|
105
|
+
'no-octal': 'error',
|
|
106
|
+
// disallow use of octal escape sequences in string literals, such as
|
|
107
|
+
// var foo = 'Copyright \251';
|
|
108
|
+
// https://eslint.org/docs/rules/no-octal-escape
|
|
109
|
+
'no-octal-escape': 'error',
|
|
110
|
+
// disallow reassignment of function parameters
|
|
111
|
+
// disallow parameter object manipulation except for specific exclusions
|
|
112
|
+
// rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
113
|
+
'no-param-reassign': [
|
|
114
|
+
'error',
|
|
115
|
+
{
|
|
116
|
+
props: true,
|
|
117
|
+
ignorePropertyModificationsFor: [
|
|
118
|
+
'acc', // for reduce accumulators
|
|
119
|
+
'accumulator', // for reduce accumulators
|
|
120
|
+
'staticContext', // for ReactRouter context
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
// disallow usage of __proto__ property
|
|
125
|
+
// https://eslint.org/docs/rules/no-proto
|
|
126
|
+
'no-proto': 'error',
|
|
127
|
+
// disallow certain object properties
|
|
128
|
+
// https://eslint.org/docs/rules/no-restricted-properties
|
|
129
|
+
'no-restricted-properties': [
|
|
130
|
+
'error',
|
|
131
|
+
{
|
|
132
|
+
object: 'arguments',
|
|
133
|
+
property: 'callee',
|
|
134
|
+
message: 'arguments.callee is deprecated',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
object: 'global',
|
|
138
|
+
property: 'isFinite',
|
|
139
|
+
message: 'Please use Number.isFinite instead',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
object: 'self',
|
|
143
|
+
property: 'isFinite',
|
|
144
|
+
message: 'Please use Number.isFinite instead',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
object: 'window',
|
|
148
|
+
property: 'isFinite',
|
|
149
|
+
message: 'Please use Number.isFinite instead',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
object: 'global',
|
|
153
|
+
property: 'isNaN',
|
|
154
|
+
message: 'Please use Number.isNaN instead',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
object: 'self',
|
|
158
|
+
property: 'isNaN',
|
|
159
|
+
message: 'Please use Number.isNaN instead',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
object: 'window',
|
|
163
|
+
property: 'isNaN',
|
|
164
|
+
message: 'Please use Number.isNaN instead',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
property: '__defineGetter__',
|
|
168
|
+
message: 'Please use Object.defineProperty instead.',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
property: '__defineSetter__',
|
|
172
|
+
message: 'Please use Object.defineProperty instead.',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
object: 'Math',
|
|
176
|
+
property: 'pow',
|
|
177
|
+
message: 'Use the exponentiation operator (**) instead.',
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
// disallow use of assignment in return statement
|
|
181
|
+
// https://eslint.org/docs/rules/no-return-assign
|
|
182
|
+
'no-return-assign': ['error', 'always'],
|
|
183
|
+
// disallow use of `javascript:` urls.
|
|
184
|
+
// https://eslint.org/docs/rules/no-script-url
|
|
185
|
+
'no-script-url': 'error',
|
|
186
|
+
// disallow self assignment
|
|
187
|
+
// https://eslint.org/docs/rules/no-self-assign
|
|
188
|
+
'no-self-assign': [
|
|
189
|
+
'error',
|
|
190
|
+
{
|
|
191
|
+
props: true,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
// disallow comparisons where both sides are exactly the same
|
|
195
|
+
// https://eslint.org/docs/rules/no-self-compare
|
|
196
|
+
'no-self-compare': 'error',
|
|
197
|
+
// disallow use of comma operator
|
|
198
|
+
// https://eslint.org/docs/rules/no-sequences
|
|
199
|
+
'no-sequences': 'error',
|
|
200
|
+
// restrict what can be thrown as an exception
|
|
201
|
+
// https://eslint.org/docs/rules/no-throw-literal
|
|
202
|
+
'no-throw-literal': 'error',
|
|
203
|
+
// disallow unused labels
|
|
204
|
+
// https://eslint.org/docs/rules/no-unused-labels
|
|
205
|
+
'no-unused-labels': 'error',
|
|
206
|
+
// Disallow unnecessary catch clauses
|
|
207
|
+
// https://eslint.org/docs/rules/no-useless-catch
|
|
208
|
+
'no-useless-catch': 'error',
|
|
209
|
+
// disallow useless string concatenation
|
|
210
|
+
// https://eslint.org/docs/rules/no-useless-concat
|
|
211
|
+
'no-useless-concat': 'error',
|
|
212
|
+
// disallow unnecessary string escaping
|
|
213
|
+
// https://eslint.org/docs/rules/no-useless-escape
|
|
214
|
+
'no-useless-escape': 'error',
|
|
215
|
+
// disallow redundant return; keywords
|
|
216
|
+
// https://eslint.org/docs/rules/no-useless-return
|
|
217
|
+
'no-useless-return': 'error',
|
|
218
|
+
// disallow use of void operator
|
|
219
|
+
// https://eslint.org/docs/rules/no-void
|
|
220
|
+
'no-void': 'error',
|
|
221
|
+
// require using Error objects as Promise rejection reasons
|
|
222
|
+
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
223
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
224
|
+
// Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
|
|
225
|
+
// https://eslint.org/docs/rules/prefer-object-has-own
|
|
226
|
+
// TODO: enable after browserslist Chrome 93+ and Safari 15.4+ and Firefox 92+
|
|
227
|
+
'prefer-object-has-own': 'off',
|
|
228
|
+
// https://eslint.org/docs/rules/prefer-regex-literals
|
|
229
|
+
'prefer-regex-literals': [
|
|
230
|
+
'error',
|
|
231
|
+
{
|
|
232
|
+
disallowRedundantWrapping: true,
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
// require use of the second argument for parseInt()
|
|
236
|
+
// https://eslint.org/docs/rules/radix
|
|
237
|
+
radix: 'error',
|
|
238
|
+
// require `await` in `async function` (note: this is a horrible rule that should never be used)
|
|
239
|
+
// https://eslint.org/docs/rules/require-await
|
|
240
|
+
'require-await': 'off',
|
|
241
|
+
// requires to declare all vars on top of their containing scope
|
|
242
|
+
// https://eslint.org/docs/rules/vars-on-top
|
|
243
|
+
'vars-on-top': 'error',
|
|
244
|
+
// require or disallow Yoda conditions
|
|
245
|
+
// https://eslint.org/docs/rules/yoda
|
|
246
|
+
yoda: 'error',
|
|
247
|
+
};
|
|
248
|
+
export default rules;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
'for-direction': "error";
|
|
3
|
+
'no-async-promise-executor': "error";
|
|
4
|
+
'no-await-in-loop': "error";
|
|
5
|
+
'no-compare-neg-zero': "error";
|
|
6
|
+
'no-cond-assign': ["error", string];
|
|
7
|
+
'no-control-regex': "error";
|
|
8
|
+
'no-debugger': "error";
|
|
9
|
+
'no-dupe-else-if': "error";
|
|
10
|
+
'no-duplicate-case': "error";
|
|
11
|
+
'no-empty': "error";
|
|
12
|
+
'no-empty-character-class': "error";
|
|
13
|
+
'no-ex-assign': "error";
|
|
14
|
+
'no-extra-boolean-cast': "error";
|
|
15
|
+
'no-inner-declarations': "error";
|
|
16
|
+
'no-invalid-regexp': "error";
|
|
17
|
+
'no-irregular-whitespace': "error";
|
|
18
|
+
'no-loss-of-precision': "error";
|
|
19
|
+
'no-misleading-character-class': "error";
|
|
20
|
+
'no-promise-executor-return': "error";
|
|
21
|
+
'no-prototype-builtins': "error";
|
|
22
|
+
'no-regex-spaces': "error";
|
|
23
|
+
'no-sparse-arrays': "error";
|
|
24
|
+
'no-template-curly-in-string': "error";
|
|
25
|
+
'no-unexpected-multiline': "error";
|
|
26
|
+
'no-unreachable-loop': ["error", {
|
|
27
|
+
ignore: never[];
|
|
28
|
+
}];
|
|
29
|
+
'no-unsafe-finally': "error";
|
|
30
|
+
'no-unsafe-optional-chaining': ["error", {
|
|
31
|
+
disallowArithmeticOperators: boolean;
|
|
32
|
+
}];
|
|
33
|
+
'no-useless-backreference': "error";
|
|
34
|
+
'use-isnan': "error";
|
|
35
|
+
'valid-jsdoc': "off";
|
|
36
|
+
'valid-typeof': ["error", {
|
|
37
|
+
requireStringLiterals: boolean;
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
export default rules;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/errors.js
|
|
5
|
+
const rules = {
|
|
6
|
+
// Enforce “for” loop update clause moving the counter in the right direction
|
|
7
|
+
// https://eslint.org/docs/rules/for-direction
|
|
8
|
+
'for-direction': 'error',
|
|
9
|
+
// disallow using an async function as a Promise executor
|
|
10
|
+
// https://eslint.org/docs/rules/no-async-promise-executor
|
|
11
|
+
'no-async-promise-executor': 'error',
|
|
12
|
+
// Disallow await inside of loops
|
|
13
|
+
// https://eslint.org/docs/rules/no-await-in-loop
|
|
14
|
+
'no-await-in-loop': 'error',
|
|
15
|
+
// Disallow comparisons to negative zero
|
|
16
|
+
// https://eslint.org/docs/rules/no-compare-neg-zero
|
|
17
|
+
'no-compare-neg-zero': 'error',
|
|
18
|
+
// disallow assignment in conditional expressions
|
|
19
|
+
'no-cond-assign': ['error', 'always'],
|
|
20
|
+
// disallow control characters in regular expressions
|
|
21
|
+
'no-control-regex': 'error',
|
|
22
|
+
// disallow use of debugger
|
|
23
|
+
'no-debugger': 'error',
|
|
24
|
+
// Disallow duplicate conditions in if-else-if chains
|
|
25
|
+
// https://eslint.org/docs/rules/no-dupe-else-if
|
|
26
|
+
'no-dupe-else-if': 'error',
|
|
27
|
+
// disallow a duplicate case label.
|
|
28
|
+
'no-duplicate-case': 'error',
|
|
29
|
+
// disallow empty statements
|
|
30
|
+
'no-empty': 'error',
|
|
31
|
+
// disallow the use of empty character classes in regular expressions
|
|
32
|
+
'no-empty-character-class': 'error',
|
|
33
|
+
// disallow assigning to the exception in a catch block
|
|
34
|
+
'no-ex-assign': 'error',
|
|
35
|
+
// disallow double-negation boolean casts in a boolean context
|
|
36
|
+
// https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
37
|
+
'no-extra-boolean-cast': 'error',
|
|
38
|
+
// disallow function or variable declarations in nested blocks
|
|
39
|
+
'no-inner-declarations': 'error',
|
|
40
|
+
// disallow invalid regular expression strings in the RegExp constructor
|
|
41
|
+
'no-invalid-regexp': 'error',
|
|
42
|
+
// disallow irregular whitespace outside of strings and comments
|
|
43
|
+
'no-irregular-whitespace': 'error',
|
|
44
|
+
// Disallow Number Literals That Lose Precision
|
|
45
|
+
// https://eslint.org/docs/rules/no-loss-of-precision
|
|
46
|
+
'no-loss-of-precision': 'error',
|
|
47
|
+
// Disallow characters which are made with multiple code points in character class syntax
|
|
48
|
+
// https://eslint.org/docs/rules/no-misleading-character-class
|
|
49
|
+
'no-misleading-character-class': 'error',
|
|
50
|
+
// Disallow returning values from Promise executor functions
|
|
51
|
+
// https://eslint.org/docs/rules/no-promise-executor-return
|
|
52
|
+
'no-promise-executor-return': 'error',
|
|
53
|
+
// disallow use of Object.prototypes builtins directly
|
|
54
|
+
// https://eslint.org/docs/rules/no-prototype-builtins
|
|
55
|
+
'no-prototype-builtins': 'error',
|
|
56
|
+
// disallow multiple spaces in a regular expression literal
|
|
57
|
+
'no-regex-spaces': 'error',
|
|
58
|
+
// disallow sparse arrays
|
|
59
|
+
'no-sparse-arrays': 'error',
|
|
60
|
+
// Disallow template literal placeholder syntax in regular strings
|
|
61
|
+
// https://eslint.org/docs/rules/no-template-curly-in-string
|
|
62
|
+
'no-template-curly-in-string': 'error',
|
|
63
|
+
// Avoid code that looks like two expressions but is actually one
|
|
64
|
+
// https://eslint.org/docs/rules/no-unexpected-multiline
|
|
65
|
+
'no-unexpected-multiline': 'error',
|
|
66
|
+
// Disallow loops with a body that allows only one iteration
|
|
67
|
+
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
68
|
+
'no-unreachable-loop': [
|
|
69
|
+
'error',
|
|
70
|
+
{
|
|
71
|
+
ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
// disallow return/throw/break/continue inside finally blocks
|
|
75
|
+
// https://eslint.org/docs/rules/no-unsafe-finally
|
|
76
|
+
'no-unsafe-finally': 'error',
|
|
77
|
+
// disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
78
|
+
// https://eslint.org/docs/rules/no-unsafe-optional-chaining
|
|
79
|
+
'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
|
|
80
|
+
// Disallow useless backreferences in regular expressions
|
|
81
|
+
// https://eslint.org/docs/rules/no-useless-backreference
|
|
82
|
+
'no-useless-backreference': 'error',
|
|
83
|
+
// disallow comparisons with the value NaN
|
|
84
|
+
'use-isnan': 'error',
|
|
85
|
+
// ensure JSDoc comments are valid
|
|
86
|
+
// https://eslint.org/docs/rules/valid-jsdoc
|
|
87
|
+
'valid-jsdoc': 'off',
|
|
88
|
+
// ensure that the results of typeof are compared against a valid string
|
|
89
|
+
// https://eslint.org/docs/rules/valid-typeof
|
|
90
|
+
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
91
|
+
};
|
|
92
|
+
export default rules;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
'arrow-body-style': ["error", string, {
|
|
3
|
+
requireReturnForObjectLiteral: boolean;
|
|
4
|
+
}];
|
|
5
|
+
'no-class-assign': "error";
|
|
6
|
+
'no-restricted-exports': ["error", {
|
|
7
|
+
restrictedNamedExports: string[];
|
|
8
|
+
}];
|
|
9
|
+
'no-restricted-imports': ["off", {
|
|
10
|
+
paths: never[];
|
|
11
|
+
patterns: never[];
|
|
12
|
+
}];
|
|
13
|
+
'no-useless-computed-key': "error";
|
|
14
|
+
'no-useless-rename': ["error", {
|
|
15
|
+
ignoreDestructuring: boolean;
|
|
16
|
+
ignoreImport: boolean;
|
|
17
|
+
ignoreExport: boolean;
|
|
18
|
+
}];
|
|
19
|
+
'no-var': "error";
|
|
20
|
+
'object-shorthand': ["error", string, {
|
|
21
|
+
ignoreConstructors: boolean;
|
|
22
|
+
avoidQuotes: boolean;
|
|
23
|
+
}];
|
|
24
|
+
'prefer-const': ["error", {
|
|
25
|
+
destructuring: string;
|
|
26
|
+
ignoreReadBeforeAssign: boolean;
|
|
27
|
+
}];
|
|
28
|
+
'prefer-destructuring': ["error", {
|
|
29
|
+
VariableDeclarator: {
|
|
30
|
+
array: boolean;
|
|
31
|
+
object: boolean;
|
|
32
|
+
};
|
|
33
|
+
AssignmentExpression: {
|
|
34
|
+
array: boolean;
|
|
35
|
+
object: boolean;
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
enforceForRenamedProperties: boolean;
|
|
39
|
+
}];
|
|
40
|
+
'prefer-numeric-literals': "error";
|
|
41
|
+
'prefer-rest-params': "error";
|
|
42
|
+
'prefer-spread': "error";
|
|
43
|
+
'prefer-template': "error";
|
|
44
|
+
'require-yield': "error";
|
|
45
|
+
'symbol-description': "error";
|
|
46
|
+
};
|
|
47
|
+
export default rules;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/es6.js
|
|
5
|
+
const rules = {
|
|
6
|
+
// enforces no braces where they can be omitted
|
|
7
|
+
// https://eslint.org/docs/rules/arrow-body-style
|
|
8
|
+
'arrow-body-style': [
|
|
9
|
+
'error',
|
|
10
|
+
'as-needed',
|
|
11
|
+
{
|
|
12
|
+
requireReturnForObjectLiteral: false,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
// disallow modifying variables of class declarations
|
|
16
|
+
// https://eslint.org/docs/rules/no-class-assign
|
|
17
|
+
'no-class-assign': 'error',
|
|
18
|
+
// Disallow specified names in exports
|
|
19
|
+
// https://eslint.org/docs/rules/no-restricted-exports
|
|
20
|
+
'no-restricted-exports': [
|
|
21
|
+
'error',
|
|
22
|
+
{
|
|
23
|
+
restrictedNamedExports: [
|
|
24
|
+
'default', // use `export default` to provide a default export
|
|
25
|
+
'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
// disallow specific imports
|
|
30
|
+
// https://eslint.org/docs/rules/no-restricted-imports
|
|
31
|
+
'no-restricted-imports': [
|
|
32
|
+
'off',
|
|
33
|
+
{
|
|
34
|
+
paths: [],
|
|
35
|
+
patterns: [],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
// disallow useless computed property keys
|
|
39
|
+
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
40
|
+
'no-useless-computed-key': 'error',
|
|
41
|
+
// disallow renaming import, export, and destructured assignments to the same name
|
|
42
|
+
// https://eslint.org/docs/rules/no-useless-rename
|
|
43
|
+
'no-useless-rename': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
ignoreDestructuring: false,
|
|
47
|
+
ignoreImport: false,
|
|
48
|
+
ignoreExport: false,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
// require let or const instead of var
|
|
52
|
+
'no-var': 'error',
|
|
53
|
+
// require method and property shorthand syntax for object literals
|
|
54
|
+
// https://eslint.org/docs/rules/object-shorthand
|
|
55
|
+
'object-shorthand': [
|
|
56
|
+
'error',
|
|
57
|
+
'always',
|
|
58
|
+
{
|
|
59
|
+
ignoreConstructors: false,
|
|
60
|
+
avoidQuotes: true,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
// suggest using of const declaration for variables that are never modified after declared
|
|
64
|
+
'prefer-const': [
|
|
65
|
+
'error',
|
|
66
|
+
{
|
|
67
|
+
destructuring: 'any',
|
|
68
|
+
ignoreReadBeforeAssign: true,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
// Prefer destructuring from arrays and objects
|
|
72
|
+
// https://eslint.org/docs/rules/prefer-destructuring
|
|
73
|
+
'prefer-destructuring': [
|
|
74
|
+
'error',
|
|
75
|
+
{
|
|
76
|
+
VariableDeclarator: {
|
|
77
|
+
array: false,
|
|
78
|
+
object: true,
|
|
79
|
+
},
|
|
80
|
+
AssignmentExpression: {
|
|
81
|
+
array: true,
|
|
82
|
+
object: false,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
enforceForRenamedProperties: false,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
|
|
90
|
+
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
91
|
+
'prefer-numeric-literals': 'error',
|
|
92
|
+
// use rest parameters instead of arguments
|
|
93
|
+
// https://eslint.org/docs/rules/prefer-rest-params
|
|
94
|
+
'prefer-rest-params': 'error',
|
|
95
|
+
// suggest using the spread syntax instead of .apply()
|
|
96
|
+
// https://eslint.org/docs/rules/prefer-spread
|
|
97
|
+
'prefer-spread': 'error',
|
|
98
|
+
// suggest using template literals instead of string concatenation
|
|
99
|
+
// https://eslint.org/docs/rules/prefer-template
|
|
100
|
+
'prefer-template': 'error',
|
|
101
|
+
// disallow generator functions that do not have yield
|
|
102
|
+
// https://eslint.org/docs/rules/require-yield
|
|
103
|
+
'require-yield': 'error',
|
|
104
|
+
// require a Symbol description
|
|
105
|
+
// https://eslint.org/docs/rules/symbol-description
|
|
106
|
+
'symbol-description': 'error',
|
|
107
|
+
};
|
|
108
|
+
export default rules;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
'import-x/no-unresolved': ["error", {
|
|
3
|
+
commonjs: boolean;
|
|
4
|
+
caseSensitive: boolean;
|
|
5
|
+
}];
|
|
6
|
+
'import-x/default': "off";
|
|
7
|
+
'import-x/namespace': "off";
|
|
8
|
+
'import-x/no-named-as-default': "error";
|
|
9
|
+
'import-x/no-extraneous-dependencies': ["error", {
|
|
10
|
+
devDependencies: string[];
|
|
11
|
+
optionalDependencies: boolean;
|
|
12
|
+
}];
|
|
13
|
+
'import-x/no-mutable-exports': "error";
|
|
14
|
+
'import-x/no-amd': "error";
|
|
15
|
+
'import-x/no-nodejs-modules': "error";
|
|
16
|
+
'import-x/first': "error";
|
|
17
|
+
'import-x/no-duplicates': "error";
|
|
18
|
+
'import-x/extensions': ["error", string, {
|
|
19
|
+
js: string;
|
|
20
|
+
mjs: string;
|
|
21
|
+
jsx: string;
|
|
22
|
+
}];
|
|
23
|
+
'import-x/newline-after-import': "error";
|
|
24
|
+
'import-x/no-absolute-path': "error";
|
|
25
|
+
'import-x/no-dynamic-require': "error";
|
|
26
|
+
'import-x/no-webpack-loader-syntax': "error";
|
|
27
|
+
'import-x/no-named-default': "error";
|
|
28
|
+
'import-x/no-self-import': "error";
|
|
29
|
+
'import-x/no-cycle': ["error", {
|
|
30
|
+
maxDepth: string;
|
|
31
|
+
}];
|
|
32
|
+
'import-x/no-useless-path-segments': ["error", {
|
|
33
|
+
commonjs: boolean;
|
|
34
|
+
}];
|
|
35
|
+
'import-x/no-import-module-exports': ["error", {
|
|
36
|
+
exceptions: never[];
|
|
37
|
+
}];
|
|
38
|
+
'import-x/no-relative-packages': "error";
|
|
39
|
+
'import-x/no-empty-named-blocks': "error";
|
|
40
|
+
};
|
|
41
|
+
export default rules;
|