eslint-config-airbnb-extended 0.3.1 → 0.5.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/README.md +10 -0
- package/dist/@types/index.d.ts +22 -0
- package/dist/configs/base/index.js +26 -0
- package/dist/{base → configs/base}/recommended.js +4 -4
- package/dist/configs/index.js +34 -0
- package/dist/{react → configs/react}/index.js +5 -4
- package/dist/{react → configs/react}/recommended.js +5 -6
- package/dist/configs/typescript/index.js +14 -0
- package/dist/{typescript → configs/typescript}/recommended.js +7 -6
- package/dist/helpers/getDevDepsList.js +1 -2
- package/dist/index.js +11 -37
- package/dist/plugins/index.js +21 -0
- package/dist/plugins/nextPlugin.js +12 -0
- package/dist/plugins/reactA11yPlugin.js +12 -0
- package/dist/plugins/reactHooksPlugin.js +44 -0
- package/dist/plugins/reactPlugin.js +13 -0
- package/dist/plugins/typescriptEslintPlugin.js +13 -0
- package/dist/rules/best-practices.js +65 -42
- package/dist/rules/errors.js +24 -32
- package/dist/rules/es6.js +2 -33
- package/dist/rules/imports.js +9 -14
- package/dist/rules/importsStrict.js +3 -16
- package/dist/rules/index.js +22 -0
- package/dist/rules/next.js +2 -4
- package/dist/rules/node.js +2 -1
- package/dist/rules/react-a11y.js +81 -80
- package/dist/rules/react-hooks.js +6 -42
- package/dist/rules/react.js +374 -340
- package/dist/rules/reactStrict.js +86 -0
- package/dist/rules/strict.js +2 -1
- package/dist/rules/style.js +38 -365
- package/dist/rules/stylistic.js +526 -0
- package/dist/rules/typescript/typescriptBase.js +3 -2
- package/dist/rules/typescript/typescriptEslint.js +22 -34
- package/dist/rules/typescript/typescriptImports.js +8 -4
- package/dist/rules/variables.js +2 -3
- package/package.json +3 -3
- package/dist/base/index.d.ts +0 -990
- package/dist/base/index.js +0 -23
- package/dist/base/recommended.d.ts +0 -990
- package/dist/helpers/getDevDepsList.d.ts +0 -3
- package/dist/index.d.ts +0 -17982
- package/dist/react/index.d.ts +0 -1793
- package/dist/react/recommended.d.ts +0 -2786
- package/dist/rules/best-practices.d.ts +0 -177
- package/dist/rules/errors.d.ts +0 -69
- package/dist/rules/es6.d.ts +0 -146
- package/dist/rules/imports.d.ts +0 -151
- package/dist/rules/importsStrict.d.ts +0 -43
- package/dist/rules/next.d.ts +0 -8
- package/dist/rules/node.d.ts +0 -90
- package/dist/rules/react-a11y.d.ts +0 -117
- package/dist/rules/react-hooks.d.ts +0 -19
- package/dist/rules/react.d.ts +0 -1659
- package/dist/rules/strict.d.ts +0 -7
- package/dist/rules/style.d.ts +0 -320
- package/dist/rules/typescript/typescriptBase.d.ts +0 -23
- package/dist/rules/typescript/typescriptEslint.d.ts +0 -3
- package/dist/rules/typescript/typescriptImports.d.ts +0 -37
- package/dist/rules/typescript.d.ts +0 -47
- package/dist/rules/typescript.js +0 -9
- package/dist/rules/variables.d.ts +0 -35
- package/dist/typescript/index.d.ts +0 -58
- package/dist/typescript/index.js +0 -11
- package/dist/typescript/recommended.d.ts +0 -112
- package/dist/utils/index.d.ts +0 -13
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const reactStrictRules = {
|
|
4
|
+
name: 'airbnb/config/react/strict',
|
|
5
|
+
rules: {
|
|
6
|
+
// Enforces consistent naming for boolean props
|
|
7
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
8
|
+
'react/boolean-prop-naming': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
validateNested: true,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
// This rule enforces onChange or readonly attribute for checked property of input elements.
|
|
15
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
|
|
16
|
+
'react/checked-requires-onchange-or-readonly': 'error',
|
|
17
|
+
// Enforce a specific function type for function components
|
|
18
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
|
|
19
|
+
'react/function-component-definition': [
|
|
20
|
+
'error',
|
|
21
|
+
{
|
|
22
|
+
namedComponents: 'arrow-function',
|
|
23
|
+
unnamedComponents: 'arrow-function',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
// Ensure destructuring and symmetric naming of useState hook value and setter variables
|
|
27
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
28
|
+
'react/hook-use-state': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
allowDestructuredState: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
// Ensures inline tags are not rendered without spaces between them
|
|
35
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
|
|
36
|
+
'react/jsx-child-element-spacing': 'warn',
|
|
37
|
+
// Enforce shorthand or standard form for React fragments
|
|
38
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
39
|
+
'react/jsx-fragments': ['error', 'element'],
|
|
40
|
+
// Validate JSX has key prop when in array or iterator
|
|
41
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
42
|
+
// Turned off because it has too many false positives
|
|
43
|
+
'react/jsx-key': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
checkFragmentShorthand: true,
|
|
47
|
+
checkKeyMustBeforeSpread: false,
|
|
48
|
+
warnOnDuplicates: true,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
// Prevent problematic leaked values from being rendered
|
|
52
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
53
|
+
'react/jsx-no-leaked-render': 'error',
|
|
54
|
+
// Enforce propTypes declarations alphabetical sorting
|
|
55
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
56
|
+
'react/jsx-sort-props': [
|
|
57
|
+
'error',
|
|
58
|
+
{
|
|
59
|
+
callbacksLast: false,
|
|
60
|
+
shorthandFirst: true,
|
|
61
|
+
shorthandLast: false,
|
|
62
|
+
multiline: 'last',
|
|
63
|
+
ignoreCase: true,
|
|
64
|
+
noSortAlphabetically: false,
|
|
65
|
+
reservedFirst: ['key', 'ref'],
|
|
66
|
+
locale: 'auto',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
// Prevent usage of UNSAFE_ methods
|
|
70
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
71
|
+
'react/no-unsafe': 'error',
|
|
72
|
+
// Require stateless functions when not using lifecycle methods, setState or ref
|
|
73
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
74
|
+
'react/prefer-stateless-function': [
|
|
75
|
+
'error',
|
|
76
|
+
{
|
|
77
|
+
ignorePureComponents: false,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
// Prevent missing props validation in a React component definition
|
|
81
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
82
|
+
// Disabling it because prop-types are deprecated
|
|
83
|
+
'react/prop-types': 'off',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
exports.default = reactStrictRules;
|
package/dist/rules/strict.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const strictRules = {
|
|
4
4
|
name: 'airbnb/config/strict',
|
|
5
5
|
rules: {
|
|
6
6
|
// babel inserts `'use strict';` for us
|
|
7
7
|
strict: ['error', 'never'],
|
|
8
8
|
},
|
|
9
9
|
};
|
|
10
|
+
exports.default = strictRules;
|
package/dist/rules/style.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const styleRules = {
|
|
4
4
|
name: 'airbnb/config/style',
|
|
5
5
|
rules: {
|
|
6
|
-
// enforce line breaks after opening and before closing array brackets
|
|
7
|
-
// https://eslint.org/docs/rules/array-bracket-newline
|
|
8
|
-
// TODO: enable? semver-major
|
|
9
|
-
'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
|
|
10
|
-
// enforce line breaks between array elements
|
|
11
|
-
// https://eslint.org/docs/rules/array-element-newline
|
|
12
|
-
// TODO: enable? semver-major
|
|
13
|
-
'array-element-newline': ['off', { multiline: true, minItems: 3 }],
|
|
14
|
-
// enforce spacing inside array brackets
|
|
15
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
16
|
-
// enforce spacing inside single-line blocks
|
|
17
|
-
// https://eslint.org/docs/rules/block-spacing
|
|
18
|
-
'block-spacing': ['error', 'always'],
|
|
19
|
-
// enforce one true brace style
|
|
20
|
-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
21
6
|
// require camel case names
|
|
22
|
-
camelcase: [
|
|
7
|
+
camelcase: [
|
|
8
|
+
'error',
|
|
9
|
+
{
|
|
10
|
+
properties: 'never',
|
|
11
|
+
ignoreDestructuring: false,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
23
14
|
// enforce or disallow capitalization of the first letter of a comment
|
|
24
|
-
// https://eslint.org/docs/rules/capitalized-comments
|
|
15
|
+
// https://eslint.org/docs/latest/rules/capitalized-comments
|
|
25
16
|
'capitalized-comments': [
|
|
26
17
|
'off',
|
|
27
18
|
'never',
|
|
@@ -38,53 +29,11 @@ exports.default = {
|
|
|
38
29
|
},
|
|
39
30
|
},
|
|
40
31
|
],
|
|
41
|
-
// require trailing commas in multiline object literals
|
|
42
|
-
'comma-dangle': [
|
|
43
|
-
'error',
|
|
44
|
-
{
|
|
45
|
-
arrays: 'always-multiline',
|
|
46
|
-
objects: 'always-multiline',
|
|
47
|
-
imports: 'always-multiline',
|
|
48
|
-
exports: 'always-multiline',
|
|
49
|
-
functions: 'always-multiline',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
// enforce spacing before and after comma
|
|
53
|
-
'comma-spacing': ['error', { before: false, after: true }],
|
|
54
|
-
// enforce one true comma style
|
|
55
|
-
'comma-style': [
|
|
56
|
-
'error',
|
|
57
|
-
'last',
|
|
58
|
-
{
|
|
59
|
-
exceptions: {
|
|
60
|
-
ArrayExpression: false,
|
|
61
|
-
ArrayPattern: false,
|
|
62
|
-
ArrowFunctionExpression: false,
|
|
63
|
-
CallExpression: false,
|
|
64
|
-
FunctionDeclaration: false,
|
|
65
|
-
FunctionExpression: false,
|
|
66
|
-
ImportDeclaration: false,
|
|
67
|
-
ObjectExpression: false,
|
|
68
|
-
ObjectPattern: false,
|
|
69
|
-
VariableDeclaration: false,
|
|
70
|
-
NewExpression: false,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
// disallow padding inside computed properties
|
|
75
|
-
'computed-property-spacing': ['error', 'never'],
|
|
76
32
|
// enforces consistent naming when capturing the current execution context
|
|
77
33
|
'consistent-this': 'off',
|
|
78
|
-
// enforce newline at the end of file, with no multiple empty lines
|
|
79
|
-
'eol-last': ['error', 'always'],
|
|
80
|
-
// https://eslint.org/docs/rules/function-call-argument-newline
|
|
81
|
-
'function-call-argument-newline': ['error', 'consistent'],
|
|
82
|
-
// enforce spacing between functions and their invocations
|
|
83
|
-
// https://eslint.org/docs/rules/func-call-spacing
|
|
84
|
-
'func-call-spacing': ['error', 'never'],
|
|
85
34
|
// requires function names to match the name of the variable or property to which they are
|
|
86
35
|
// assigned
|
|
87
|
-
// https://eslint.org/docs/rules/func-name-matching
|
|
36
|
+
// https://eslint.org/docs/latest/rules/func-name-matching
|
|
88
37
|
'func-name-matching': [
|
|
89
38
|
'off',
|
|
90
39
|
'always',
|
|
@@ -94,119 +43,20 @@ exports.default = {
|
|
|
94
43
|
},
|
|
95
44
|
],
|
|
96
45
|
// require function expressions to have a name
|
|
97
|
-
// https://eslint.org/docs/rules/func-names
|
|
46
|
+
// https://eslint.org/docs/latest/rules/func-names
|
|
98
47
|
'func-names': 'warn',
|
|
99
48
|
// enforces use of function declarations or expressions
|
|
100
|
-
// https://eslint.org/docs/rules/func-style
|
|
49
|
+
// https://eslint.org/docs/latest/rules/func-style
|
|
101
50
|
// TODO: enable
|
|
102
51
|
'func-style': ['off', 'expression'],
|
|
103
|
-
// require line breaks inside function parentheses if there are line breaks between parameters
|
|
104
|
-
// https://eslint.org/docs/rules/function-paren-newline
|
|
105
|
-
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
106
52
|
// disallow specified identifiers
|
|
107
|
-
// https://eslint.org/docs/rules/id-denylist
|
|
53
|
+
// https://eslint.org/docs/latest/rules/id-denylist
|
|
108
54
|
'id-denylist': 'off',
|
|
109
55
|
// this option enforces minimum and maximum identifier lengths
|
|
110
56
|
// (variable names, property names etc.)
|
|
111
57
|
'id-length': 'off',
|
|
112
58
|
// require identifiers to match the provided regular expression
|
|
113
59
|
'id-match': 'off',
|
|
114
|
-
// Enforce the location of arrow function bodies with implicit returns
|
|
115
|
-
// https://eslint.org/docs/rules/implicit-arrow-linebreak
|
|
116
|
-
'implicit-arrow-linebreak': ['error', 'beside'],
|
|
117
|
-
// this option sets a specific tab width for your code
|
|
118
|
-
// https://eslint.org/docs/rules/indent
|
|
119
|
-
indent: [
|
|
120
|
-
'error',
|
|
121
|
-
2,
|
|
122
|
-
{
|
|
123
|
-
SwitchCase: 1,
|
|
124
|
-
VariableDeclarator: 1,
|
|
125
|
-
outerIIFEBody: 1,
|
|
126
|
-
// MemberExpression: null,
|
|
127
|
-
FunctionDeclaration: {
|
|
128
|
-
parameters: 1,
|
|
129
|
-
body: 1,
|
|
130
|
-
},
|
|
131
|
-
FunctionExpression: {
|
|
132
|
-
parameters: 1,
|
|
133
|
-
body: 1,
|
|
134
|
-
},
|
|
135
|
-
CallExpression: {
|
|
136
|
-
arguments: 1,
|
|
137
|
-
},
|
|
138
|
-
ArrayExpression: 1,
|
|
139
|
-
ObjectExpression: 1,
|
|
140
|
-
ImportDeclaration: 1,
|
|
141
|
-
flatTernaryExpressions: false,
|
|
142
|
-
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
|
|
143
|
-
ignoredNodes: [
|
|
144
|
-
'JSXElement',
|
|
145
|
-
'JSXElement > *',
|
|
146
|
-
'JSXAttribute',
|
|
147
|
-
'JSXIdentifier',
|
|
148
|
-
'JSXNamespacedName',
|
|
149
|
-
'JSXMemberExpression',
|
|
150
|
-
'JSXSpreadAttribute',
|
|
151
|
-
'JSXExpressionContainer',
|
|
152
|
-
'JSXOpeningElement',
|
|
153
|
-
'JSXClosingElement',
|
|
154
|
-
'JSXFragment',
|
|
155
|
-
'JSXOpeningFragment',
|
|
156
|
-
'JSXClosingFragment',
|
|
157
|
-
'JSXText',
|
|
158
|
-
'JSXEmptyExpression',
|
|
159
|
-
'JSXSpreadChild',
|
|
160
|
-
],
|
|
161
|
-
ignoreComments: false,
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
// specify whether double or single quotes should be used in JSX attributes
|
|
165
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
166
|
-
'jsx-quotes': ['off', 'prefer-double'],
|
|
167
|
-
// enforces spacing between keys and values in object literal properties
|
|
168
|
-
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
169
|
-
// require a space before & after certain keywords
|
|
170
|
-
'keyword-spacing': [
|
|
171
|
-
'error',
|
|
172
|
-
{
|
|
173
|
-
before: true,
|
|
174
|
-
after: true,
|
|
175
|
-
overrides: {
|
|
176
|
-
return: { after: true },
|
|
177
|
-
throw: { after: true },
|
|
178
|
-
case: { after: true },
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
// enforce position of line comments
|
|
183
|
-
// https://eslint.org/docs/rules/line-comment-position
|
|
184
|
-
// TODO: enable?
|
|
185
|
-
'line-comment-position': [
|
|
186
|
-
'off',
|
|
187
|
-
{
|
|
188
|
-
position: 'above',
|
|
189
|
-
ignorePattern: '',
|
|
190
|
-
applyDefaultPatterns: true,
|
|
191
|
-
},
|
|
192
|
-
],
|
|
193
|
-
// disallow mixed 'LF' and 'CRLF' as linebreaks
|
|
194
|
-
// https://eslint.org/docs/rules/linebreak-style
|
|
195
|
-
'linebreak-style': ['error', 'unix'],
|
|
196
|
-
// require or disallow an empty line between class members
|
|
197
|
-
// https://eslint.org/docs/rules/lines-between-class-members
|
|
198
|
-
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
|
|
199
|
-
// enforces empty lines around comments
|
|
200
|
-
'lines-around-comment': 'off',
|
|
201
|
-
// require or disallow newlines around directives
|
|
202
|
-
// https://eslint.org/docs/rules/lines-around-directive
|
|
203
|
-
'lines-around-directive': [
|
|
204
|
-
'error',
|
|
205
|
-
{
|
|
206
|
-
before: 'always',
|
|
207
|
-
after: 'always',
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
60
|
// Require or disallow logical assignment logical operator shorthand
|
|
211
61
|
// https://eslint.org/docs/latest/rules/logical-assignment-operators
|
|
212
62
|
// TODO, semver-major: enable
|
|
@@ -219,22 +69,8 @@ exports.default = {
|
|
|
219
69
|
],
|
|
220
70
|
// specify the maximum depth that blocks can be nested
|
|
221
71
|
'max-depth': ['off', 4],
|
|
222
|
-
// specify the maximum length of a line in your program
|
|
223
|
-
// https://eslint.org/docs/rules/max-len
|
|
224
|
-
'max-len': [
|
|
225
|
-
'error',
|
|
226
|
-
100,
|
|
227
|
-
2,
|
|
228
|
-
{
|
|
229
|
-
ignoreUrls: true,
|
|
230
|
-
ignoreComments: false,
|
|
231
|
-
ignoreRegExpLiterals: true,
|
|
232
|
-
ignoreStrings: true,
|
|
233
|
-
ignoreTemplateLiterals: true,
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
72
|
// specify the max number of lines in a file
|
|
237
|
-
// https://eslint.org/docs/rules/max-lines
|
|
73
|
+
// https://eslint.org/docs/latest/rules/max-lines
|
|
238
74
|
'max-lines': [
|
|
239
75
|
'off',
|
|
240
76
|
{
|
|
@@ -244,7 +80,7 @@ exports.default = {
|
|
|
244
80
|
},
|
|
245
81
|
],
|
|
246
82
|
// enforce a maximum function length
|
|
247
|
-
// https://eslint.org/docs/rules/max-lines-per-function
|
|
83
|
+
// https://eslint.org/docs/latest/rules/max-lines-per-function
|
|
248
84
|
'max-lines-per-function': [
|
|
249
85
|
'off',
|
|
250
86
|
{
|
|
@@ -260,16 +96,6 @@ exports.default = {
|
|
|
260
96
|
'max-params': ['off', 3],
|
|
261
97
|
// specify the maximum number of statement allowed in a function
|
|
262
98
|
'max-statements': ['off', 10],
|
|
263
|
-
// restrict the number of statements per line
|
|
264
|
-
// https://eslint.org/docs/rules/max-statements-per-line
|
|
265
|
-
'max-statements-per-line': ['off', { max: 1 }],
|
|
266
|
-
// enforce a particular style for multiline comments
|
|
267
|
-
// https://eslint.org/docs/rules/multiline-comment-style
|
|
268
|
-
'multiline-comment-style': ['off', 'starred-block'],
|
|
269
|
-
// require multiline ternary
|
|
270
|
-
// https://eslint.org/docs/rules/multiline-ternary
|
|
271
|
-
// TODO: enable?
|
|
272
|
-
'multiline-ternary': ['off', 'never'],
|
|
273
99
|
// require a capital letter for constructors
|
|
274
100
|
'new-cap': [
|
|
275
101
|
'error',
|
|
@@ -280,71 +106,32 @@ exports.default = {
|
|
|
280
106
|
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
|
|
281
107
|
},
|
|
282
108
|
],
|
|
283
|
-
// disallow the omission of parentheses when invoking a constructor with no arguments
|
|
284
|
-
// https://eslint.org/docs/rules/new-parens
|
|
285
|
-
'new-parens': 'error',
|
|
286
|
-
// allow/disallow an empty newline after var statement
|
|
287
|
-
'newline-after-var': 'off',
|
|
288
|
-
// https://eslint.org/docs/rules/newline-before-return
|
|
289
|
-
'newline-before-return': 'off',
|
|
290
|
-
// enforces new line after each method call in the chain to make it
|
|
291
|
-
// more readable and easy to maintain
|
|
292
|
-
// https://eslint.org/docs/rules/newline-per-chained-call
|
|
293
|
-
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
|
|
294
109
|
// disallow use of the Array constructor
|
|
295
110
|
'no-array-constructor': 'error',
|
|
296
111
|
// disallow use of bitwise operators
|
|
297
|
-
// https://eslint.org/docs/rules/no-bitwise
|
|
112
|
+
// https://eslint.org/docs/latest/rules/no-bitwise
|
|
298
113
|
'no-bitwise': 'error',
|
|
299
114
|
// disallow use of the continue statement
|
|
300
|
-
// https://eslint.org/docs/rules/no-continue
|
|
115
|
+
// https://eslint.org/docs/latest/rules/no-continue
|
|
301
116
|
'no-continue': 'error',
|
|
302
117
|
// disallow comments inline after code
|
|
303
118
|
'no-inline-comments': 'off',
|
|
304
119
|
// disallow if as the only statement in an else block
|
|
305
|
-
// https://eslint.org/docs/rules/no-lonely-if
|
|
120
|
+
// https://eslint.org/docs/latest/rules/no-lonely-if
|
|
306
121
|
'no-lonely-if': 'error',
|
|
307
|
-
// disallow un-paren'd mixes of different operators
|
|
308
|
-
// https://eslint.org/docs/rules/no-mixed-operators
|
|
309
|
-
'no-mixed-operators': [
|
|
310
|
-
'error',
|
|
311
|
-
{
|
|
312
|
-
// the list of arithmetic groups disallows mixing `%` and `**`
|
|
313
|
-
// with other arithmetic operators.
|
|
314
|
-
groups: [
|
|
315
|
-
['%', '**'],
|
|
316
|
-
['%', '+'],
|
|
317
|
-
['%', '-'],
|
|
318
|
-
['%', '*'],
|
|
319
|
-
['%', '/'],
|
|
320
|
-
['/', '*'],
|
|
321
|
-
['&', '|', '<<', '>>', '>>>'],
|
|
322
|
-
['==', '!=', '===', '!=='],
|
|
323
|
-
['&&', '||'],
|
|
324
|
-
],
|
|
325
|
-
allowSamePrecedence: false,
|
|
326
|
-
},
|
|
327
|
-
],
|
|
328
|
-
// disallow mixed spaces and tabs for indentation
|
|
329
|
-
'no-mixed-spaces-and-tabs': 'error',
|
|
330
122
|
// disallow use of chained assignment expressions
|
|
331
|
-
// https://eslint.org/docs/rules/no-multi-assign
|
|
123
|
+
// https://eslint.org/docs/latest/rules/no-multi-assign
|
|
332
124
|
'no-multi-assign': ['error'],
|
|
333
|
-
// disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
|
|
334
|
-
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
335
|
-
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
336
125
|
// disallow negated conditions
|
|
337
|
-
// https://eslint.org/docs/rules/no-negated-condition
|
|
126
|
+
// https://eslint.org/docs/latest/rules/no-negated-condition
|
|
338
127
|
'no-negated-condition': 'off',
|
|
339
128
|
// disallow nested ternary expressions
|
|
340
129
|
'no-nested-ternary': 'error',
|
|
341
|
-
// disallow use of the Object constructor
|
|
342
|
-
'no-new-object': 'error',
|
|
343
130
|
// disallow use of unary operators, ++ and --
|
|
344
|
-
// https://eslint.org/docs/rules/no-plusplus
|
|
131
|
+
// https://eslint.org/docs/latest/rules/no-plusplus
|
|
345
132
|
'no-plusplus': 'error',
|
|
346
133
|
// disallow certain syntax forms
|
|
347
|
-
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
134
|
+
// https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
348
135
|
'no-restricted-syntax': [
|
|
349
136
|
'error',
|
|
350
137
|
{
|
|
@@ -364,23 +151,10 @@ exports.default = {
|
|
|
364
151
|
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
365
152
|
},
|
|
366
153
|
],
|
|
367
|
-
// disallow space between function identifier and application
|
|
368
|
-
// deprecated in favor of func-call-spacing
|
|
369
|
-
'no-spaced-func': 'off',
|
|
370
|
-
// disallow tab characters entirely
|
|
371
|
-
'no-tabs': 'error',
|
|
372
154
|
// disallow the use of ternary operators
|
|
373
155
|
'no-ternary': 'off',
|
|
374
|
-
// disallow trailing whitespace at the end of lines
|
|
375
|
-
'no-trailing-spaces': [
|
|
376
|
-
'error',
|
|
377
|
-
{
|
|
378
|
-
skipBlankLines: false,
|
|
379
|
-
ignoreComments: false,
|
|
380
|
-
},
|
|
381
|
-
],
|
|
382
156
|
// disallow dangling underscores in identifiers
|
|
383
|
-
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
157
|
+
// https://eslint.org/docs/latest/rules/no-underscore-dangle
|
|
384
158
|
'no-underscore-dangle': [
|
|
385
159
|
'error',
|
|
386
160
|
{
|
|
@@ -392,139 +166,38 @@ exports.default = {
|
|
|
392
166
|
],
|
|
393
167
|
// disallow the use of Boolean literals in conditional expressions
|
|
394
168
|
// also, prefer `a || b` over `a ? a : b`
|
|
395
|
-
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
396
|
-
'no-unneeded-ternary': [
|
|
397
|
-
// disallow whitespace before properties
|
|
398
|
-
// https://eslint.org/docs/rules/no-whitespace-before-property
|
|
399
|
-
'no-whitespace-before-property': 'error',
|
|
400
|
-
// enforce the location of single-line statements
|
|
401
|
-
// https://eslint.org/docs/rules/nonblock-statement-body-position
|
|
402
|
-
'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
|
|
403
|
-
// require padding inside curly braces
|
|
404
|
-
'object-curly-spacing': ['error', 'always'],
|
|
405
|
-
// enforce line breaks between braces
|
|
406
|
-
// https://eslint.org/docs/rules/object-curly-newline
|
|
407
|
-
'object-curly-newline': [
|
|
169
|
+
// https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
170
|
+
'no-unneeded-ternary': [
|
|
408
171
|
'error',
|
|
409
172
|
{
|
|
410
|
-
|
|
411
|
-
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
412
|
-
ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
413
|
-
ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
414
|
-
},
|
|
415
|
-
],
|
|
416
|
-
// enforce "same line" or "multiple line" on object properties.
|
|
417
|
-
// https://eslint.org/docs/rules/object-property-newline
|
|
418
|
-
'object-property-newline': [
|
|
419
|
-
'error',
|
|
420
|
-
{
|
|
421
|
-
allowAllPropertiesOnSameLine: true,
|
|
173
|
+
defaultAssignment: false,
|
|
422
174
|
},
|
|
423
175
|
],
|
|
424
176
|
// allow just one var statement per function
|
|
425
177
|
'one-var': ['error', 'never'],
|
|
426
|
-
// require a newline around variable declaration
|
|
427
|
-
// https://eslint.org/docs/rules/one-var-declaration-per-line
|
|
428
|
-
'one-var-declaration-per-line': ['error', 'always'],
|
|
429
178
|
// require assignment operator shorthand where possible or prohibit it entirely
|
|
430
|
-
// https://eslint.org/docs/rules/operator-assignment
|
|
179
|
+
// https://eslint.org/docs/latest/rules/operator-assignment
|
|
431
180
|
'operator-assignment': ['error', 'always'],
|
|
432
|
-
// Requires operator at the beginning of the line in multiline statements
|
|
433
|
-
// https://eslint.org/docs/rules/operator-linebreak
|
|
434
|
-
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
|
|
435
|
-
// disallow padding within blocks
|
|
436
|
-
'padded-blocks': [
|
|
437
|
-
'error',
|
|
438
|
-
{
|
|
439
|
-
blocks: 'never',
|
|
440
|
-
classes: 'never',
|
|
441
|
-
switches: 'never',
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
allowSingleLineBlocks: true,
|
|
445
|
-
},
|
|
446
|
-
],
|
|
447
|
-
// Require or disallow padding lines between statements
|
|
448
|
-
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
449
|
-
'padding-line-between-statements': 'off',
|
|
450
181
|
// Disallow the use of Math.pow in favor of the ** operator
|
|
451
|
-
// https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
182
|
+
// https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
|
|
452
183
|
'prefer-exponentiation-operator': 'error',
|
|
453
184
|
// Prefer use of an object spread over Object.assign
|
|
454
|
-
// https://eslint.org/docs/rules/prefer-object-spread
|
|
185
|
+
// https://eslint.org/docs/latest/rules/prefer-object-spread
|
|
455
186
|
'prefer-object-spread': 'error',
|
|
456
|
-
// require quotes around object literal property names
|
|
457
|
-
// https://eslint.org/docs/rules/quote-props.html
|
|
458
|
-
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
|
|
459
|
-
// specify whether double or single quotes should be used
|
|
460
|
-
quotes: ['error', 'single', { avoidEscape: true }],
|
|
461
|
-
// do not require jsdoc
|
|
462
|
-
// https://eslint.org/docs/rules/require-jsdoc
|
|
463
|
-
'require-jsdoc': 'off',
|
|
464
|
-
// require or disallow use of semicolons instead of ASI
|
|
465
|
-
semi: ['error', 'always'],
|
|
466
|
-
// enforce spacing before and after semicolons
|
|
467
|
-
'semi-spacing': ['error', { before: false, after: true }],
|
|
468
|
-
// Enforce location of semicolons
|
|
469
|
-
// https://eslint.org/docs/rules/semi-style
|
|
470
|
-
'semi-style': ['error', 'last'],
|
|
471
187
|
// requires object keys to be sorted
|
|
472
|
-
'sort-keys': [
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
// require or disallow space before blocks
|
|
476
|
-
'space-before-blocks': 'error',
|
|
477
|
-
// require or disallow space before function opening parenthesis
|
|
478
|
-
// https://eslint.org/docs/rules/space-before-function-paren
|
|
479
|
-
'space-before-function-paren': [
|
|
480
|
-
'error',
|
|
481
|
-
{
|
|
482
|
-
anonymous: 'always',
|
|
483
|
-
named: 'never',
|
|
484
|
-
asyncArrow: 'always',
|
|
485
|
-
},
|
|
486
|
-
],
|
|
487
|
-
// require or disallow spaces inside parentheses
|
|
488
|
-
'space-in-parens': ['error', 'never'],
|
|
489
|
-
// require spaces around operators
|
|
490
|
-
'space-infix-ops': 'error',
|
|
491
|
-
// Require or disallow spaces before/after unary operators
|
|
492
|
-
// https://eslint.org/docs/rules/space-unary-ops
|
|
493
|
-
'space-unary-ops': [
|
|
494
|
-
'error',
|
|
495
|
-
{
|
|
496
|
-
words: true,
|
|
497
|
-
nonwords: false,
|
|
498
|
-
overrides: {},
|
|
499
|
-
},
|
|
500
|
-
],
|
|
501
|
-
// require or disallow a space immediately following the // or /* in a comment
|
|
502
|
-
// https://eslint.org/docs/rules/spaced-comment
|
|
503
|
-
'spaced-comment': [
|
|
504
|
-
'error',
|
|
505
|
-
'always',
|
|
188
|
+
'sort-keys': [
|
|
189
|
+
'off',
|
|
190
|
+
'asc',
|
|
506
191
|
{
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments
|
|
510
|
-
},
|
|
511
|
-
block: {
|
|
512
|
-
exceptions: ['-', '+'],
|
|
513
|
-
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
|
|
514
|
-
balanced: true,
|
|
515
|
-
},
|
|
192
|
+
caseSensitive: false,
|
|
193
|
+
natural: true,
|
|
516
194
|
},
|
|
517
195
|
],
|
|
518
|
-
//
|
|
519
|
-
|
|
520
|
-
'switch-colon-spacing': ['error', { after: true, before: false }],
|
|
521
|
-
// Require or disallow spacing between template tags and their literals
|
|
522
|
-
// https://eslint.org/docs/rules/template-tag-spacing
|
|
523
|
-
'template-tag-spacing': ['error', 'never'],
|
|
196
|
+
// sort variables within the same declaration block
|
|
197
|
+
'sort-vars': 'off',
|
|
524
198
|
// require or disallow the Unicode Byte Order Mark
|
|
525
|
-
// https://eslint.org/docs/rules/unicode-bom
|
|
199
|
+
// https://eslint.org/docs/latest/rules/unicode-bom
|
|
526
200
|
'unicode-bom': ['error', 'never'],
|
|
527
|
-
// require regex literals to be wrapped in parentheses
|
|
528
|
-
'wrap-regex': 'off',
|
|
529
201
|
},
|
|
530
202
|
};
|
|
203
|
+
exports.default = styleRules;
|