@zendeskgarden/eslint-config 34.0.0 → 36.0.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/package.json +13 -13
- package/plugins/typescript-semantics.js +8 -7
- package/plugins/typescript.js +4 -43
- package/rules/best-practices.js +0 -10
- package/rules/es6.js +1 -15
- package/rules/possible-errors.js +0 -4
- package/rules/stylistic-issues.js +3 -153
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "Garden ESLint config",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -19,31 +19,31 @@
|
|
|
19
19
|
"lint": "eslint index.js plugins/*.js rules/*.js --max-warnings 0",
|
|
20
20
|
"prepare": "husky install",
|
|
21
21
|
"tag": "[ `git rev-parse --abbrev-ref HEAD` = 'main' ] && standard-version --no-verify",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "npm run format && npm run lint && git diff --quiet"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@babel/eslint-parser": "^7.15.0",
|
|
26
|
-
"eslint": "^8.
|
|
26
|
+
"eslint": "^8.56.0",
|
|
27
27
|
"eslint-plugin-node": "^11.1.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@babel/core": "7.
|
|
31
|
-
"@babel/eslint-parser": "7.
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
33
|
-
"@typescript-eslint/parser": "6.
|
|
34
|
-
"eslint": "8.
|
|
35
|
-
"eslint-plugin-jest": "27.
|
|
36
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
30
|
+
"@babel/core": "7.23.6",
|
|
31
|
+
"@babel/eslint-parser": "7.23.3",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "6.15.0",
|
|
33
|
+
"@typescript-eslint/parser": "6.15.0",
|
|
34
|
+
"eslint": "8.56.0",
|
|
35
|
+
"eslint-plugin-jest": "27.6.0",
|
|
36
|
+
"eslint-plugin-jsx-a11y": "6.8.0",
|
|
37
37
|
"eslint-plugin-node": "11.1.0",
|
|
38
38
|
"eslint-plugin-notice": "0.9.10",
|
|
39
|
-
"eslint-plugin-react": "7.
|
|
39
|
+
"eslint-plugin-react": "7.33.2",
|
|
40
40
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
41
41
|
"husky": "8.0.3",
|
|
42
|
-
"jest": "29.
|
|
42
|
+
"jest": "29.7.0",
|
|
43
43
|
"prettier-package-json": "2.8.0",
|
|
44
44
|
"react": "18.2.0",
|
|
45
45
|
"standard-version": "9.5.0",
|
|
46
|
-
"typescript": "5.
|
|
46
|
+
"typescript": "5.3.3"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"eslint",
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const bestPractices = require('../rules/best-practices').rules;
|
|
9
|
+
const es6 = require('../rules/es6').rules;
|
|
9
10
|
const possibleErrors = require('../rules/possible-errors').rules;
|
|
10
|
-
const stylisticIssues = require('../rules/stylistic-issues').rules;
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
plugins: ['@typescript-eslint'],
|
|
@@ -15,18 +15,15 @@ module.exports = {
|
|
|
15
15
|
rules: {
|
|
16
16
|
// Disable ESLint rules that are handled by TypeScript
|
|
17
17
|
'dot-notation': 0,
|
|
18
|
-
'key-spacing': 0,
|
|
19
18
|
'no-implied-eval': 0,
|
|
20
|
-
'no-return-await': 0,
|
|
21
19
|
'no-throw-literal': 0,
|
|
20
|
+
'prefer-destructuring': 0,
|
|
22
21
|
'require-await': 0,
|
|
23
22
|
|
|
24
23
|
// disallows awaiting a value that is not a `Thenable`
|
|
25
24
|
'@typescript-eslint/await-thenable': 2,
|
|
26
25
|
// enforce dot notation whenever possible
|
|
27
26
|
'@typescript-eslint/dot-notation': bestPractices['dot-notation'],
|
|
28
|
-
// enforce consistent spacing between keys and values in object literal properties
|
|
29
|
-
'@typescript-eslint/key-spacing': stylisticIssues['key-spacing'],
|
|
30
27
|
// requires that `.toString()` is only called on objects which provide useful information when stringified
|
|
31
28
|
'@typescript-eslint/no-base-to-string': 2,
|
|
32
29
|
// requires expressions of type void to appear in statement position
|
|
@@ -68,8 +65,14 @@ module.exports = {
|
|
|
68
65
|
'@typescript-eslint/no-unsafe-member-access': 2,
|
|
69
66
|
// disallows returning any from a function
|
|
70
67
|
'@typescript-eslint/no-unsafe-return': 2,
|
|
68
|
+
// require unary negation to take a number
|
|
69
|
+
'@typescript-eslint/no-unsafe-unary-minus': 2,
|
|
70
|
+
// disallow unnecessary template literals
|
|
71
|
+
'@typescript-eslint/no-useless-template-literals': 2,
|
|
71
72
|
// prefers a non-null assertion over explicit type cast when possible
|
|
72
73
|
'@typescript-eslint/non-nullable-type-assertion-style': 1,
|
|
74
|
+
// require destructuring from arrays and/or objects
|
|
75
|
+
'@typescript-eslint/prefer-destructuring': es6['prefer-destructuring'],
|
|
73
76
|
// enforce includes method over `indexOf` method
|
|
74
77
|
'@typescript-eslint/prefer-includes': 2,
|
|
75
78
|
// enforce the usage of the nullish coalescing operator instead of logical chaining
|
|
@@ -96,8 +99,6 @@ module.exports = {
|
|
|
96
99
|
'@typescript-eslint/restrict-plus-operands': 2,
|
|
97
100
|
// enforce template literal expressions to be of string type
|
|
98
101
|
'@typescript-eslint/restrict-template-expressions': 2,
|
|
99
|
-
// enforces consistent returning of awaited values
|
|
100
|
-
'@typescript-eslint/return-await': bestPractices['no-return-await'],
|
|
101
102
|
// restricts the types allowed in boolean expressions
|
|
102
103
|
'@typescript-eslint/strict-boolean-expressions': 1,
|
|
103
104
|
// exhaustiveness checking in switch with union type
|
package/plugins/typescript.js
CHANGED
|
@@ -16,25 +16,18 @@ module.exports = {
|
|
|
16
16
|
parser: '@typescript-eslint/parser',
|
|
17
17
|
rules: {
|
|
18
18
|
// Disable ESLint rules that are handled by TypeScript
|
|
19
|
-
'
|
|
20
|
-
'comma-dangle': 0,
|
|
21
|
-
'comma-spacing': 0,
|
|
19
|
+
'class-methods-use-this': 0,
|
|
22
20
|
'constructor-super': 0,
|
|
23
21
|
'default-param-last': 0,
|
|
24
|
-
'func-call-spacing': 0,
|
|
25
22
|
'getter-return': 0,
|
|
26
|
-
'indent': 0,
|
|
27
23
|
'init-declarations': 0,
|
|
28
24
|
'keyword-spacing': 0,
|
|
29
|
-
'lines-between-class-members': 0,
|
|
30
25
|
'no-array-constructor': 0,
|
|
31
26
|
'no-const-assign': 0,
|
|
32
27
|
'no-dupe-args': 0,
|
|
33
28
|
'no-dupe-class-members': 0,
|
|
34
29
|
'no-dupe-keys': 0,
|
|
35
30
|
'no-empty-function': 0,
|
|
36
|
-
'no-extra-parens': 0,
|
|
37
|
-
'no-extra-semi': 0,
|
|
38
31
|
'no-func-assign': 0,
|
|
39
32
|
'no-import-assign': 0,
|
|
40
33
|
'no-invalid-this': 0,
|
|
@@ -55,11 +48,6 @@ module.exports = {
|
|
|
55
48
|
'no-unsafe-negation': 0,
|
|
56
49
|
'no-unused-expressions': 0,
|
|
57
50
|
'no-unused-vars': 0,
|
|
58
|
-
'object-curly-spacing': 0,
|
|
59
|
-
'quotes': 0,
|
|
60
|
-
'semi': 0,
|
|
61
|
-
'space-before-function-paren': 0,
|
|
62
|
-
'space-infix-ops': 0,
|
|
63
51
|
'valid-typeof': 0,
|
|
64
52
|
|
|
65
53
|
// require that member overloads be consecutive
|
|
@@ -72,14 +60,11 @@ module.exports = {
|
|
|
72
60
|
'@typescript-eslint/ban-tslint-comment': 1,
|
|
73
61
|
// bans specific types from being used
|
|
74
62
|
'@typescript-eslint/ban-types': 2,
|
|
75
|
-
// enforce consistent brace style for blocks
|
|
76
|
-
'@typescript-eslint/brace-style': stylisticIssues['brace-style'],
|
|
77
63
|
// ensures that literals on classes are exposed in a consistent style
|
|
78
64
|
'@typescript-eslint/class-literal-property-style': 2,
|
|
79
|
-
//
|
|
80
|
-
'@typescript-eslint/
|
|
81
|
-
|
|
82
|
-
'@typescript-eslint/comma-spacing': stylisticIssues['comma-spacing'],
|
|
65
|
+
// enforce that class methods utilize `this`
|
|
66
|
+
'@typescript-eslint/class-methods-use-this':
|
|
67
|
+
bestPractices['class-methods-use-this'],
|
|
83
68
|
// enforce or disallow the use of the record type
|
|
84
69
|
'@typescript-eslint/consistent-indexed-object-style': 2,
|
|
85
70
|
// enforces consistent usage of type assertions
|
|
@@ -100,18 +85,10 @@ module.exports = {
|
|
|
100
85
|
],
|
|
101
86
|
// require explicit return and argument types on exported functions' and classes' public class methods
|
|
102
87
|
'@typescript-eslint/explicit-module-boundary-types': 2,
|
|
103
|
-
// require or disallow spacing between function identifiers and their invocations
|
|
104
|
-
'@typescript-eslint/func-call-spacing':
|
|
105
|
-
stylisticIssues['func-call-spacing'],
|
|
106
|
-
// enforce consistent indentation
|
|
107
|
-
'@typescript-eslint/indent': stylisticIssues.indent,
|
|
108
88
|
// require or disallow initialization in variable declarations
|
|
109
89
|
'@typescript-eslint/init-declarations': variables['init-declarations'],
|
|
110
90
|
// enforce consistent spacing before and after keywords
|
|
111
91
|
'@typescript-eslint/keyword-spacing': stylisticIssues['keyword-spacing'],
|
|
112
|
-
// require or disallow an empty line between class members
|
|
113
|
-
'@typescript-eslint/lines-between-class-members':
|
|
114
|
-
stylisticIssues['lines-between-class-members'],
|
|
115
92
|
// require a specific member delimiter style for interfaces and type literals
|
|
116
93
|
'@typescript-eslint/member-delimiter-style': 2,
|
|
117
94
|
// require a consistent member declaration order
|
|
@@ -153,10 +130,6 @@ module.exports = {
|
|
|
153
130
|
'@typescript-eslint/no-explicit-any': 2,
|
|
154
131
|
// disallow extra non-null assertion
|
|
155
132
|
'@typescript-eslint/no-extra-non-null-assertion': 2,
|
|
156
|
-
// disallow unnecessary parentheses
|
|
157
|
-
'@typescript-eslint/no-extra-parens': possibleErrors['no-extra-parens'],
|
|
158
|
-
// disallow unnecessary semicolons
|
|
159
|
-
'@typescript-eslint/no-extra-semi': possibleErrors['no-extra-semi'],
|
|
160
133
|
// forbids the use of classes as namespaces
|
|
161
134
|
'@typescript-eslint/no-extraneous-class': 2,
|
|
162
135
|
// disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean
|
|
@@ -212,9 +185,6 @@ module.exports = {
|
|
|
212
185
|
'@typescript-eslint/no-useless-constructor': es6['no-useless-constructor'],
|
|
213
186
|
// disallows the use of require statements except in import statements
|
|
214
187
|
'@typescript-eslint/no-var-requires': 2,
|
|
215
|
-
// enforce consistent spacing inside braces
|
|
216
|
-
'@typescript-eslint/object-curly-spacing':
|
|
217
|
-
stylisticIssues['object-curly-spacing'],
|
|
218
188
|
// prefer usage of `as const` over literal type
|
|
219
189
|
'@typescript-eslint/prefer-as-const': 2,
|
|
220
190
|
// prefer initializing each enums member value
|
|
@@ -231,15 +201,6 @@ module.exports = {
|
|
|
231
201
|
'@typescript-eslint/prefer-optional-chain': 0,
|
|
232
202
|
// recommends using `@ts-expect-error` over `@ts-ignore`
|
|
233
203
|
'@typescript-eslint/prefer-ts-expect-error': 2,
|
|
234
|
-
// enforce the consistent use of either backticks, double, or single quotes
|
|
235
|
-
'@typescript-eslint/quotes': stylisticIssues.quotes,
|
|
236
|
-
// require or disallow semicolons instead of ASI
|
|
237
|
-
'@typescript-eslint/semi': stylisticIssues.semi,
|
|
238
|
-
// enforces consistent spacing before function parenthesis
|
|
239
|
-
'@typescript-eslint/space-before-function-paren':
|
|
240
|
-
stylisticIssues['space-before-function-paren'],
|
|
241
|
-
// ensure there are spaces around infix operators
|
|
242
|
-
'@typescript-eslint/space-infix-ops': stylisticIssues['space-infix-ops'],
|
|
243
204
|
// sets preference level for triple slash directives versus ES6-style import declarations
|
|
244
205
|
'@typescript-eslint/triple-slash-reference': 2,
|
|
245
206
|
// require consistent spacing around type annotations
|
package/rules/best-practices.js
CHANGED
|
@@ -27,8 +27,6 @@ module.exports = {
|
|
|
27
27
|
'default-case-last': 2,
|
|
28
28
|
// enforce default parameters to be last
|
|
29
29
|
'default-param-last': 2,
|
|
30
|
-
// enforces consistent newlines before or after dots
|
|
31
|
-
'dot-location': [2, 'property'],
|
|
32
30
|
// encourages use of dot notation whenever possible
|
|
33
31
|
'dot-notation': [2, { allowKeywords: true }],
|
|
34
32
|
// require the use of `===` and `!==`
|
|
@@ -69,8 +67,6 @@ module.exports = {
|
|
|
69
67
|
'no-extra-label': 2,
|
|
70
68
|
// disallow fallthrough of `case` statements
|
|
71
69
|
'no-fallthrough': 2,
|
|
72
|
-
// disallow the use of leading or trailing decimal points in numeric literals
|
|
73
|
-
'no-floating-decimal': 2,
|
|
74
70
|
// disallow assignments to native objects or read-only global variables
|
|
75
71
|
'no-global-assign': 2,
|
|
76
72
|
// disallow the type conversions with shorter notations
|
|
@@ -91,8 +87,6 @@ module.exports = {
|
|
|
91
87
|
'no-loop-func': 2,
|
|
92
88
|
// disallow the use of magic numbers
|
|
93
89
|
'no-magic-numbers': 0,
|
|
94
|
-
// disallow use of multiple spaces
|
|
95
|
-
'no-multi-spaces': 2,
|
|
96
90
|
// disallow use of multiline strings
|
|
97
91
|
'no-multi-str': 2,
|
|
98
92
|
// disallow use of `new` operator when not part of the assignment or comparison
|
|
@@ -119,8 +113,6 @@ module.exports = {
|
|
|
119
113
|
'no-restricted-properties': 0,
|
|
120
114
|
// disallow use of assignment in `return` statement
|
|
121
115
|
'no-return-assign': 2,
|
|
122
|
-
// disallow unnecessary `return await`
|
|
123
|
-
'no-return-await': 2,
|
|
124
116
|
// disallow use of `javascript:` urls.
|
|
125
117
|
'no-script-url': 2,
|
|
126
118
|
// disallow assignments where both sides are exactly the same
|
|
@@ -170,8 +162,6 @@ module.exports = {
|
|
|
170
162
|
'require-unicode-regexp': 2,
|
|
171
163
|
// requires to declare all vars on top of their containing scope
|
|
172
164
|
'vars-on-top': 2,
|
|
173
|
-
// require immediate function invocation to be wrapped in parentheses
|
|
174
|
-
'wrap-iife': [2, 'any'],
|
|
175
165
|
// require or disallow Yoda conditions
|
|
176
166
|
'yoda': 2
|
|
177
167
|
}
|
package/rules/es6.js
CHANGED
|
@@ -9,18 +9,10 @@ module.exports = {
|
|
|
9
9
|
rules: {
|
|
10
10
|
// require braces in arrow function body
|
|
11
11
|
'arrow-body-style': 0,
|
|
12
|
-
// require parens in arrow function arguments
|
|
13
|
-
'arrow-parens': [2, 'as-needed'],
|
|
14
|
-
// require space before/after arrow function's arrow
|
|
15
|
-
'arrow-spacing': 2,
|
|
16
12
|
// verify calls of `super()` in constructors
|
|
17
13
|
'constructor-super': 2,
|
|
18
|
-
// enforce the spacing around the `*` in generator functions
|
|
19
|
-
'generator-star-spacing': 0,
|
|
20
14
|
// disallow modifying variables of class declarations
|
|
21
15
|
'no-class-assign': 0,
|
|
22
|
-
// disallow arrow functions where they could be confused with comparisons
|
|
23
|
-
'no-confusing-arrow': 2,
|
|
24
16
|
// disallow modifying variables that are declared using `const`
|
|
25
17
|
'no-const-assign': 2,
|
|
26
18
|
// disallow duplicate name in class members
|
|
@@ -61,15 +53,9 @@ module.exports = {
|
|
|
61
53
|
'prefer-template': 2,
|
|
62
54
|
// disallow generator functions that do not have `yield`
|
|
63
55
|
'require-yield': 0,
|
|
64
|
-
// enforce spacing between rest and spread operators and their expressions
|
|
65
|
-
'rest-spread-spacing': 2,
|
|
66
56
|
// sort import declarations within module
|
|
67
57
|
'sort-imports': 1,
|
|
68
58
|
// require symbol descriptions
|
|
69
|
-
'symbol-description': 2
|
|
70
|
-
// enforce spacing around embedded expressions of template strings
|
|
71
|
-
'template-curly-spacing': [2, 'never'],
|
|
72
|
-
// enforce spacing around the `*` in `yield*` expressions
|
|
73
|
-
'yield-star-spacing': [2, 'after']
|
|
59
|
+
'symbol-description': 2
|
|
74
60
|
}
|
|
75
61
|
};
|
package/rules/possible-errors.js
CHANGED
|
@@ -43,10 +43,6 @@ module.exports = {
|
|
|
43
43
|
'no-ex-assign': 2,
|
|
44
44
|
// disallow double-negation boolean casts in a boolean context
|
|
45
45
|
'no-extra-boolean-cast': 2,
|
|
46
|
-
// disallow unnecessary parentheses
|
|
47
|
-
'no-extra-parens': [2, 'functions'],
|
|
48
|
-
// disallow unnecessary semicolons
|
|
49
|
-
'no-extra-semi': 2,
|
|
50
46
|
// disallow overwriting functions written as function declarations
|
|
51
47
|
'no-func-assign': 2,
|
|
52
48
|
// disallow assigning to imported bindings
|
|
@@ -7,83 +7,32 @@
|
|
|
7
7
|
|
|
8
8
|
module.exports = {
|
|
9
9
|
rules: {
|
|
10
|
-
// enforce linebreaks after opening and before closing array brackets
|
|
11
|
-
'array-bracket-newline': [2, 'consistent'],
|
|
12
|
-
// enforce spacing inside array brackets
|
|
13
|
-
'array-bracket-spacing': [2, 'never'],
|
|
14
|
-
// enforce line breaks after each array element
|
|
15
|
-
'array-element-newline': 0,
|
|
16
|
-
// disallow or enforce spaces inside of single line blocks
|
|
17
|
-
'block-spacing': [2, 'always'],
|
|
18
|
-
// enforce one true brace style
|
|
19
|
-
'brace-style': [2, '1tbs', { allowSingleLine: true }],
|
|
20
10
|
// require camel case names
|
|
21
11
|
'camelcase': [2, { properties: 'never' }],
|
|
22
12
|
// enforce or disallow capitalization of the first letter of a comment
|
|
23
13
|
'capitalize-comments': 0,
|
|
24
|
-
// disallow or enforce trailing commas
|
|
25
|
-
'comma-dangle': 2,
|
|
26
|
-
// enforce spacing before and after comma
|
|
27
|
-
'comma-spacing': [2, {
|
|
28
|
-
before: false,
|
|
29
|
-
after: true
|
|
30
|
-
}],
|
|
31
|
-
// enforce one true comma style
|
|
32
|
-
'comma-style': [2, 'last'],
|
|
33
|
-
// require or disallow padding inside computed properties
|
|
34
|
-
'computed-property-spacing': [2, 'never'],
|
|
35
14
|
// enforces consistent naming when capturing the current execution context
|
|
36
15
|
'consistent-this': [0, 'self'],
|
|
37
|
-
// enforce newline at the end of file, with no multiple empty lines
|
|
38
|
-
'eol-last': 2,
|
|
39
|
-
// require or disallow spacing between function identifiers and their invocations
|
|
40
|
-
'func-call-spacing': 2,
|
|
41
16
|
// require function names to match the name of the variable or property to which they are assigned
|
|
42
17
|
'func-name-matching': 2,
|
|
43
18
|
// require function expressions to have a name
|
|
44
19
|
'func-names': 1,
|
|
45
20
|
// enforce use of function declarations or expressions
|
|
46
21
|
'func-style': 0,
|
|
47
|
-
// enforce line breaks between arguments of a function call
|
|
48
|
-
'function-call-argument-newline': [2, 'consistent'],
|
|
49
|
-
// enforce consistent line breaks inside function parentheses
|
|
50
|
-
'function-paren-newline': 2,
|
|
51
22
|
// disallow specified identifiers
|
|
52
23
|
'id-denylist': 0,
|
|
53
24
|
// this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
|
|
54
25
|
'id-length': 0,
|
|
55
26
|
// require identifiers to match the provided regular expression
|
|
56
27
|
'id-match': 0,
|
|
57
|
-
// enforce the location of arrow function bodies with implicit returns
|
|
58
|
-
'implicit-arrow-linebreak': 2,
|
|
59
|
-
// this option sets a specific tab width for your code
|
|
60
|
-
'indent': [2, 2, { SwitchCase: 1 }],
|
|
61
|
-
// specify whether double or single quotes should be used in JSX attributes
|
|
62
|
-
'jsx-quotes': 0,
|
|
63
|
-
// enforces spacing between keys and values in object literal properties
|
|
64
|
-
'key-spacing': [2, {
|
|
65
|
-
beforeColon: false,
|
|
66
|
-
afterColon: true
|
|
67
|
-
}],
|
|
68
28
|
// enforce spacing before and after keywords
|
|
69
29
|
'keyword-spacing': 2,
|
|
70
30
|
// enforce position of line comments
|
|
71
31
|
'line-comment-position': 0,
|
|
72
|
-
// disallow mixed 'LF' and 'CRLF' as linebreaks
|
|
73
|
-
'linebreak-style': 0,
|
|
74
|
-
// enforces empty lines around comments
|
|
75
|
-
'lines-around-comment': 0,
|
|
76
|
-
// require or disallow an empty line between class members
|
|
77
|
-
'lines-between-class-members': 2,
|
|
78
32
|
// require or disallow logical assignment logical operator shorthand
|
|
79
33
|
'logical-assignment-operators': 2,
|
|
80
34
|
// specify the maximum depth that blocks can be nested
|
|
81
35
|
'max-depth': [0, 4],
|
|
82
|
-
// specify the maximum length of a line in your program
|
|
83
|
-
'max-len': [1, 80, 2, {
|
|
84
|
-
ignoreComments: true,
|
|
85
|
-
ignoreUrls: true
|
|
86
|
-
}],
|
|
87
36
|
// enforce a maximum number of lines per file
|
|
88
37
|
'max-lines': 0,
|
|
89
38
|
// enforce a maximum number of line of code in a function
|
|
@@ -94,18 +43,10 @@ module.exports = {
|
|
|
94
43
|
'max-params': [0, 3],
|
|
95
44
|
// specify the maximum number of statement allowed in a function
|
|
96
45
|
'max-statements': [0, 10],
|
|
97
|
-
// specify the maximum number of statements allowed per line
|
|
98
|
-
'max-statements-per-line': [2, { max: 1 }],
|
|
99
46
|
// enforce a particular style for multiline comments
|
|
100
47
|
'multiline-comment-style': 0,
|
|
101
|
-
// enforce newlines between operands of ternary expressions
|
|
102
|
-
'multiline-ternary': 0,
|
|
103
48
|
// require a capital letter for constructors
|
|
104
49
|
'new-cap': [2, { newIsCap: true }],
|
|
105
|
-
// disallow the omission of parentheses when invoking a constructor with no arguments
|
|
106
|
-
'new-parens': 2,
|
|
107
|
-
// enforce newline after each call when chaining the calls
|
|
108
|
-
'newline-per-chained-call': 0,
|
|
109
50
|
// disallow use of the `Array` constructor
|
|
110
51
|
'no-array-constructor': 2,
|
|
111
52
|
// disallow use of bitwise operators
|
|
@@ -116,130 +57,39 @@ module.exports = {
|
|
|
116
57
|
'no-inline-comments': 0,
|
|
117
58
|
// disallow `if` as the only statement in an `else` block
|
|
118
59
|
'no-lonely-if': 2,
|
|
119
|
-
// disallow mixed binary operators
|
|
120
|
-
'no-mixed-operators': 2,
|
|
121
|
-
// disallow mixed spaces and tabs for indentation
|
|
122
|
-
'no-mixed-spaces-and-tabs': 2,
|
|
123
60
|
// disallow use of chained assignment expressions
|
|
124
61
|
'no-multi-assign': 2,
|
|
125
|
-
// disallow multiple empty lines
|
|
126
|
-
'no-multiple-empty-lines': [2, { max: 2 }],
|
|
127
62
|
// disallow negated conditions
|
|
128
63
|
'no-negated-condition': 2,
|
|
129
64
|
// disallow nested ternary expressions
|
|
130
65
|
'no-nested-ternary': 2,
|
|
131
|
-
// disallow
|
|
132
|
-
'no-
|
|
66
|
+
// disallow calls to the `Object` constructor without an argument
|
|
67
|
+
'no-object-constructor': 2,
|
|
133
68
|
// disallow use of unary operators, `++` and `--`
|
|
134
69
|
'no-plusplus': 0,
|
|
135
70
|
// disallow use of certain syntax in code
|
|
136
71
|
'no-restricted-syntax': 0,
|
|
137
|
-
// disallow all tabs
|
|
138
|
-
'no-tabs': 2,
|
|
139
72
|
// disallow the use of ternary operators
|
|
140
73
|
'no-ternary': 0,
|
|
141
|
-
// disallow trailing whitespace at the end of lines
|
|
142
|
-
'no-trailing-spaces': 2,
|
|
143
74
|
// disallow dangling underscores in identifiers
|
|
144
75
|
'no-underscore-dangle': 0,
|
|
145
76
|
// disallow the use of `Boolean` literals in conditional expressions
|
|
146
77
|
'no-unneeded-ternary': 2,
|
|
147
|
-
// disallow whitespace before properties
|
|
148
|
-
'no-whitespace-before-property': 2,
|
|
149
|
-
// enforce the location of single-line statements
|
|
150
|
-
'nonblock-statement-body-position': 2,
|
|
151
|
-
// enforce consistent line breaks inside braces
|
|
152
|
-
'object-curly-newline': 0,
|
|
153
|
-
// require or disallow padding inside curly braces
|
|
154
|
-
'object-curly-spacing': [2, 'always'],
|
|
155
|
-
// enforce placing object properties on separate lines
|
|
156
|
-
'object-property-newline': 2,
|
|
157
78
|
// allow just one var statement per function
|
|
158
79
|
'one-var': [2, 'never'],
|
|
159
|
-
// require or disallow an newline around variable declarations
|
|
160
|
-
'one-var-declaration-per-line': [2, 'initializations'],
|
|
161
80
|
// require assignment operator shorthand where possible or prohibit it entirely
|
|
162
81
|
'operator-assignment': 0,
|
|
163
|
-
// enforce operators to be placed before or after line breaks
|
|
164
|
-
'operator-linebreak': [2, 'after'],
|
|
165
|
-
// enforce padding within blocks
|
|
166
|
-
'padded-blocks': [2, { blocks: 'never' }],
|
|
167
|
-
// require or disallow padding lines between statements
|
|
168
|
-
'padding-line-between-statements': [1,
|
|
169
|
-
{
|
|
170
|
-
blankLine: 'always',
|
|
171
|
-
prev: 'directive',
|
|
172
|
-
next: '*'
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
blankLine: 'any',
|
|
176
|
-
prev: 'directive',
|
|
177
|
-
next: 'directive'
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
blankLine: 'always',
|
|
181
|
-
prev: ['const', 'let', 'var'],
|
|
182
|
-
next: '*'
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
blankLine: 'any',
|
|
186
|
-
prev: ['const', 'let', 'var'],
|
|
187
|
-
next: ['const', 'let', 'var']
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
blankLine: 'always',
|
|
191
|
-
prev: '*',
|
|
192
|
-
next: 'return'
|
|
193
|
-
}],
|
|
194
82
|
// disallow the use of `Math.pow` in favor of the `**` operator
|
|
195
83
|
'prefer-exponentiation-operator': 1,
|
|
196
84
|
// disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`
|
|
197
85
|
'prefer-object-has-own': 1,
|
|
198
86
|
// prefer use of an object spread over `Object.assign`
|
|
199
87
|
'prefer-object-spread': 1,
|
|
200
|
-
// require quotes around object literal property names
|
|
201
|
-
'quote-props': [2, 'consistent-as-needed'],
|
|
202
|
-
// specify whether double or single quotes should be used
|
|
203
|
-
'quotes': [2, 'single', 'avoid-escape'],
|
|
204
|
-
// require or disallow use of semicolons instead of ASI
|
|
205
|
-
'semi': [2, 'always'],
|
|
206
|
-
// enforce spacing before and after semicolons
|
|
207
|
-
'semi-spacing': [2, {
|
|
208
|
-
before: false,
|
|
209
|
-
after: true
|
|
210
|
-
}],
|
|
211
|
-
// enforce location of semicolons
|
|
212
|
-
'semi-style': 2,
|
|
213
88
|
// require object keys to be sorted
|
|
214
89
|
'sort-keys': 0,
|
|
215
90
|
// sort variables within the same declaration block
|
|
216
91
|
'sort-vars': 0,
|
|
217
|
-
// require or disallow space before blocks
|
|
218
|
-
'space-before-blocks': 2,
|
|
219
|
-
// require or disallow space before function opening parenthesis
|
|
220
|
-
'space-before-function-paren': [2, {
|
|
221
|
-
anonymous: 'never',
|
|
222
|
-
named: 'never',
|
|
223
|
-
asyncArrow: 'always'
|
|
224
|
-
}],
|
|
225
|
-
// require or disallow spaces inside parentheses
|
|
226
|
-
'space-in-parens': 2,
|
|
227
|
-
// require spaces around operators
|
|
228
|
-
'space-infix-ops': 2,
|
|
229
|
-
// Require or disallow spaces before/after unary operators
|
|
230
|
-
'space-unary-ops': 0,
|
|
231
|
-
// require or disallow a space immediately following the `//` or `/*` in a comment
|
|
232
|
-
'spaced-comment': [2, 'always', {
|
|
233
|
-
exceptions: ['-', '+'],
|
|
234
|
-
markers: ['=', '!'] // space here to support sprockets directives
|
|
235
|
-
}],
|
|
236
|
-
// enforce spacing around colons of switch statements
|
|
237
|
-
'switch-colon-spacing': 2,
|
|
238
|
-
// require or disallow spacing between template tags and their literals
|
|
239
|
-
'template-tag-spacing': 2,
|
|
240
92
|
// require or disallow Unicode byte order mark (BOM)
|
|
241
|
-
'unicode-bom': 2
|
|
242
|
-
// require regex literals to be wrapped in parentheses
|
|
243
|
-
'wrap-regex': 0
|
|
93
|
+
'unicode-bom': 2
|
|
244
94
|
}
|
|
245
95
|
};
|