@nfq/eslint-config 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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', 'toFixed']
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
+ };
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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.1](https://github.com/nfqde/eslint-config-nfq/compare/v3.2.0...v3.2.1) (2024-05-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **no-magic-numbers:** update rule ([#59](https://github.com/nfqde/eslint-config-nfq/issues/59)) ([5ef4f74](https://github.com/nfqde/eslint-config-nfq/commit/5ef4f743e37d1cb914051d26d9c615cd034dd520))
11
+
5
12
  ## [3.2.0](https://github.com/nfqde/eslint-config-nfq/compare/v3.1.3...v3.2.0) (2024-05-20)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nfq/eslint-config",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
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.8.0",
54
+ "@nfq/eslint-plugin": "^0.8.1",
55
55
  "@typescript-eslint/eslint-plugin": "^6.14.0",
56
56
  "@typescript-eslint/parser": "^6.14.0",
57
57
  "eslint": "^8.56.0",
@@ -12,7 +12,7 @@ module.exports = {
12
12
  ignoreArrays: true,
13
13
  ignoreClassFieldInitialValues: true,
14
14
  ignoreDefaultValues: true,
15
- ignoreFunctions: ['darken', 'lighten', 'setTimeout', 'setInterval', 'spacing', 'translucify', 'wait']
15
+ ignoreFunctions: ['darken', 'lighten', 'setTimeout', 'setInterval', 'spacing', 'translucify', 'wait', 'toFixed']
16
16
  }
17
17
  ], // disallow magic numbers http://eslint.org/docs/rules/no-magic-numbers
18
18
  'accessor-pairs': [