eslint-config-airbnb-extended 0.0.9 → 0.1.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/CHANGELOG.md +7 -0
- package/base/index.ts +21 -0
- package/base/recommended.ts +17 -0
- package/index.ts +25 -0
- package/package.json +12 -31
- package/react/index.ts +11 -0
- package/react/recommended.ts +6 -0
- package/rules/best-practices.ts +462 -0
- package/rules/errors.ts +199 -0
- package/rules/es6.ts +224 -0
- package/rules/imports.ts +308 -0
- package/rules/node.ts +49 -0
- package/rules/react-a11y.ts +295 -0
- package/rules/react-hooks.ts +26 -0
- package/rules/react.ts +692 -0
- package/rules/strict.ts +9 -0
- package/rules/style.ts +632 -0
- package/rules/typescript.ts +312 -0
- package/rules/variables.ts +76 -0
- package/tsconfig.json +22 -0
- package/typescript/index.ts +7 -0
- package/typescript/recommended.ts +30 -0
- package/README.md +0 -1
- package/dist/base/index.d.ts +0 -841
- package/dist/base/index.js +0 -23
- package/dist/base/recommended.d.ts +0 -2
- package/dist/base/recommended.js +0 -19
- package/dist/index.d.ts +0 -2654
- package/dist/index.js +0 -29
- package/dist/react/index.d.ts +0 -1798
- package/dist/react/index.js +0 -13
- package/dist/react/recommended.d.ts +0 -2
- package/dist/react/recommended.js +0 -8
- package/dist/rules/best-practices.d.ts +0 -177
- package/dist/rules/best-practices.js +0 -379
- package/dist/rules/errors.d.ts +0 -69
- package/dist/rules/errors.js +0 -151
- package/dist/rules/es6.d.ts +0 -146
- package/dist/rules/es6.js +0 -192
- package/dist/rules/imports.d.ts +0 -157
- package/dist/rules/imports.js +0 -256
- package/dist/rules/node.d.ts +0 -90
- package/dist/rules/node.js +0 -39
- package/dist/rules/react-a11y.d.ts +0 -117
- package/dist/rules/react-a11y.js +0 -255
- package/dist/rules/react-hooks.d.ts +0 -19
- package/dist/rules/react-hooks.js +0 -57
- package/dist/rules/react.d.ts +0 -1664
- package/dist/rules/react.js +0 -586
- package/dist/rules/strict.d.ts +0 -7
- package/dist/rules/strict.js +0 -9
- package/dist/rules/style.d.ts +0 -320
- package/dist/rules/style.js +0 -530
- package/dist/rules/typescript.d.ts +0 -4
- package/dist/rules/typescript.js +0 -264
- package/dist/rules/variables.d.ts +0 -35
- package/dist/rules/variables.js +0 -65
- package/dist/typescript/index.d.ts +0 -5
- package/dist/typescript/index.js +0 -9
- package/dist/typescript/recommended.d.ts +0 -6
- package/dist/typescript/recommended.js +0 -62
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -4
package/CHANGELOG.md
ADDED
package/base/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import bestPractices from '@/rules/best-practices';
|
|
2
|
+
import errors from '@/rules/errors';
|
|
3
|
+
import es6 from '@/rules/es6';
|
|
4
|
+
import imports from '@/rules/imports';
|
|
5
|
+
import node from '@/rules/node';
|
|
6
|
+
import strict from '@/rules/strict';
|
|
7
|
+
import style from '@/rules/style';
|
|
8
|
+
import variables from '@/rules/variables';
|
|
9
|
+
|
|
10
|
+
import type { Linter } from 'eslint';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
bestPractices,
|
|
14
|
+
errors,
|
|
15
|
+
es6,
|
|
16
|
+
imports,
|
|
17
|
+
node,
|
|
18
|
+
strict,
|
|
19
|
+
style,
|
|
20
|
+
variables,
|
|
21
|
+
} satisfies Record<string, Linter.Config>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import base from '@/base';
|
|
2
|
+
|
|
3
|
+
import type { Linter } from 'eslint';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
...Object.values(base),
|
|
7
|
+
{
|
|
8
|
+
name: 'airbnb/config/language-configurations',
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 2018,
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
rules: {},
|
|
16
|
+
},
|
|
17
|
+
] satisfies Linter.Config[];
|
package/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import base from '@/base';
|
|
2
|
+
import baseRecommended from '@/base/recommended';
|
|
3
|
+
import react from '@/react';
|
|
4
|
+
import reactRecommended from '@/react/recommended';
|
|
5
|
+
import typescript from '@/typescript';
|
|
6
|
+
import typescriptRecommended from '@/typescript/recommended';
|
|
7
|
+
|
|
8
|
+
export const rules = {
|
|
9
|
+
react,
|
|
10
|
+
base,
|
|
11
|
+
typescript,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const configs = {
|
|
15
|
+
base: {
|
|
16
|
+
recommended: baseRecommended,
|
|
17
|
+
'typescript-only': typescriptRecommended.base,
|
|
18
|
+
typescript: [...baseRecommended, ...typescriptRecommended.base],
|
|
19
|
+
},
|
|
20
|
+
react: {
|
|
21
|
+
recommended: reactRecommended,
|
|
22
|
+
'typescript-only': typescriptRecommended.react,
|
|
23
|
+
typescript: [...reactRecommended, ...typescriptRecommended.react],
|
|
24
|
+
},
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -22,49 +22,26 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/NishargShah/eslint-config-airbnb-extended.git"
|
|
25
|
+
"url": "https://github.com/NishargShah/eslint-config-airbnb-extended.git",
|
|
26
|
+
"directory": "packages/eslint-config-airbnb-extended"
|
|
26
27
|
},
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"author": "Nisharg Shah <nishargshah3101@gmail.com>",
|
|
29
30
|
"type": "commonjs",
|
|
30
31
|
"main": "dist/index.js",
|
|
31
32
|
"types": "dist/index.d.ts",
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsc",
|
|
34
|
-
"format:check": "prettier . --check",
|
|
35
|
-
"format:fix": "prettier . --write",
|
|
36
|
-
"inspector": "pnpm dlx @eslint/config-inspector",
|
|
37
|
-
"lint": "eslint .",
|
|
38
|
-
"lint:fix": "pnpm --silent lint --fix",
|
|
39
|
-
"prepare": "husky && pnpm ts-patch install -s",
|
|
40
|
-
"prepublishOnly": "pnpm build",
|
|
41
|
-
"script:lint": "bash -e ./scripts/lint.sh",
|
|
42
|
-
"typecheck": "tsc --noEmit"
|
|
43
|
-
},
|
|
44
33
|
"dependencies": {
|
|
45
34
|
"confusing-browser-globals": "^1.0.11",
|
|
46
35
|
"globals": "^16.0.0"
|
|
47
36
|
},
|
|
48
37
|
"devDependencies": {
|
|
49
|
-
"@eslint/compat": "^1.2.8",
|
|
50
|
-
"@eslint/js": "^9.23.0",
|
|
51
38
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
52
39
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
53
40
|
"eslint": "^9.23.0",
|
|
54
|
-
"eslint-config-prettier": "^10.1.1",
|
|
55
|
-
"eslint-import-resolver-typescript": "^4.3.1",
|
|
56
41
|
"eslint-plugin-import": "^2.31.0",
|
|
57
42
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
58
|
-
"eslint-plugin-prettier": "^5.2.6",
|
|
59
|
-
"eslint-plugin-promise": "^7.2.1",
|
|
60
43
|
"eslint-plugin-react": "^7.37.4",
|
|
61
44
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
62
|
-
"eslint-plugin-unicorn": "^58.0.0",
|
|
63
|
-
"eslint-plugin-unused-imports": "^4.1.4",
|
|
64
|
-
"husky": "^9.1.7",
|
|
65
|
-
"lint-staged": "^15.5.0",
|
|
66
|
-
"prettier": "^3.5.3",
|
|
67
|
-
"prettier-plugin-packagejson": "^2.5.10",
|
|
68
45
|
"ts-patch": "^3.3.0",
|
|
69
46
|
"tsconfig-paths": "^4.2.0",
|
|
70
47
|
"typescript": "^5.8.2",
|
|
@@ -76,7 +53,8 @@
|
|
|
76
53
|
"eslint-plugin-import": "2.x",
|
|
77
54
|
"eslint-plugin-jsx-a11y": "6.x",
|
|
78
55
|
"eslint-plugin-react": "7.x",
|
|
79
|
-
"eslint-plugin-react-hooks": "5.x"
|
|
56
|
+
"eslint-plugin-react-hooks": "5.x",
|
|
57
|
+
"typescript-eslint": "8.x"
|
|
80
58
|
},
|
|
81
59
|
"peerDependenciesMeta": {
|
|
82
60
|
"eslint-plugin-jsx-a11y": {
|
|
@@ -87,10 +65,13 @@
|
|
|
87
65
|
},
|
|
88
66
|
"eslint-plugin-react-hooks": {
|
|
89
67
|
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"typescript-eslint": {
|
|
70
|
+
"optional": true
|
|
90
71
|
}
|
|
91
72
|
},
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
"
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsc",
|
|
75
|
+
"typecheck": "tsc --noEmit"
|
|
95
76
|
}
|
|
96
|
-
}
|
|
77
|
+
}
|
package/react/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import react from '@/rules/react';
|
|
2
|
+
import reactA11y from '@/rules/react-a11y';
|
|
3
|
+
import reactHooks from '@/rules/react-hooks';
|
|
4
|
+
|
|
5
|
+
import type { Linter } from 'eslint';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
react,
|
|
9
|
+
reactA11y,
|
|
10
|
+
reactHooks,
|
|
11
|
+
} satisfies Record<string, Linter.Config>;
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'airbnb/config/best-practices',
|
|
5
|
+
rules: {
|
|
6
|
+
// enforces getter/setter pairs in objects
|
|
7
|
+
// https://eslint.org/docs/rules/accessor-pairs
|
|
8
|
+
'accessor-pairs': 'off',
|
|
9
|
+
|
|
10
|
+
// enforces return statements in callbacks of array's methods
|
|
11
|
+
// https://eslint.org/docs/rules/array-callback-return
|
|
12
|
+
'array-callback-return': ['error', { allowImplicit: true }],
|
|
13
|
+
|
|
14
|
+
// treat var statements as if they were block scoped
|
|
15
|
+
// https://eslint.org/docs/rules/block-scoped-var
|
|
16
|
+
'block-scoped-var': 'error',
|
|
17
|
+
|
|
18
|
+
// specify the maximum cyclomatic complexity allowed in a program
|
|
19
|
+
// https://eslint.org/docs/rules/complexity
|
|
20
|
+
complexity: ['off', 20],
|
|
21
|
+
|
|
22
|
+
// enforce that class methods use "this"
|
|
23
|
+
// https://eslint.org/docs/rules/class-methods-use-this
|
|
24
|
+
'class-methods-use-this': [
|
|
25
|
+
'error',
|
|
26
|
+
{
|
|
27
|
+
exceptMethods: [],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
// require return statements to either always or never specify values
|
|
32
|
+
// https://eslint.org/docs/rules/consistent-return
|
|
33
|
+
'consistent-return': 'error',
|
|
34
|
+
|
|
35
|
+
// specify curly brace conventions for all control statements
|
|
36
|
+
// https://eslint.org/docs/rules/curly
|
|
37
|
+
curly: ['error', 'multi-line'], // multiline
|
|
38
|
+
|
|
39
|
+
// require default case in switch statements
|
|
40
|
+
// https://eslint.org/docs/rules/default-case
|
|
41
|
+
'default-case': ['error', { commentPattern: '^no default$' }],
|
|
42
|
+
|
|
43
|
+
// Enforce default clauses in switch statements to be last
|
|
44
|
+
// https://eslint.org/docs/rules/default-case-last
|
|
45
|
+
'default-case-last': 'error',
|
|
46
|
+
|
|
47
|
+
// https://eslint.org/docs/rules/default-param-last
|
|
48
|
+
'default-param-last': 'error',
|
|
49
|
+
|
|
50
|
+
// encourages use of dot notation whenever possible
|
|
51
|
+
// https://eslint.org/docs/rules/dot-notation
|
|
52
|
+
'dot-notation': ['error', { allowKeywords: true }],
|
|
53
|
+
|
|
54
|
+
// enforces consistent newlines before or after dots
|
|
55
|
+
// https://eslint.org/docs/rules/dot-location
|
|
56
|
+
'dot-location': ['error', 'property'],
|
|
57
|
+
|
|
58
|
+
// require the use of === and !==
|
|
59
|
+
// https://eslint.org/docs/rules/eqeqeq
|
|
60
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
61
|
+
|
|
62
|
+
// Require grouped accessor pairs in object literals and classes
|
|
63
|
+
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
64
|
+
'grouped-accessor-pairs': 'error',
|
|
65
|
+
|
|
66
|
+
// make sure for-in loops have an if statement
|
|
67
|
+
// https://eslint.org/docs/rules/guard-for-in
|
|
68
|
+
'guard-for-in': 'error',
|
|
69
|
+
|
|
70
|
+
// enforce a maximum number of classes per file
|
|
71
|
+
// https://eslint.org/docs/rules/max-classes-per-file
|
|
72
|
+
'max-classes-per-file': ['error', 1],
|
|
73
|
+
|
|
74
|
+
// disallow the use of alert, confirm, and prompt
|
|
75
|
+
// https://eslint.org/docs/rules/no-alert
|
|
76
|
+
// TODO: enable, semver-major
|
|
77
|
+
'no-alert': 'warn',
|
|
78
|
+
|
|
79
|
+
// disallow use of arguments.caller or arguments.callee
|
|
80
|
+
// https://eslint.org/docs/rules/no-caller
|
|
81
|
+
'no-caller': 'error',
|
|
82
|
+
|
|
83
|
+
// disallow lexical declarations in case/default clauses
|
|
84
|
+
// https://eslint.org/docs/rules/no-case-declarations
|
|
85
|
+
'no-case-declarations': 'error',
|
|
86
|
+
|
|
87
|
+
// Disallow returning value in constructor
|
|
88
|
+
// https://eslint.org/docs/rules/no-constructor-return
|
|
89
|
+
'no-constructor-return': 'error',
|
|
90
|
+
|
|
91
|
+
// disallow division operators explicitly at beginning of regular expression
|
|
92
|
+
// https://eslint.org/docs/rules/no-div-regex
|
|
93
|
+
'no-div-regex': 'off',
|
|
94
|
+
|
|
95
|
+
// disallow else after a return in an if
|
|
96
|
+
// https://eslint.org/docs/rules/no-else-return
|
|
97
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
98
|
+
|
|
99
|
+
// disallow empty functions, except for standalone funcs/arrows
|
|
100
|
+
// https://eslint.org/docs/rules/no-empty-function
|
|
101
|
+
'no-empty-function': [
|
|
102
|
+
'error',
|
|
103
|
+
{
|
|
104
|
+
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
// disallow empty destructuring patterns
|
|
109
|
+
// https://eslint.org/docs/rules/no-empty-pattern
|
|
110
|
+
'no-empty-pattern': 'error',
|
|
111
|
+
|
|
112
|
+
// Disallow empty static blocks
|
|
113
|
+
// https://eslint.org/docs/latest/rules/no-empty-static-block
|
|
114
|
+
// TODO: semver-major, enable
|
|
115
|
+
'no-empty-static-block': 'off',
|
|
116
|
+
|
|
117
|
+
// disallow comparisons to null without a type-checking operator
|
|
118
|
+
// https://eslint.org/docs/rules/no-eq-null
|
|
119
|
+
'no-eq-null': 'off',
|
|
120
|
+
|
|
121
|
+
// disallow use of eval()
|
|
122
|
+
// https://eslint.org/docs/rules/no-eval
|
|
123
|
+
'no-eval': 'error',
|
|
124
|
+
|
|
125
|
+
// disallow adding to native types
|
|
126
|
+
// https://eslint.org/docs/rules/no-extend-native
|
|
127
|
+
'no-extend-native': 'error',
|
|
128
|
+
|
|
129
|
+
// disallow unnecessary function binding
|
|
130
|
+
// https://eslint.org/docs/rules/no-extra-bind
|
|
131
|
+
'no-extra-bind': 'error',
|
|
132
|
+
|
|
133
|
+
// disallow Unnecessary Labels
|
|
134
|
+
// https://eslint.org/docs/rules/no-extra-label
|
|
135
|
+
'no-extra-label': 'error',
|
|
136
|
+
|
|
137
|
+
// disallow fallthrough of case statements
|
|
138
|
+
// https://eslint.org/docs/rules/no-fallthrough
|
|
139
|
+
'no-fallthrough': 'error',
|
|
140
|
+
|
|
141
|
+
// disallow the use of leading or trailing decimal points in numeric literals
|
|
142
|
+
// https://eslint.org/docs/rules/no-floating-decimal
|
|
143
|
+
'no-floating-decimal': 'error',
|
|
144
|
+
|
|
145
|
+
// disallow reassignments of native objects or read-only globals
|
|
146
|
+
// https://eslint.org/docs/rules/no-global-assign
|
|
147
|
+
'no-global-assign': ['error', { exceptions: [] }],
|
|
148
|
+
|
|
149
|
+
// deprecated in favor of no-global-assign
|
|
150
|
+
// https://eslint.org/docs/rules/no-native-reassign
|
|
151
|
+
'no-native-reassign': 'off',
|
|
152
|
+
|
|
153
|
+
// disallow implicit type conversions
|
|
154
|
+
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
155
|
+
'no-implicit-coercion': [
|
|
156
|
+
'off',
|
|
157
|
+
{
|
|
158
|
+
boolean: false,
|
|
159
|
+
number: true,
|
|
160
|
+
string: true,
|
|
161
|
+
allow: [],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
|
|
165
|
+
// disallow var and named functions in global scope
|
|
166
|
+
// https://eslint.org/docs/rules/no-implicit-globals
|
|
167
|
+
'no-implicit-globals': 'off',
|
|
168
|
+
|
|
169
|
+
// disallow use of eval()-like methods
|
|
170
|
+
// https://eslint.org/docs/rules/no-implied-eval
|
|
171
|
+
'no-implied-eval': 'error',
|
|
172
|
+
|
|
173
|
+
// disallow this keywords outside of classes or class-like objects
|
|
174
|
+
// https://eslint.org/docs/rules/no-invalid-this
|
|
175
|
+
'no-invalid-this': 'off',
|
|
176
|
+
|
|
177
|
+
// disallow usage of __iterator__ property
|
|
178
|
+
// https://eslint.org/docs/rules/no-iterator
|
|
179
|
+
'no-iterator': 'error',
|
|
180
|
+
|
|
181
|
+
// disallow use of labels for anything other than loops and switches
|
|
182
|
+
// https://eslint.org/docs/rules/no-labels
|
|
183
|
+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
184
|
+
|
|
185
|
+
// disallow unnecessary nested blocks
|
|
186
|
+
// https://eslint.org/docs/rules/no-lone-blocks
|
|
187
|
+
'no-lone-blocks': 'error',
|
|
188
|
+
|
|
189
|
+
// disallow creation of functions within loops
|
|
190
|
+
// https://eslint.org/docs/rules/no-loop-func
|
|
191
|
+
'no-loop-func': 'error',
|
|
192
|
+
|
|
193
|
+
// disallow magic numbers
|
|
194
|
+
// https://eslint.org/docs/rules/no-magic-numbers
|
|
195
|
+
'no-magic-numbers': [
|
|
196
|
+
'off',
|
|
197
|
+
{
|
|
198
|
+
ignore: [],
|
|
199
|
+
ignoreArrayIndexes: true,
|
|
200
|
+
enforceConst: true,
|
|
201
|
+
detectObjects: false,
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
|
|
205
|
+
// disallow use of multiple spaces
|
|
206
|
+
// https://eslint.org/docs/rules/no-multi-spaces
|
|
207
|
+
'no-multi-spaces': [
|
|
208
|
+
'error',
|
|
209
|
+
{
|
|
210
|
+
ignoreEOLComments: false,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
|
|
214
|
+
// disallow use of multiline strings
|
|
215
|
+
// https://eslint.org/docs/rules/no-multi-str
|
|
216
|
+
'no-multi-str': 'error',
|
|
217
|
+
|
|
218
|
+
// disallow use of new operator when not part of the assignment or comparison
|
|
219
|
+
// https://eslint.org/docs/rules/no-new
|
|
220
|
+
'no-new': 'error',
|
|
221
|
+
|
|
222
|
+
// disallow use of new operator for Function object
|
|
223
|
+
// https://eslint.org/docs/rules/no-new-func
|
|
224
|
+
'no-new-func': 'error',
|
|
225
|
+
|
|
226
|
+
// disallows creating new instances of String, Number, and Boolean
|
|
227
|
+
// https://eslint.org/docs/rules/no-new-wrappers
|
|
228
|
+
'no-new-wrappers': 'error',
|
|
229
|
+
|
|
230
|
+
// Disallow \8 and \9 escape sequences in string literals
|
|
231
|
+
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
232
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
233
|
+
|
|
234
|
+
// Disallow calls to the Object constructor without an argument
|
|
235
|
+
// https://eslint.org/docs/latest/rules/no-object-constructor
|
|
236
|
+
// TODO: enable, semver-major
|
|
237
|
+
'no-object-constructor': 'off',
|
|
238
|
+
|
|
239
|
+
// disallow use of (old style) octal literals
|
|
240
|
+
// https://eslint.org/docs/rules/no-octal
|
|
241
|
+
'no-octal': 'error',
|
|
242
|
+
|
|
243
|
+
// disallow use of octal escape sequences in string literals, such as
|
|
244
|
+
// var foo = 'Copyright \251';
|
|
245
|
+
// https://eslint.org/docs/rules/no-octal-escape
|
|
246
|
+
'no-octal-escape': 'error',
|
|
247
|
+
|
|
248
|
+
// disallow reassignment of function parameters
|
|
249
|
+
// disallow parameter object manipulation except for specific exclusions
|
|
250
|
+
// rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
251
|
+
'no-param-reassign': [
|
|
252
|
+
'error',
|
|
253
|
+
{
|
|
254
|
+
props: true,
|
|
255
|
+
ignorePropertyModificationsFor: [
|
|
256
|
+
'acc', // for reduce accumulators
|
|
257
|
+
'accumulator', // for reduce accumulators
|
|
258
|
+
'e', // for e.returnvalue
|
|
259
|
+
'ctx', // for Koa routing
|
|
260
|
+
'context', // for Koa routing
|
|
261
|
+
'req', // for Express requests
|
|
262
|
+
'request', // for Express requests
|
|
263
|
+
'res', // for Express responses
|
|
264
|
+
'response', // for Express responses
|
|
265
|
+
'$scope', // for Angular 1 scopes
|
|
266
|
+
'staticContext', // for ReactRouter context
|
|
267
|
+
],
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
|
|
271
|
+
// disallow usage of __proto__ property
|
|
272
|
+
// https://eslint.org/docs/rules/no-proto
|
|
273
|
+
'no-proto': 'error',
|
|
274
|
+
|
|
275
|
+
// disallow declaring the same variable more than once
|
|
276
|
+
// https://eslint.org/docs/rules/no-redeclare
|
|
277
|
+
'no-redeclare': 'error',
|
|
278
|
+
|
|
279
|
+
// disallow certain object properties
|
|
280
|
+
// https://eslint.org/docs/rules/no-restricted-properties
|
|
281
|
+
'no-restricted-properties': [
|
|
282
|
+
'error',
|
|
283
|
+
{
|
|
284
|
+
object: 'arguments',
|
|
285
|
+
property: 'callee',
|
|
286
|
+
message: 'arguments.callee is deprecated',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
object: 'global',
|
|
290
|
+
property: 'isFinite',
|
|
291
|
+
message: 'Please use Number.isFinite instead',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
object: 'self',
|
|
295
|
+
property: 'isFinite',
|
|
296
|
+
message: 'Please use Number.isFinite instead',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
object: 'window',
|
|
300
|
+
property: 'isFinite',
|
|
301
|
+
message: 'Please use Number.isFinite instead',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
object: 'global',
|
|
305
|
+
property: 'isNaN',
|
|
306
|
+
message: 'Please use Number.isNaN instead',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
object: 'self',
|
|
310
|
+
property: 'isNaN',
|
|
311
|
+
message: 'Please use Number.isNaN instead',
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
object: 'window',
|
|
315
|
+
property: 'isNaN',
|
|
316
|
+
message: 'Please use Number.isNaN instead',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
property: '__defineGetter__',
|
|
320
|
+
message: 'Please use Object.defineProperty instead.',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
property: '__defineSetter__',
|
|
324
|
+
message: 'Please use Object.defineProperty instead.',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
object: 'Math',
|
|
328
|
+
property: 'pow',
|
|
329
|
+
message: 'Use the exponentiation operator (**) instead.',
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
|
|
333
|
+
// disallow use of assignment in return statement
|
|
334
|
+
// https://eslint.org/docs/rules/no-return-assign
|
|
335
|
+
'no-return-assign': ['error', 'always'],
|
|
336
|
+
|
|
337
|
+
// disallow redundant `return await`
|
|
338
|
+
// https://eslint.org/docs/rules/no-return-await
|
|
339
|
+
'no-return-await': 'error',
|
|
340
|
+
|
|
341
|
+
// disallow use of `javascript:` urls.
|
|
342
|
+
// https://eslint.org/docs/rules/no-script-url
|
|
343
|
+
'no-script-url': 'error',
|
|
344
|
+
|
|
345
|
+
// disallow self assignment
|
|
346
|
+
// https://eslint.org/docs/rules/no-self-assign
|
|
347
|
+
'no-self-assign': [
|
|
348
|
+
'error',
|
|
349
|
+
{
|
|
350
|
+
props: true,
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
|
|
354
|
+
// disallow comparisons where both sides are exactly the same
|
|
355
|
+
// https://eslint.org/docs/rules/no-self-compare
|
|
356
|
+
'no-self-compare': 'error',
|
|
357
|
+
|
|
358
|
+
// disallow use of comma operator
|
|
359
|
+
// https://eslint.org/docs/rules/no-sequences
|
|
360
|
+
'no-sequences': 'error',
|
|
361
|
+
|
|
362
|
+
// restrict what can be thrown as an exception
|
|
363
|
+
// https://eslint.org/docs/rules/no-throw-literal
|
|
364
|
+
'no-throw-literal': 'error',
|
|
365
|
+
|
|
366
|
+
// disallow unmodified conditions of loops
|
|
367
|
+
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
368
|
+
'no-unmodified-loop-condition': 'off',
|
|
369
|
+
|
|
370
|
+
// disallow usage of expressions in statement position
|
|
371
|
+
// https://eslint.org/docs/rules/no-unused-expressions
|
|
372
|
+
'no-unused-expressions': [
|
|
373
|
+
'error',
|
|
374
|
+
{
|
|
375
|
+
allowShortCircuit: false,
|
|
376
|
+
allowTernary: false,
|
|
377
|
+
allowTaggedTemplates: false,
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
|
|
381
|
+
// disallow unused labels
|
|
382
|
+
// https://eslint.org/docs/rules/no-unused-labels
|
|
383
|
+
'no-unused-labels': 'error',
|
|
384
|
+
|
|
385
|
+
// disallow unnecessary .call() and .apply()
|
|
386
|
+
// https://eslint.org/docs/rules/no-useless-call
|
|
387
|
+
'no-useless-call': 'off',
|
|
388
|
+
|
|
389
|
+
// Disallow unnecessary catch clauses
|
|
390
|
+
// https://eslint.org/docs/rules/no-useless-catch
|
|
391
|
+
'no-useless-catch': 'error',
|
|
392
|
+
|
|
393
|
+
// disallow useless string concatenation
|
|
394
|
+
// https://eslint.org/docs/rules/no-useless-concat
|
|
395
|
+
'no-useless-concat': 'error',
|
|
396
|
+
|
|
397
|
+
// disallow unnecessary string escaping
|
|
398
|
+
// https://eslint.org/docs/rules/no-useless-escape
|
|
399
|
+
'no-useless-escape': 'error',
|
|
400
|
+
|
|
401
|
+
// disallow redundant return; keywords
|
|
402
|
+
// https://eslint.org/docs/rules/no-useless-return
|
|
403
|
+
'no-useless-return': 'error',
|
|
404
|
+
|
|
405
|
+
// disallow use of void operator
|
|
406
|
+
// https://eslint.org/docs/rules/no-void
|
|
407
|
+
'no-void': 'error',
|
|
408
|
+
|
|
409
|
+
// disallow usage of configurable warning terms in comments: e.g. todo
|
|
410
|
+
// https://eslint.org/docs/rules/no-warning-comments
|
|
411
|
+
'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
|
|
412
|
+
|
|
413
|
+
// disallow use of the with statement
|
|
414
|
+
// https://eslint.org/docs/rules/no-with
|
|
415
|
+
'no-with': 'error',
|
|
416
|
+
|
|
417
|
+
// require using Error objects as Promise rejection reasons
|
|
418
|
+
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
419
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
420
|
+
|
|
421
|
+
// Suggest using named capture group in regular expression
|
|
422
|
+
// https://eslint.org/docs/rules/prefer-named-capture-group
|
|
423
|
+
'prefer-named-capture-group': 'off',
|
|
424
|
+
|
|
425
|
+
// Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
|
|
426
|
+
// https://eslint.org/docs/rules/prefer-object-has-own
|
|
427
|
+
// TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
|
|
428
|
+
'prefer-object-has-own': 'off',
|
|
429
|
+
|
|
430
|
+
// https://eslint.org/docs/rules/prefer-regex-literals
|
|
431
|
+
'prefer-regex-literals': [
|
|
432
|
+
'error',
|
|
433
|
+
{
|
|
434
|
+
disallowRedundantWrapping: true,
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
|
|
438
|
+
// require use of the second argument for parseInt()
|
|
439
|
+
// https://eslint.org/docs/rules/radix
|
|
440
|
+
radix: 'error',
|
|
441
|
+
|
|
442
|
+
// require `await` in `async function` (note: this is a horrible rule that should never be used)
|
|
443
|
+
// https://eslint.org/docs/rules/require-await
|
|
444
|
+
'require-await': 'off',
|
|
445
|
+
|
|
446
|
+
// Enforce the use of u flag on RegExp
|
|
447
|
+
// https://eslint.org/docs/rules/require-unicode-regexp
|
|
448
|
+
'require-unicode-regexp': 'off',
|
|
449
|
+
|
|
450
|
+
// requires to declare all vars on top of their containing scope
|
|
451
|
+
// https://eslint.org/docs/rules/vars-on-top
|
|
452
|
+
'vars-on-top': 'error',
|
|
453
|
+
|
|
454
|
+
// require immediate function invocation to be wrapped in parentheses
|
|
455
|
+
// https://eslint.org/docs/rules/wrap-iife.html
|
|
456
|
+
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
457
|
+
|
|
458
|
+
// require or disallow Yoda conditions
|
|
459
|
+
// https://eslint.org/docs/rules/yoda
|
|
460
|
+
yoda: 'error',
|
|
461
|
+
},
|
|
462
|
+
} satisfies Linter.Config;
|