@nfq/eslint-config 3.1.2 → 3.2.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/.history/rules/best-practices_20231009222004.js +191 -0
- package/.history/rules/best-practices_20240520134454.js +193 -0
- package/.history/rules/typescript_20230725223738.js +237 -0
- package/.history/rules/typescript_20240305091012.js +246 -0
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/rules/best-practices.js +2 -0
- package/rules/typescript.js +10 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/* eslint-disable no-inline-comments */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
rules: {
|
|
5
|
+
'@nfq/no-magic-numbers': [
|
|
6
|
+
'error',
|
|
7
|
+
{
|
|
8
|
+
detectObjects: false,
|
|
9
|
+
enforceConst: true,
|
|
10
|
+
ignore: [0, 1],
|
|
11
|
+
ignoreArrayIndexes: true,
|
|
12
|
+
ignoreArrays: true,
|
|
13
|
+
ignoreFunctions: ['darken', 'lighten', 'setTimeout', 'setInterval', 'spacing', 'translucify', 'wait']
|
|
14
|
+
}
|
|
15
|
+
], // disallow magic numbers http://eslint.org/docs/rules/no-magic-numbers
|
|
16
|
+
'accessor-pairs': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
getWithoutSet: false,
|
|
20
|
+
setWithoutGet: true
|
|
21
|
+
}
|
|
22
|
+
], // enforces getter/setter pairs in objects https://eslint.org/docs/rules/accessor-pairs
|
|
23
|
+
'array-callback-return': ['error', {allowImplicit: true}], // enforces return statements in callbacks of array's methods http://eslint.org/docs/rules/array-callback-return
|
|
24
|
+
'block-scoped-var': 'error', // treat var statements as if they were block scoped https://eslint.org/docs/rules/block-scoped-var
|
|
25
|
+
'class-methods-use-this': ['off', {exceptMethods: []}], // enforce that class methods use "this" http://eslint.org/docs/rules/class-methods-use-this
|
|
26
|
+
complexity: ['warn', {max: 20}], // specify the maximum cyclomatic complexity allowed in a program https://eslint.org/docs/rules/complexity
|
|
27
|
+
'consistent-return': 'error', // require return statements to either always or never specify values https://eslint.org/docs/rules/consistent-return
|
|
28
|
+
curly: ['error', 'multi-line', 'consistent'], // specify curly brace conventions for all control statements https://eslint.org/docs/rules/curly#top
|
|
29
|
+
'default-case': ['warn', {commentPattern: '^no default$'}], // require default case in switch statements https://eslint.org/docs/rules/default-case
|
|
30
|
+
'default-param-last': 'error', // Checks if default params are last https://eslint.org/docs/rules/default-param-last
|
|
31
|
+
'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots http://eslint.org/docs/rules/dot-location
|
|
32
|
+
'dot-notation': ['error', {allowKeywords: true}], // encourages use of dot notation whenever possible https://eslint.org/docs/rules/dot-notation
|
|
33
|
+
eqeqeq: ['error', 'always'], // require the use of === and !== http://eslint.org/docs/rules/eqeqeq
|
|
34
|
+
'guard-for-in': 'warn', // make sure for-in loops have an if statement https://eslint.org/docs/rules/guard-for-in
|
|
35
|
+
'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file https://eslint.org/docs/rules/max-classes-per-file
|
|
36
|
+
'no-alert': 'error', // disallow the use of alert, confirm, and prompt https://eslint.org/docs/rules/no-alert
|
|
37
|
+
'no-caller': 'error', // disallow use of arguments.caller or arguments.callee https://eslint.org/docs/rules/no-caller
|
|
38
|
+
'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses http://eslint.org/docs/rules/no-case-declarations
|
|
39
|
+
'no-constructor-return': 'off', // Disallow returning value in constructor https://eslint.org/docs/rules/no-constructor-return
|
|
40
|
+
'no-div-regex': 'error', // disallow division operators explicitly at beginning of regular expression http://eslint.org/docs/rules/no-div-regex
|
|
41
|
+
'no-else-return': ['error', {allowElseIf: true}], // disallow else after a return in an if https://eslint.org/docs/rules/no-else-return
|
|
42
|
+
'no-empty-function': ['error', {allow: ['arrowFunctions', 'methods', 'asyncMethods']}], // disallow empty functions, except for standalone funcs/arrows http://eslint.org/docs/rules/no-empty-function
|
|
43
|
+
'no-empty-pattern': 'error', // disallow empty destructuring patterns http://eslint.org/docs/rules/no-empty-pattern
|
|
44
|
+
'no-eq-null': 'error', // disallow comparisons to null without a type-checking operator https://eslint.org/docs/rules/no-eq-null
|
|
45
|
+
'no-eval': 'error', // disallow use of eval() https://eslint.org/docs/rules/no-eval
|
|
46
|
+
'no-extend-native': 'error', // disallow adding to native types https://eslint.org/docs/rules/no-extend-native
|
|
47
|
+
'no-extra-bind': 'error', // disallow unnecessary function binding https://eslint.org/docs/rules/no-extra-bind
|
|
48
|
+
'no-extra-label': 'error', // disallow Unnecessary Labels http://eslint.org/docs/rules/no-extra-label
|
|
49
|
+
'no-fallthrough': 'error', // disallow fallthrough of case statements https://eslint.org/docs/rules/no-fallthrough
|
|
50
|
+
'no-floating-decimal': 'error', // disallow the use of leading or trailing decimal points in numeric literals https://eslint.org/docs/rules/no-floating-decimal
|
|
51
|
+
'no-global-assign': 'error', // disallow reassignments of native objects or read-only globals http://eslint.org/docs/rules/no-global-assign
|
|
52
|
+
'no-implicit-coercion': 'error', // disallow implicit type conversions http://eslint.org/docs/rules/no-implicit-coercion
|
|
53
|
+
'no-implicit-globals': 'error', // disallow var and named functions in global scope http://eslint.org/docs/rules/no-implicit-globals
|
|
54
|
+
'no-implied-eval': 'error', // disallow use of eval()-like methods https://eslint.org/docs/rules/no-implied-eval
|
|
55
|
+
'no-invalid-this': 'error', // disallow this keywords outside of classes or class-like objects https://eslint.org/docs/rules/no-invalid-this
|
|
56
|
+
'no-iterator': 'error', // disallow usage of __iterator__ property https://eslint.org/docs/rules/no-iterator
|
|
57
|
+
'no-labels': 'error', // disallow use of labels for anything other then loops and switches https://eslint.org/docs/rules/no-labels
|
|
58
|
+
'no-lone-blocks': 'error', // disallow unnecessary nested blocks https://eslint.org/docs/rules/no-lone-blocks
|
|
59
|
+
'no-loop-func': 'error', // disallow creation of functions within loops https://eslint.org/docs/rules/no-loop-func
|
|
60
|
+
'no-multi-spaces': 'error', // disallow use of multiple spaces https://eslint.org/docs/rules/no-multi-spaces
|
|
61
|
+
'no-multi-str': 'error', // disallow use of multiline strings https://eslint.org/docs/rules/no-multi-str
|
|
62
|
+
'no-new': 'error', // disallow use of new operator when not part of the assignment or comparison https://eslint.org/docs/rules/no-new
|
|
63
|
+
'no-new-func': 'error', // disallow use of new operator for Function object https://eslint.org/docs/rules/no-new-func
|
|
64
|
+
'no-new-wrappers': 'error', // disallows creating new instances of String, Number, and Boolean https://eslint.org/docs/rules/no-new-wrappers
|
|
65
|
+
'no-octal': 'error', // disallow use of (old style) octal literals https://eslint.org/docs/rules/no-octal
|
|
66
|
+
'no-octal-escape': 'error', // disallow use of octal escape sequences in string literals, such as var foo = 'Copyright \251'; https://eslint.org/docs/rules/no-octal-escape
|
|
67
|
+
'no-param-reassign': [
|
|
68
|
+
'error',
|
|
69
|
+
{
|
|
70
|
+
ignorePropertyModificationsFor: [
|
|
71
|
+
'$scope', // for Angular 1 scopes
|
|
72
|
+
'acc', // for reduce accumulators
|
|
73
|
+
'accumulator', // for reduce accumulators
|
|
74
|
+
'ctx', // for Koa routing
|
|
75
|
+
'descriptor', // for decorators
|
|
76
|
+
'e', // for e.returnvalue
|
|
77
|
+
'item', // array foreach
|
|
78
|
+
'key', // for reduce key value pairs
|
|
79
|
+
'req', // for Express requests
|
|
80
|
+
'request', // for Express requests
|
|
81
|
+
'res', // for Express responses
|
|
82
|
+
'response', // for Express responses
|
|
83
|
+
'staticContext', // for ReactRouter context
|
|
84
|
+
'value' // for reduce key value pairs
|
|
85
|
+
],
|
|
86
|
+
props: true
|
|
87
|
+
}
|
|
88
|
+
], // disallow reassignment of function parameters disallow parameter object manipulation except for specific exclusions https://eslint.org/docs/rules/no-param-reassign.html
|
|
89
|
+
'no-proto': 'error', // disallow usage of __proto__ property https://eslint.org/docs/rules/no-proto
|
|
90
|
+
'no-redeclare': 'error', // disallow declaring the same variable more then once https://eslint.org/docs/rules/no-redeclare
|
|
91
|
+
'no-restricted-properties': [
|
|
92
|
+
'error',
|
|
93
|
+
{
|
|
94
|
+
message: 'arguments.callee is deprecated',
|
|
95
|
+
object: 'arguments',
|
|
96
|
+
property: 'callee'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
message: 'Please use Number.isFinite instead',
|
|
100
|
+
object: 'global',
|
|
101
|
+
property: 'isFinite'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
message: 'Please use Number.isFinite instead',
|
|
105
|
+
object: 'self',
|
|
106
|
+
property: 'isFinite'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
message: 'Please use Number.isFinite instead',
|
|
110
|
+
object: 'window',
|
|
111
|
+
property: 'isFinite'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
message: 'Please use Number.isNaN instead',
|
|
115
|
+
object: 'global',
|
|
116
|
+
property: 'isNaN'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
message: 'Please use Number.isNaN instead',
|
|
120
|
+
object: 'self',
|
|
121
|
+
property: 'isNaN'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
message: 'Please use Number.isNaN instead',
|
|
125
|
+
object: 'window',
|
|
126
|
+
property: 'isNaN'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
message: 'Please use Object.defineProperty instead.',
|
|
130
|
+
property: '__defineGetter__'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
message: 'Please use Object.defineProperty instead.',
|
|
134
|
+
property: '__defineSetter__'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
message: 'Use the exponentiation operator (**) instead.',
|
|
138
|
+
object: 'Math',
|
|
139
|
+
property: 'pow'
|
|
140
|
+
}
|
|
141
|
+
], // disallow certain object properties https://eslint.org/docs/rules/no-restricted-properties
|
|
142
|
+
'no-return-assign': ['error', 'except-parens'], // disallow use of assignment in return statement https://eslint.org/docs/rules/no-return-assign
|
|
143
|
+
'no-return-await': 'error', // disallow redundant `return await` https://eslint.org/docs/rules/no-return-await
|
|
144
|
+
'no-script-url': 'error', // disallow use of `javascript:` urls. https://eslint.org/docs/rules/no-script-url
|
|
145
|
+
'no-self-assign': ['error', {props: true}], // disallow self assignment https://eslint.org/docs/rules/no-self-assign
|
|
146
|
+
'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same https://eslint.org/docs/rules/no-self-compare
|
|
147
|
+
'no-sequences': 'error', // disallow use of comma operator https://eslint.org/docs/rules/no-sequences
|
|
148
|
+
'no-throw-literal': 'error', // restrict what can be thrown as an exception https://eslint.org/docs/rules/no-throw-literal
|
|
149
|
+
'no-unmodified-loop-condition': 'error', // disallow unmodified conditions of loops https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
150
|
+
'no-unused-expressions': [
|
|
151
|
+
'error',
|
|
152
|
+
{
|
|
153
|
+
allowShortCircuit: true,
|
|
154
|
+
allowTaggedTemplates: false,
|
|
155
|
+
allowTernary: true
|
|
156
|
+
}
|
|
157
|
+
], // disallow usage of expressions in statement position https://eslint.org/docs/rules/no-unused-expressions
|
|
158
|
+
'no-unused-labels': 'error', // disallow unused labels https://eslint.org/docs/rules/no-unused-labels
|
|
159
|
+
'no-useless-call': 'error', // disallow unnecessary .call() and .apply() https://eslint.org/docs/rules/no-useless-call
|
|
160
|
+
'no-useless-catch': 'error', // Disallow unnecessary catch clauses https://eslint.org/docs/rules/no-useless-catch
|
|
161
|
+
'no-useless-concat': 'error', // disallow useless string concatenation https://eslint.org/docs/rules/no-useless-concat
|
|
162
|
+
'no-useless-escape': 'error', // disallow unnecessary string escaping https://eslint.org/docs/rules/no-useless-escape
|
|
163
|
+
'no-useless-return': 'error', // disallow redundant return; keywords https://eslint.org/docs/rules/no-useless-return
|
|
164
|
+
'no-void': ['error', {allowAsStatement: true}], // disallow use of void operator https://eslint.org/docs/rules/no-void
|
|
165
|
+
'no-warning-comments': [
|
|
166
|
+
'off',
|
|
167
|
+
{
|
|
168
|
+
location: 'start',
|
|
169
|
+
terms: [
|
|
170
|
+
'todo',
|
|
171
|
+
'fixme',
|
|
172
|
+
'xxx'
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
], // disallow usage of configurable warning terms in comments: e.g. todo https://eslint.org/docs/rules/no-warning-comments
|
|
176
|
+
'no-with': 'error', // disallow use of the with statement https://eslint.org/docs/rules/no-with
|
|
177
|
+
'prefer-named-capture-group': 'off', // Suggest using named capture group in regular expression https://eslint.org/docs/rules/prefer-named-capture-group
|
|
178
|
+
'prefer-promise-reject-errors': ['error', {allowEmptyReject: true}], // require using Error objects as Promise rejection reasons https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
179
|
+
'prefer-regex-literals': 'error', // https://eslint.org/docs/rules/prefer-regex-literals
|
|
180
|
+
radix: ['error', 'always'], // require use of the second argument for parseInt() https://eslint.org/docs/rules/radix
|
|
181
|
+
'require-await': 'off', // require `await` in `async function` (note: this is a horrible rule that should never be used) https://eslint.org/docs/rules/require-await
|
|
182
|
+
'require-unicode-regexp': 'error', // Enforce the use of u flag on RegExp https://eslint.org/docs/rules/require-unicode-regexp
|
|
183
|
+
'vars-on-top': 'error', // requires to declare all vars on top of their containing scope https://eslint.org/docs/rules/vars-on-top
|
|
184
|
+
'wrap-iife': [
|
|
185
|
+
'error',
|
|
186
|
+
'outside',
|
|
187
|
+
{functionPrototypeMethods: false}
|
|
188
|
+
], // require immediate function invocation to be wrapped in parentheses https://eslint.org/docs/rules/wrap-iife.html
|
|
189
|
+
yoda: 'error' // require or disallow Yoda conditions https://eslint.org/docs/rules/yoda
|
|
190
|
+
}
|
|
191
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/* eslint-disable no-inline-comments */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
rules: {
|
|
5
|
+
'@nfq/no-magic-numbers': [
|
|
6
|
+
'error',
|
|
7
|
+
{
|
|
8
|
+
detectObjects: false,
|
|
9
|
+
enforceConst: true,
|
|
10
|
+
ignore: [0, 1],
|
|
11
|
+
ignoreArrayIndexes: true,
|
|
12
|
+
ignoreArrays: true,
|
|
13
|
+
ignoreClassFieldInitialValues: true,
|
|
14
|
+
ignoreDefaultValues: true,
|
|
15
|
+
ignoreFunctions: ['darken', 'lighten', 'setTimeout', 'setInterval', 'spacing', 'translucify', 'wait']
|
|
16
|
+
}
|
|
17
|
+
], // disallow magic numbers http://eslint.org/docs/rules/no-magic-numbers
|
|
18
|
+
'accessor-pairs': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
getWithoutSet: false,
|
|
22
|
+
setWithoutGet: true
|
|
23
|
+
}
|
|
24
|
+
], // enforces getter/setter pairs in objects https://eslint.org/docs/rules/accessor-pairs
|
|
25
|
+
'array-callback-return': ['error', {allowImplicit: true}], // enforces return statements in callbacks of array's methods http://eslint.org/docs/rules/array-callback-return
|
|
26
|
+
'block-scoped-var': 'error', // treat var statements as if they were block scoped https://eslint.org/docs/rules/block-scoped-var
|
|
27
|
+
'class-methods-use-this': ['off', {exceptMethods: []}], // enforce that class methods use "this" http://eslint.org/docs/rules/class-methods-use-this
|
|
28
|
+
complexity: ['warn', {max: 20}], // specify the maximum cyclomatic complexity allowed in a program https://eslint.org/docs/rules/complexity
|
|
29
|
+
'consistent-return': 'error', // require return statements to either always or never specify values https://eslint.org/docs/rules/consistent-return
|
|
30
|
+
curly: ['error', 'multi-line', 'consistent'], // specify curly brace conventions for all control statements https://eslint.org/docs/rules/curly#top
|
|
31
|
+
'default-case': ['warn', {commentPattern: '^no default$'}], // require default case in switch statements https://eslint.org/docs/rules/default-case
|
|
32
|
+
'default-param-last': 'error', // Checks if default params are last https://eslint.org/docs/rules/default-param-last
|
|
33
|
+
'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots http://eslint.org/docs/rules/dot-location
|
|
34
|
+
'dot-notation': ['error', {allowKeywords: true}], // encourages use of dot notation whenever possible https://eslint.org/docs/rules/dot-notation
|
|
35
|
+
eqeqeq: ['error', 'always'], // require the use of === and !== http://eslint.org/docs/rules/eqeqeq
|
|
36
|
+
'guard-for-in': 'warn', // make sure for-in loops have an if statement https://eslint.org/docs/rules/guard-for-in
|
|
37
|
+
'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file https://eslint.org/docs/rules/max-classes-per-file
|
|
38
|
+
'no-alert': 'error', // disallow the use of alert, confirm, and prompt https://eslint.org/docs/rules/no-alert
|
|
39
|
+
'no-caller': 'error', // disallow use of arguments.caller or arguments.callee https://eslint.org/docs/rules/no-caller
|
|
40
|
+
'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses http://eslint.org/docs/rules/no-case-declarations
|
|
41
|
+
'no-constructor-return': 'off', // Disallow returning value in constructor https://eslint.org/docs/rules/no-constructor-return
|
|
42
|
+
'no-div-regex': 'error', // disallow division operators explicitly at beginning of regular expression http://eslint.org/docs/rules/no-div-regex
|
|
43
|
+
'no-else-return': ['error', {allowElseIf: true}], // disallow else after a return in an if https://eslint.org/docs/rules/no-else-return
|
|
44
|
+
'no-empty-function': ['error', {allow: ['arrowFunctions', 'methods', 'asyncMethods']}], // disallow empty functions, except for standalone funcs/arrows http://eslint.org/docs/rules/no-empty-function
|
|
45
|
+
'no-empty-pattern': 'error', // disallow empty destructuring patterns http://eslint.org/docs/rules/no-empty-pattern
|
|
46
|
+
'no-eq-null': 'error', // disallow comparisons to null without a type-checking operator https://eslint.org/docs/rules/no-eq-null
|
|
47
|
+
'no-eval': 'error', // disallow use of eval() https://eslint.org/docs/rules/no-eval
|
|
48
|
+
'no-extend-native': 'error', // disallow adding to native types https://eslint.org/docs/rules/no-extend-native
|
|
49
|
+
'no-extra-bind': 'error', // disallow unnecessary function binding https://eslint.org/docs/rules/no-extra-bind
|
|
50
|
+
'no-extra-label': 'error', // disallow Unnecessary Labels http://eslint.org/docs/rules/no-extra-label
|
|
51
|
+
'no-fallthrough': 'error', // disallow fallthrough of case statements https://eslint.org/docs/rules/no-fallthrough
|
|
52
|
+
'no-floating-decimal': 'error', // disallow the use of leading or trailing decimal points in numeric literals https://eslint.org/docs/rules/no-floating-decimal
|
|
53
|
+
'no-global-assign': 'error', // disallow reassignments of native objects or read-only globals http://eslint.org/docs/rules/no-global-assign
|
|
54
|
+
'no-implicit-coercion': 'error', // disallow implicit type conversions http://eslint.org/docs/rules/no-implicit-coercion
|
|
55
|
+
'no-implicit-globals': 'error', // disallow var and named functions in global scope http://eslint.org/docs/rules/no-implicit-globals
|
|
56
|
+
'no-implied-eval': 'error', // disallow use of eval()-like methods https://eslint.org/docs/rules/no-implied-eval
|
|
57
|
+
'no-invalid-this': 'error', // disallow this keywords outside of classes or class-like objects https://eslint.org/docs/rules/no-invalid-this
|
|
58
|
+
'no-iterator': 'error', // disallow usage of __iterator__ property https://eslint.org/docs/rules/no-iterator
|
|
59
|
+
'no-labels': 'error', // disallow use of labels for anything other then loops and switches https://eslint.org/docs/rules/no-labels
|
|
60
|
+
'no-lone-blocks': 'error', // disallow unnecessary nested blocks https://eslint.org/docs/rules/no-lone-blocks
|
|
61
|
+
'no-loop-func': 'error', // disallow creation of functions within loops https://eslint.org/docs/rules/no-loop-func
|
|
62
|
+
'no-multi-spaces': 'error', // disallow use of multiple spaces https://eslint.org/docs/rules/no-multi-spaces
|
|
63
|
+
'no-multi-str': 'error', // disallow use of multiline strings https://eslint.org/docs/rules/no-multi-str
|
|
64
|
+
'no-new': 'error', // disallow use of new operator when not part of the assignment or comparison https://eslint.org/docs/rules/no-new
|
|
65
|
+
'no-new-func': 'error', // disallow use of new operator for Function object https://eslint.org/docs/rules/no-new-func
|
|
66
|
+
'no-new-wrappers': 'error', // disallows creating new instances of String, Number, and Boolean https://eslint.org/docs/rules/no-new-wrappers
|
|
67
|
+
'no-octal': 'error', // disallow use of (old style) octal literals https://eslint.org/docs/rules/no-octal
|
|
68
|
+
'no-octal-escape': 'error', // disallow use of octal escape sequences in string literals, such as var foo = 'Copyright \251'; https://eslint.org/docs/rules/no-octal-escape
|
|
69
|
+
'no-param-reassign': [
|
|
70
|
+
'error',
|
|
71
|
+
{
|
|
72
|
+
ignorePropertyModificationsFor: [
|
|
73
|
+
'$scope', // for Angular 1 scopes
|
|
74
|
+
'acc', // for reduce accumulators
|
|
75
|
+
'accumulator', // for reduce accumulators
|
|
76
|
+
'ctx', // for Koa routing
|
|
77
|
+
'descriptor', // for decorators
|
|
78
|
+
'e', // for e.returnvalue
|
|
79
|
+
'item', // array foreach
|
|
80
|
+
'key', // for reduce key value pairs
|
|
81
|
+
'req', // for Express requests
|
|
82
|
+
'request', // for Express requests
|
|
83
|
+
'res', // for Express responses
|
|
84
|
+
'response', // for Express responses
|
|
85
|
+
'staticContext', // for ReactRouter context
|
|
86
|
+
'value' // for reduce key value pairs
|
|
87
|
+
],
|
|
88
|
+
props: true
|
|
89
|
+
}
|
|
90
|
+
], // disallow reassignment of function parameters disallow parameter object manipulation except for specific exclusions https://eslint.org/docs/rules/no-param-reassign.html
|
|
91
|
+
'no-proto': 'error', // disallow usage of __proto__ property https://eslint.org/docs/rules/no-proto
|
|
92
|
+
'no-redeclare': 'error', // disallow declaring the same variable more then once https://eslint.org/docs/rules/no-redeclare
|
|
93
|
+
'no-restricted-properties': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
message: 'arguments.callee is deprecated',
|
|
97
|
+
object: 'arguments',
|
|
98
|
+
property: 'callee'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
message: 'Please use Number.isFinite instead',
|
|
102
|
+
object: 'global',
|
|
103
|
+
property: 'isFinite'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
message: 'Please use Number.isFinite instead',
|
|
107
|
+
object: 'self',
|
|
108
|
+
property: 'isFinite'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
message: 'Please use Number.isFinite instead',
|
|
112
|
+
object: 'window',
|
|
113
|
+
property: 'isFinite'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
message: 'Please use Number.isNaN instead',
|
|
117
|
+
object: 'global',
|
|
118
|
+
property: 'isNaN'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
message: 'Please use Number.isNaN instead',
|
|
122
|
+
object: 'self',
|
|
123
|
+
property: 'isNaN'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
message: 'Please use Number.isNaN instead',
|
|
127
|
+
object: 'window',
|
|
128
|
+
property: 'isNaN'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
message: 'Please use Object.defineProperty instead.',
|
|
132
|
+
property: '__defineGetter__'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
message: 'Please use Object.defineProperty instead.',
|
|
136
|
+
property: '__defineSetter__'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
message: 'Use the exponentiation operator (**) instead.',
|
|
140
|
+
object: 'Math',
|
|
141
|
+
property: 'pow'
|
|
142
|
+
}
|
|
143
|
+
], // disallow certain object properties https://eslint.org/docs/rules/no-restricted-properties
|
|
144
|
+
'no-return-assign': ['error', 'except-parens'], // disallow use of assignment in return statement https://eslint.org/docs/rules/no-return-assign
|
|
145
|
+
'no-return-await': 'error', // disallow redundant `return await` https://eslint.org/docs/rules/no-return-await
|
|
146
|
+
'no-script-url': 'error', // disallow use of `javascript:` urls. https://eslint.org/docs/rules/no-script-url
|
|
147
|
+
'no-self-assign': ['error', {props: true}], // disallow self assignment https://eslint.org/docs/rules/no-self-assign
|
|
148
|
+
'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same https://eslint.org/docs/rules/no-self-compare
|
|
149
|
+
'no-sequences': 'error', // disallow use of comma operator https://eslint.org/docs/rules/no-sequences
|
|
150
|
+
'no-throw-literal': 'error', // restrict what can be thrown as an exception https://eslint.org/docs/rules/no-throw-literal
|
|
151
|
+
'no-unmodified-loop-condition': 'error', // disallow unmodified conditions of loops https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
152
|
+
'no-unused-expressions': [
|
|
153
|
+
'error',
|
|
154
|
+
{
|
|
155
|
+
allowShortCircuit: true,
|
|
156
|
+
allowTaggedTemplates: false,
|
|
157
|
+
allowTernary: true
|
|
158
|
+
}
|
|
159
|
+
], // disallow usage of expressions in statement position https://eslint.org/docs/rules/no-unused-expressions
|
|
160
|
+
'no-unused-labels': 'error', // disallow unused labels https://eslint.org/docs/rules/no-unused-labels
|
|
161
|
+
'no-useless-call': 'error', // disallow unnecessary .call() and .apply() https://eslint.org/docs/rules/no-useless-call
|
|
162
|
+
'no-useless-catch': 'error', // Disallow unnecessary catch clauses https://eslint.org/docs/rules/no-useless-catch
|
|
163
|
+
'no-useless-concat': 'error', // disallow useless string concatenation https://eslint.org/docs/rules/no-useless-concat
|
|
164
|
+
'no-useless-escape': 'error', // disallow unnecessary string escaping https://eslint.org/docs/rules/no-useless-escape
|
|
165
|
+
'no-useless-return': 'error', // disallow redundant return; keywords https://eslint.org/docs/rules/no-useless-return
|
|
166
|
+
'no-void': ['error', {allowAsStatement: true}], // disallow use of void operator https://eslint.org/docs/rules/no-void
|
|
167
|
+
'no-warning-comments': [
|
|
168
|
+
'off',
|
|
169
|
+
{
|
|
170
|
+
location: 'start',
|
|
171
|
+
terms: [
|
|
172
|
+
'todo',
|
|
173
|
+
'fixme',
|
|
174
|
+
'xxx'
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
], // disallow usage of configurable warning terms in comments: e.g. todo https://eslint.org/docs/rules/no-warning-comments
|
|
178
|
+
'no-with': 'error', // disallow use of the with statement https://eslint.org/docs/rules/no-with
|
|
179
|
+
'prefer-named-capture-group': 'off', // Suggest using named capture group in regular expression https://eslint.org/docs/rules/prefer-named-capture-group
|
|
180
|
+
'prefer-promise-reject-errors': ['error', {allowEmptyReject: true}], // require using Error objects as Promise rejection reasons https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
181
|
+
'prefer-regex-literals': 'error', // https://eslint.org/docs/rules/prefer-regex-literals
|
|
182
|
+
radix: ['error', 'always'], // require use of the second argument for parseInt() https://eslint.org/docs/rules/radix
|
|
183
|
+
'require-await': 'off', // require `await` in `async function` (note: this is a horrible rule that should never be used) https://eslint.org/docs/rules/require-await
|
|
184
|
+
'require-unicode-regexp': 'error', // Enforce the use of u flag on RegExp https://eslint.org/docs/rules/require-unicode-regexp
|
|
185
|
+
'vars-on-top': 'error', // requires to declare all vars on top of their containing scope https://eslint.org/docs/rules/vars-on-top
|
|
186
|
+
'wrap-iife': [
|
|
187
|
+
'error',
|
|
188
|
+
'outside',
|
|
189
|
+
{functionPrototypeMethods: false}
|
|
190
|
+
], // require immediate function invocation to be wrapped in parentheses https://eslint.org/docs/rules/wrap-iife.html
|
|
191
|
+
yoda: 'error' // require or disallow Yoda conditions https://eslint.org/docs/rules/yoda
|
|
192
|
+
}
|
|
193
|
+
};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/* eslint-disable no-inline-comments */
|
|
2
|
+
module.exports = {
|
|
3
|
+
rules: {
|
|
4
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
5
|
+
'@typescript-eslint/array-type': ['error', {default: 'array'}],
|
|
6
|
+
'@typescript-eslint/ban-types': 'error',
|
|
7
|
+
'@typescript-eslint/brace-style': ['error', '1tbs', {allowSingleLine: false}],
|
|
8
|
+
'@typescript-eslint/class-literal-property-style': 'error',
|
|
9
|
+
'@typescript-eslint/comma-dangle': ['error', 'never'],
|
|
10
|
+
'@typescript-eslint/comma-spacing': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
after: true,
|
|
14
|
+
before: false
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
'@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
|
|
18
|
+
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
19
|
+
'@typescript-eslint/consistent-type-assertions': ['error', {assertionStyle: 'as'}],
|
|
20
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
21
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
22
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
23
|
+
'error',
|
|
24
|
+
{
|
|
25
|
+
disallowTypeAnnotations: true,
|
|
26
|
+
prefer: 'type-imports'
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
30
|
+
'@typescript-eslint/dot-notation': ['error', {allowKeywords: true}],
|
|
31
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
32
|
+
'@typescript-eslint/explicit-member-accessibility': ['error', {accessibility: 'no-public'}],
|
|
33
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
34
|
+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
35
|
+
'@typescript-eslint/indent': 'off',
|
|
36
|
+
'@typescript-eslint/init-declarations': 'off',
|
|
37
|
+
'@typescript-eslint/keyword-spacing': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
after: true,
|
|
41
|
+
before: true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
'@typescript-eslint/lines-between-class-members': [
|
|
45
|
+
'error',
|
|
46
|
+
'always',
|
|
47
|
+
{exceptAfterSingleLine: false}
|
|
48
|
+
],
|
|
49
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
multiline: {
|
|
53
|
+
delimiter: 'semi',
|
|
54
|
+
requireLast: true
|
|
55
|
+
},
|
|
56
|
+
multilineDetection: 'brackets',
|
|
57
|
+
singleline: {
|
|
58
|
+
delimiter: 'semi',
|
|
59
|
+
requireLast: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
'@typescript-eslint/member-ordering': [
|
|
64
|
+
'error',
|
|
65
|
+
{
|
|
66
|
+
default: {order: 'as-written'},
|
|
67
|
+
interfaces: {order: 'alphabetically-case-insensitive'},
|
|
68
|
+
typeLiterals: {order: 'alphabetically-case-insensitive'}
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
'@typescript-eslint/method-signature-style': ['error', 'method'],
|
|
72
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
73
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
74
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'warn',
|
|
75
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
76
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
77
|
+
'@typescript-eslint/no-duplicate-enum-values': 'warn',
|
|
78
|
+
'@typescript-eslint/no-dynamic-delete': 'off',
|
|
79
|
+
'@typescript-eslint/no-empty-function': ['error', {allow: ['arrowFunctions', 'methods', 'asyncMethods']}],
|
|
80
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
81
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
82
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
83
|
+
'@typescript-eslint/no-extra-semi': 'error',
|
|
84
|
+
'@typescript-eslint/no-extraneous-class': 'off',
|
|
85
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
86
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
87
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
88
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
89
|
+
'@typescript-eslint/no-invalid-this': 'error',
|
|
90
|
+
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
91
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
92
|
+
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
93
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
94
|
+
'@typescript-eslint/no-misused-promises': ['error', {checksVoidReturn: false}],
|
|
95
|
+
'@typescript-eslint/no-namespace': [
|
|
96
|
+
'error',
|
|
97
|
+
{
|
|
98
|
+
allowDeclarations: true,
|
|
99
|
+
allowDefinitionFiles: true
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
103
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
104
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
105
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
106
|
+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
107
|
+
'@typescript-eslint/no-require-imports': 'warn',
|
|
108
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
109
|
+
'@typescript-eslint/no-this-alias': ['error', {allowedNames: ['self']}],
|
|
110
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
111
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
112
|
+
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
113
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
114
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
|
115
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
116
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
117
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
118
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
119
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
120
|
+
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
121
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
122
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
123
|
+
'error',
|
|
124
|
+
{
|
|
125
|
+
allowShortCircuit: true,
|
|
126
|
+
allowTaggedTemplates: false,
|
|
127
|
+
allowTernary: true
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
131
|
+
'@typescript-eslint/no-use-before-define': [
|
|
132
|
+
'error',
|
|
133
|
+
{
|
|
134
|
+
classes: false,
|
|
135
|
+
functions: false,
|
|
136
|
+
variables: false
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
140
|
+
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
141
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
142
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
|
143
|
+
'@typescript-eslint/object-curly-spacing': ['error', 'never'],
|
|
144
|
+
'@typescript-eslint/padding-line-between-statements': [
|
|
145
|
+
'error',
|
|
146
|
+
{
|
|
147
|
+
blankLine: 'always',
|
|
148
|
+
next: '*',
|
|
149
|
+
prev: ['const', 'let', 'var']
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
blankLine: 'any',
|
|
153
|
+
next: ['const', 'let', 'var'],
|
|
154
|
+
prev: ['const', 'let', 'var']
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
158
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
159
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
160
|
+
'@typescript-eslint/prefer-function-type': 'off',
|
|
161
|
+
'@typescript-eslint/prefer-includes': 'error',
|
|
162
|
+
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
163
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
164
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
165
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
166
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
167
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
168
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
169
|
+
'@typescript-eslint/prefer-return-this-type': 'error',
|
|
170
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
171
|
+
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
172
|
+
'@typescript-eslint/promise-function-async': 'error',
|
|
173
|
+
'@typescript-eslint/quotes': [
|
|
174
|
+
'error',
|
|
175
|
+
'single',
|
|
176
|
+
{avoidEscape: true}
|
|
177
|
+
],
|
|
178
|
+
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
179
|
+
'@typescript-eslint/require-await': 'error',
|
|
180
|
+
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
181
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
182
|
+
'@typescript-eslint/return-await': 'error',
|
|
183
|
+
'@typescript-eslint/semi': 'error',
|
|
184
|
+
'@typescript-eslint/sort-type-constituents': ['error', {checkIntersections: false}],
|
|
185
|
+
'@typescript-eslint/space-before-blocks': ['error', 'always'],
|
|
186
|
+
'@typescript-eslint/space-before-function-paren': [
|
|
187
|
+
'error',
|
|
188
|
+
{
|
|
189
|
+
anonymous: 'never',
|
|
190
|
+
asyncArrow: 'always',
|
|
191
|
+
named: 'never'
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
'@typescript-eslint/space-infix-ops': 'error',
|
|
195
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
196
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
197
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
198
|
+
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
199
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
200
|
+
'brace-style': 'off',
|
|
201
|
+
'comma-dangle': 'off',
|
|
202
|
+
'comma-spacing': 'off',
|
|
203
|
+
'default-param-last': 'off',
|
|
204
|
+
'dot-notation': 'off',
|
|
205
|
+
'func-call-spacing': 'off',
|
|
206
|
+
'jsdoc/require-param-type': 'off',
|
|
207
|
+
'jsdoc/require-returns-type': 'off',
|
|
208
|
+
'keyword-spacing': 'off',
|
|
209
|
+
'lines-between-class-members': 'off',
|
|
210
|
+
'no-array-constructor': 'off',
|
|
211
|
+
'no-dupe-class-members': 'off',
|
|
212
|
+
'no-empty-function': 'off',
|
|
213
|
+
'no-extra-semi': 'off',
|
|
214
|
+
'no-implied-eval': 'off',
|
|
215
|
+
'no-invalid-this': 'off',
|
|
216
|
+
'no-loop-func': 'off',
|
|
217
|
+
'no-loss-of-precision': 'off',
|
|
218
|
+
'no-redeclare': 'off',
|
|
219
|
+
'no-return-await': 'off',
|
|
220
|
+
'no-shadow': 'off',
|
|
221
|
+
'no-throw-literal': 'off',
|
|
222
|
+
'no-undefined': 'off',
|
|
223
|
+
'no-unused-expressions': 'off',
|
|
224
|
+
'no-unused-vars': 'off',
|
|
225
|
+
'no-use-before-define': 'off',
|
|
226
|
+
'no-useless-constructor': 'off',
|
|
227
|
+
'object-curly-spacing': 'off',
|
|
228
|
+
'padding-line-between-statements': 'off',
|
|
229
|
+
quotes: 'off',
|
|
230
|
+
'react/default-props-match-prop-types': 'off',
|
|
231
|
+
'react/require-default-props': 'off',
|
|
232
|
+
semi: 'off',
|
|
233
|
+
'space-before-blocks': 'off',
|
|
234
|
+
'space-before-function-paren': 'off',
|
|
235
|
+
'space-infix-ops': 'off'
|
|
236
|
+
}
|
|
237
|
+
};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/* eslint-disable no-inline-comments */
|
|
2
|
+
module.exports = {
|
|
3
|
+
rules: {
|
|
4
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
5
|
+
'@typescript-eslint/array-type': ['error', {default: 'array'}],
|
|
6
|
+
'@typescript-eslint/ban-types': 'error',
|
|
7
|
+
'@typescript-eslint/brace-style': ['error', '1tbs', {allowSingleLine: false}],
|
|
8
|
+
'@typescript-eslint/class-literal-property-style': 'error',
|
|
9
|
+
'@typescript-eslint/comma-dangle': ['error', 'never'],
|
|
10
|
+
'@typescript-eslint/comma-spacing': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
after: true,
|
|
14
|
+
before: false
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
'@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
|
|
18
|
+
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
19
|
+
'@typescript-eslint/consistent-type-assertions': ['error', {assertionStyle: 'as'}],
|
|
20
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
21
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
22
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
23
|
+
'error',
|
|
24
|
+
{
|
|
25
|
+
disallowTypeAnnotations: true,
|
|
26
|
+
prefer: 'type-imports'
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
30
|
+
'@typescript-eslint/dot-notation': ['error', {allowKeywords: true}],
|
|
31
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
32
|
+
'@typescript-eslint/explicit-member-accessibility': ['error', {accessibility: 'no-public'}],
|
|
33
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
34
|
+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
35
|
+
'@typescript-eslint/indent': 'off',
|
|
36
|
+
'@typescript-eslint/init-declarations': 'off',
|
|
37
|
+
'@typescript-eslint/keyword-spacing': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
after: true,
|
|
41
|
+
before: true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
'@typescript-eslint/lines-between-class-members': [
|
|
45
|
+
'error',
|
|
46
|
+
'always',
|
|
47
|
+
{exceptAfterSingleLine: false}
|
|
48
|
+
],
|
|
49
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
multiline: {
|
|
53
|
+
delimiter: 'semi',
|
|
54
|
+
requireLast: true
|
|
55
|
+
},
|
|
56
|
+
multilineDetection: 'brackets',
|
|
57
|
+
singleline: {
|
|
58
|
+
delimiter: 'semi',
|
|
59
|
+
requireLast: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
'@typescript-eslint/member-ordering': [
|
|
64
|
+
'error',
|
|
65
|
+
{
|
|
66
|
+
default: {order: 'as-written'},
|
|
67
|
+
interfaces: {order: 'alphabetically-case-insensitive'},
|
|
68
|
+
typeLiterals: {order: 'alphabetically-case-insensitive'}
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
'@typescript-eslint/method-signature-style': ['error', 'method'],
|
|
72
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
73
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
74
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'warn',
|
|
75
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
76
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
77
|
+
'@typescript-eslint/no-duplicate-enum-values': 'warn',
|
|
78
|
+
'@typescript-eslint/no-dynamic-delete': 'off',
|
|
79
|
+
'@typescript-eslint/no-empty-function': ['error', {allow: ['arrowFunctions', 'methods', 'asyncMethods']}],
|
|
80
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
81
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
82
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
83
|
+
'@typescript-eslint/no-extra-semi': 'error',
|
|
84
|
+
'@typescript-eslint/no-extraneous-class': 'off',
|
|
85
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
86
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
87
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
88
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
89
|
+
'@typescript-eslint/no-invalid-this': 'error',
|
|
90
|
+
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
91
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
92
|
+
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
93
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
94
|
+
'@typescript-eslint/no-misused-promises': ['error', {checksVoidReturn: false}],
|
|
95
|
+
'@typescript-eslint/no-namespace': [
|
|
96
|
+
'error',
|
|
97
|
+
{
|
|
98
|
+
allowDeclarations: true,
|
|
99
|
+
allowDefinitionFiles: true
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
103
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
104
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
105
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
106
|
+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
107
|
+
'@typescript-eslint/no-require-imports': 'warn',
|
|
108
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
109
|
+
'@typescript-eslint/no-this-alias': ['error', {allowedNames: ['self']}],
|
|
110
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
111
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
112
|
+
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
113
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
114
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
|
115
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
116
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
117
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
118
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
119
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
120
|
+
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
121
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
122
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
123
|
+
'error',
|
|
124
|
+
{
|
|
125
|
+
allowShortCircuit: true,
|
|
126
|
+
allowTaggedTemplates: false,
|
|
127
|
+
allowTernary: true
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
'@typescript-eslint/no-unused-vars': [
|
|
131
|
+
'error',
|
|
132
|
+
{
|
|
133
|
+
args: 'after-used',
|
|
134
|
+
argsIgnorePattern: '^e$',
|
|
135
|
+
caughtErrors: 'none',
|
|
136
|
+
ignoreRestSiblings: true,
|
|
137
|
+
vars: 'all'
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
'@typescript-eslint/no-use-before-define': [
|
|
141
|
+
'error',
|
|
142
|
+
{
|
|
143
|
+
classes: false,
|
|
144
|
+
functions: false,
|
|
145
|
+
variables: false
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
149
|
+
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
150
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
151
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
|
152
|
+
'@typescript-eslint/object-curly-spacing': ['error', 'never'],
|
|
153
|
+
'@typescript-eslint/padding-line-between-statements': [
|
|
154
|
+
'error',
|
|
155
|
+
{
|
|
156
|
+
blankLine: 'always',
|
|
157
|
+
next: '*',
|
|
158
|
+
prev: ['const', 'let', 'var']
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
blankLine: 'any',
|
|
162
|
+
next: ['const', 'let', 'var'],
|
|
163
|
+
prev: ['const', 'let', 'var']
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
167
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
168
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
169
|
+
'@typescript-eslint/prefer-function-type': 'off',
|
|
170
|
+
'@typescript-eslint/prefer-includes': 'error',
|
|
171
|
+
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
172
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
173
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
174
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
175
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
176
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
177
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
178
|
+
'@typescript-eslint/prefer-return-this-type': 'error',
|
|
179
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
180
|
+
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
181
|
+
'@typescript-eslint/promise-function-async': 'error',
|
|
182
|
+
'@typescript-eslint/quotes': [
|
|
183
|
+
'error',
|
|
184
|
+
'single',
|
|
185
|
+
{avoidEscape: true}
|
|
186
|
+
],
|
|
187
|
+
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
188
|
+
'@typescript-eslint/require-await': 'error',
|
|
189
|
+
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
190
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
191
|
+
'@typescript-eslint/return-await': 'error',
|
|
192
|
+
'@typescript-eslint/semi': 'error',
|
|
193
|
+
'@typescript-eslint/sort-type-constituents': ['error', {checkIntersections: false}],
|
|
194
|
+
'@typescript-eslint/space-before-blocks': ['error', 'always'],
|
|
195
|
+
'@typescript-eslint/space-before-function-paren': [
|
|
196
|
+
'error',
|
|
197
|
+
{
|
|
198
|
+
anonymous: 'never',
|
|
199
|
+
asyncArrow: 'always',
|
|
200
|
+
named: 'never'
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
'@typescript-eslint/space-infix-ops': 'error',
|
|
204
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
205
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
206
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
207
|
+
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
208
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
209
|
+
'brace-style': 'off',
|
|
210
|
+
'comma-dangle': 'off',
|
|
211
|
+
'comma-spacing': 'off',
|
|
212
|
+
'default-param-last': 'off',
|
|
213
|
+
'dot-notation': 'off',
|
|
214
|
+
'func-call-spacing': 'off',
|
|
215
|
+
'jsdoc/require-param-type': 'off',
|
|
216
|
+
'jsdoc/require-returns-type': 'off',
|
|
217
|
+
'keyword-spacing': 'off',
|
|
218
|
+
'lines-between-class-members': 'off',
|
|
219
|
+
'no-array-constructor': 'off',
|
|
220
|
+
'no-dupe-class-members': 'off',
|
|
221
|
+
'no-empty-function': 'off',
|
|
222
|
+
'no-extra-semi': 'off',
|
|
223
|
+
'no-implied-eval': 'off',
|
|
224
|
+
'no-invalid-this': 'off',
|
|
225
|
+
'no-loop-func': 'off',
|
|
226
|
+
'no-loss-of-precision': 'off',
|
|
227
|
+
'no-redeclare': 'off',
|
|
228
|
+
'no-return-await': 'off',
|
|
229
|
+
'no-shadow': 'off',
|
|
230
|
+
'no-throw-literal': 'off',
|
|
231
|
+
'no-undefined': 'off',
|
|
232
|
+
'no-unused-expressions': 'off',
|
|
233
|
+
'no-unused-vars': 'off',
|
|
234
|
+
'no-use-before-define': 'off',
|
|
235
|
+
'no-useless-constructor': 'off',
|
|
236
|
+
'object-curly-spacing': 'off',
|
|
237
|
+
'padding-line-between-statements': 'off',
|
|
238
|
+
quotes: 'off',
|
|
239
|
+
'react/default-props-match-prop-types': 'off',
|
|
240
|
+
'react/require-default-props': 'off',
|
|
241
|
+
semi: 'off',
|
|
242
|
+
'space-before-blocks': 'off',
|
|
243
|
+
'space-before-function-paren': 'off',
|
|
244
|
+
'space-infix-ops': 'off'
|
|
245
|
+
}
|
|
246
|
+
};
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.2.0](https://github.com/nfqde/eslint-config-nfq/compare/v3.1.3...v3.2.0) (2024-05-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **no-magic-numbers:** Update rules ([#58](https://github.com/nfqde/eslint-config-nfq/issues/58)) ([d278f46](https://github.com/nfqde/eslint-config-nfq/commit/d278f466fe3a66677bace22483dc0c08c1310ed0))
|
|
11
|
+
|
|
12
|
+
### [3.1.3](https://github.com/nfqde/eslint-config-nfq/compare/v3.1.2...v3.1.3) (2024-03-05)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **no-unused-vars:** fix typescript version of no-unused-vars ([#57](https://github.com/nfqde/eslint-config-nfq/issues/57)) ([9b509ec](https://github.com/nfqde/eslint-config-nfq/commit/9b509ec667314c39ef16c3236bde75f1d63ceba3))
|
|
18
|
+
|
|
5
19
|
### [3.1.2](https://github.com/nfqde/eslint-config-nfq/compare/v3.1.1...v3.1.2) (2023-12-17)
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nfq/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">= 12.0.0"
|
|
6
6
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^7.23.6",
|
|
53
53
|
"@babel/eslint-parser": "^7.23.3",
|
|
54
|
-
"@nfq/eslint-plugin": "^0.
|
|
54
|
+
"@nfq/eslint-plugin": "^0.8.0",
|
|
55
55
|
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
56
56
|
"@typescript-eslint/parser": "^6.14.0",
|
|
57
57
|
"eslint": "^8.56.0",
|
package/rules/best-practices.js
CHANGED
|
@@ -10,6 +10,8 @@ module.exports = {
|
|
|
10
10
|
ignore: [0, 1],
|
|
11
11
|
ignoreArrayIndexes: true,
|
|
12
12
|
ignoreArrays: true,
|
|
13
|
+
ignoreClassFieldInitialValues: true,
|
|
14
|
+
ignoreDefaultValues: true,
|
|
13
15
|
ignoreFunctions: ['darken', 'lighten', 'setTimeout', 'setInterval', 'spacing', 'translucify', 'wait']
|
|
14
16
|
}
|
|
15
17
|
], // disallow magic numbers http://eslint.org/docs/rules/no-magic-numbers
|
package/rules/typescript.js
CHANGED
|
@@ -127,7 +127,16 @@ module.exports = {
|
|
|
127
127
|
allowTernary: true
|
|
128
128
|
}
|
|
129
129
|
],
|
|
130
|
-
'@typescript-eslint/no-unused-vars':
|
|
130
|
+
'@typescript-eslint/no-unused-vars': [
|
|
131
|
+
'error',
|
|
132
|
+
{
|
|
133
|
+
args: 'after-used',
|
|
134
|
+
argsIgnorePattern: '^e$',
|
|
135
|
+
caughtErrors: 'none',
|
|
136
|
+
ignoreRestSiblings: true,
|
|
137
|
+
vars: 'all'
|
|
138
|
+
}
|
|
139
|
+
],
|
|
131
140
|
'@typescript-eslint/no-use-before-define': [
|
|
132
141
|
'error',
|
|
133
142
|
{
|