@wistia/eslint-config 0.34.0 → 0.35.0-beta.8e8f7e45.abefaec
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +28 -25
- package/rules/eslint/node.cjs +88 -76
- package/rules/eslint/typescript.cjs +238 -208
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"packageManager": "yarn@4.3.0",
|
|
3
|
+
"version": "0.35.0-beta.8e8f7e45.abefaec",
|
|
5
4
|
"description": "Wistia's ESLint configurations",
|
|
5
|
+
"packageManager": "yarn@4.3.1",
|
|
6
6
|
"main": "react.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"/configs",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"./vitest": "./configs/eslint/vitest.cjs"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
+
"changeset": "changeset",
|
|
34
35
|
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint --config eslint.config.mjs .",
|
|
35
36
|
"lint:debug": "ESLINT_USE_FLAT_CONFIG=true eslint --config eslint.config.mjs --print-config eslint.config.mjs",
|
|
36
37
|
"outdated": "yarn upgrade-interactive",
|
|
@@ -40,59 +41,61 @@
|
|
|
40
41
|
"test:stylelint": "stylelint --print-config ./test/index.mjs"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@babel/core": "^7.
|
|
44
|
-
"@babel/eslint-parser": "^7.
|
|
44
|
+
"@babel/core": "^7.25.2",
|
|
45
|
+
"@babel/eslint-parser": "^7.25.1",
|
|
45
46
|
"@babel/preset-react": "^7.24.7",
|
|
46
|
-
"@rushstack/eslint-patch": "^1.10.
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
48
|
-
"@typescript-eslint/parser": "^
|
|
47
|
+
"@rushstack/eslint-patch": "^1.10.4",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.0.1",
|
|
49
|
+
"@typescript-eslint/parser": "^8.0.1",
|
|
49
50
|
"confusing-browser-globals": "^1.0.11",
|
|
50
51
|
"eslint": "^8.57.0",
|
|
51
52
|
"eslint-config-prettier": "^9.1.0",
|
|
52
53
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
53
|
-
"eslint-plugin-cypress": "^3.
|
|
54
|
+
"eslint-plugin-cypress": "^3.4.0",
|
|
54
55
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
55
56
|
"eslint-plugin-filenames": "^1.3.2",
|
|
56
57
|
"eslint-plugin-fp": "^2.3.0",
|
|
57
58
|
"eslint-plugin-import": "^2.29.1",
|
|
58
|
-
"eslint-plugin-jest": "^28.
|
|
59
|
+
"eslint-plugin-jest": "^28.7.0",
|
|
59
60
|
"eslint-plugin-jest-dom": "^5.4.0",
|
|
60
61
|
"eslint-plugin-jest-formatting": "^3.1.0",
|
|
61
|
-
"eslint-plugin-jsdoc": "^48.
|
|
62
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
62
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
63
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
64
|
+
"eslint-plugin-n": "^17.10.2",
|
|
63
65
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
64
66
|
"eslint-plugin-no-snapshot-testing": "^1.0.61",
|
|
65
67
|
"eslint-plugin-no-typeof-window-undefined": "^0.0.2",
|
|
66
|
-
"eslint-plugin-node": "^11.1.0",
|
|
67
68
|
"eslint-plugin-observers": "^1.0.1",
|
|
68
|
-
"eslint-plugin-prettier": "^5.1
|
|
69
|
-
"eslint-plugin-promise": "^
|
|
70
|
-
"eslint-plugin-react": "^7.
|
|
69
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
70
|
+
"eslint-plugin-promise": "^7.0.0",
|
|
71
|
+
"eslint-plugin-react": "^7.35.0",
|
|
71
72
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
72
73
|
"eslint-plugin-react-hooks-ssr": "^0.1.5",
|
|
73
|
-
"eslint-plugin-sonarjs": "^1.0.
|
|
74
|
+
"eslint-plugin-sonarjs": "^1.0.4",
|
|
74
75
|
"eslint-plugin-ssr-friendly": "^1.3.0",
|
|
75
76
|
"eslint-plugin-storybook": "^0.8.0",
|
|
76
|
-
"eslint-plugin-styled-components-a11y": "^2.1.
|
|
77
|
+
"eslint-plugin-styled-components-a11y": "^2.1.35",
|
|
77
78
|
"eslint-plugin-testing-library": "^6.2.2",
|
|
78
79
|
"eslint-plugin-vitest": "^0.5.4",
|
|
79
80
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
80
|
-
"postcss": "^8.4.
|
|
81
|
+
"postcss": "^8.4.41",
|
|
81
82
|
"postcss-scss": "^4.0.9",
|
|
82
83
|
"postcss-styled-syntax": "^0.6.4",
|
|
83
|
-
"prettier": "^3.3.
|
|
84
|
-
"stylelint": "^16.
|
|
84
|
+
"prettier": "^3.3.3",
|
|
85
|
+
"stylelint": "^16.8.1",
|
|
85
86
|
"stylelint-declaration-block-no-ignored-properties": "^2.8.0",
|
|
86
|
-
"stylelint-prettier": "^5.0.
|
|
87
|
-
"stylelint-scss": "^6.
|
|
87
|
+
"stylelint-prettier": "^5.0.2",
|
|
88
|
+
"stylelint-scss": "^6.5.0"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|
|
91
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
92
|
+
"@changesets/cli": "^2.27.7",
|
|
90
93
|
"@commitlint/cli": "^19.3.0",
|
|
91
94
|
"@commitlint/config-conventional": "^19.2.2",
|
|
92
95
|
"check-export-map": "^1.3.1",
|
|
93
|
-
"husky": "^9.
|
|
94
|
-
"typescript": "^5.4
|
|
95
|
-
"vitest": "^
|
|
96
|
+
"husky": "^9.1.4",
|
|
97
|
+
"typescript": "^5.5.4",
|
|
98
|
+
"vitest": "^2.0.5"
|
|
96
99
|
},
|
|
97
100
|
"resolutions": {
|
|
98
101
|
"postcss": ">=8.4.38"
|
package/rules/eslint/node.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// only add node rules
|
|
2
|
-
// see: https://github.com/
|
|
2
|
+
// see: https://github.com/eslint-community/eslint-plugin-n#-rules
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
|
-
plugins: ['eslint-plugin-
|
|
5
|
+
plugins: ['eslint-plugin-n'],
|
|
6
6
|
|
|
7
7
|
rules: {
|
|
8
8
|
// Node requires file extensions for ESM imports
|
|
@@ -19,154 +19,166 @@ module.exports = {
|
|
|
19
19
|
],
|
|
20
20
|
|
|
21
21
|
// require error handling in callbacks
|
|
22
|
-
// https://github.com/
|
|
23
|
-
'
|
|
22
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err.md
|
|
23
|
+
'n/handle-callback-err': 'error',
|
|
24
24
|
|
|
25
25
|
// ensure Node.js-style error-first callback pattern is followed
|
|
26
|
-
// https://github.com/
|
|
27
|
-
'
|
|
26
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-callback-literal.md
|
|
27
|
+
'n/no-callback-literal': 'error',
|
|
28
28
|
|
|
29
29
|
// disallow the assignment to exports
|
|
30
|
-
// https://github.com/
|
|
31
|
-
'
|
|
30
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-exports-assign.md
|
|
31
|
+
'n/no-exports-assign': 'error',
|
|
32
32
|
|
|
33
33
|
// disallow import declarations which import extraneous modules
|
|
34
|
-
// https://github.com/
|
|
35
|
-
'
|
|
34
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
|
|
35
|
+
'n/no-extraneous-import': 'error',
|
|
36
36
|
|
|
37
37
|
// disallow require() expressions which import extraneous modules
|
|
38
|
-
// https://github.com/
|
|
39
|
-
'
|
|
38
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
39
|
+
'n/no-extraneous-require': 'error',
|
|
40
40
|
|
|
41
41
|
// disallow import declarations which import non-existence modules
|
|
42
|
-
// https://github.com/
|
|
43
|
-
'
|
|
42
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
43
|
+
'n/no-missing-import': 'error',
|
|
44
44
|
|
|
45
45
|
// disallow require() expressions which import non-existence modules
|
|
46
|
-
// https://github.com/
|
|
47
|
-
'
|
|
46
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-require.md
|
|
47
|
+
'n/no-missing-require': 'error',
|
|
48
48
|
|
|
49
49
|
// disallow new operators with calls to require
|
|
50
|
-
// https://github.com/
|
|
51
|
-
'
|
|
50
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
|
|
51
|
+
'n/no-new-require': 'error',
|
|
52
52
|
|
|
53
53
|
// disallow string concatenation with __dirname and __filename
|
|
54
|
-
// https://github.com/
|
|
55
|
-
'
|
|
54
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
|
|
55
|
+
'n/no-path-concat': 'error',
|
|
56
56
|
|
|
57
57
|
// disallow the use of process.exit()
|
|
58
|
-
// https://github.com/
|
|
59
|
-
'
|
|
58
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
|
|
59
|
+
'n/no-process-exit': 'error',
|
|
60
60
|
|
|
61
61
|
// disallow bin files that npm ignores
|
|
62
|
-
// https://github.com/
|
|
63
|
-
'
|
|
62
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-bin.md
|
|
63
|
+
'n/no-unpublished-bin': 'error',
|
|
64
64
|
|
|
65
65
|
// disallow import declarations which import private modules
|
|
66
|
-
// https://github.com/
|
|
67
|
-
'
|
|
66
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-import.md
|
|
67
|
+
'n/no-unpublished-import': 'error',
|
|
68
68
|
|
|
69
69
|
// disallow require() expressions which import private modules
|
|
70
|
-
// https://github.com/
|
|
71
|
-
'
|
|
70
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-require.md
|
|
71
|
+
'n/no-unpublished-require': 'error',
|
|
72
72
|
|
|
73
73
|
// disallow unsupported ECMAScript built-ins on the specified version
|
|
74
|
-
// https://github.com/
|
|
75
|
-
'
|
|
74
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-builtins.md
|
|
75
|
+
'n/no-unsupported-features/es-builtins': 'error',
|
|
76
76
|
|
|
77
77
|
// disallow unsupported ECMAScript syntax on the specified version
|
|
78
|
-
// https://github.com/
|
|
79
|
-
'
|
|
78
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
79
|
+
'n/no-unsupported-features/es-syntax': ['error', { ignores: ['modules'] }],
|
|
80
80
|
|
|
81
81
|
// disallow unsupported Node.js built-in APIs on the specified version
|
|
82
|
-
// https://github.com/
|
|
83
|
-
'
|
|
82
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
83
|
+
'n/no-unsupported-features/node-builtins': 'error',
|
|
84
84
|
|
|
85
85
|
// make process.exit() expressions the same code path as throw
|
|
86
|
-
// https://github.com/
|
|
87
|
-
'
|
|
86
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/process-exit-as-throw.md
|
|
87
|
+
'n/process-exit-as-throw': 'error',
|
|
88
88
|
|
|
89
89
|
// suggest correct usage of shebang
|
|
90
90
|
// decision: turned this off because it expects files to be listed under `bin` in package.json
|
|
91
|
-
// https://github.com/
|
|
92
|
-
'
|
|
91
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
92
|
+
'n/shebang': 'off',
|
|
93
93
|
|
|
94
94
|
// disallow deprecated APIs
|
|
95
|
-
// https://github.com/
|
|
96
|
-
'
|
|
95
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-deprecated-api.md
|
|
96
|
+
'n/no-deprecated-api': 'error',
|
|
97
97
|
|
|
98
98
|
// require return statements after callbacks
|
|
99
|
-
// https://github.com/
|
|
100
|
-
'
|
|
99
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
|
|
100
|
+
'n/callback-return': 'error',
|
|
101
101
|
|
|
102
102
|
// enforce either module.exports or exports
|
|
103
|
-
// https://github.com/
|
|
104
|
-
'
|
|
103
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/exports-style.md
|
|
104
|
+
'n/exports-style': 'error',
|
|
105
105
|
|
|
106
106
|
// enforce the style of file extensions in import declarations
|
|
107
|
-
// https://github.com/
|
|
108
|
-
'
|
|
107
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/file-extension-in-import.md
|
|
108
|
+
'n/file-extension-in-import': 'off',
|
|
109
109
|
|
|
110
110
|
// require require() calls to be placed at top-level module scope
|
|
111
|
-
// https://github.com/
|
|
112
|
-
'
|
|
111
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
|
|
112
|
+
'n/global-require': 'error',
|
|
113
113
|
|
|
114
114
|
// disallow require calls to be mixed with regular variable declarations
|
|
115
|
-
// https://github.com/
|
|
116
|
-
'
|
|
115
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
|
|
116
|
+
'n/no-mixed-requires': 'error',
|
|
117
117
|
|
|
118
118
|
// disallow the use of process.env
|
|
119
119
|
// decision: process.env is used by dotenv
|
|
120
|
-
// https://github.com/
|
|
121
|
-
'
|
|
120
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md
|
|
121
|
+
'n/no-process-env': 'off',
|
|
122
122
|
|
|
123
123
|
// disallow specified modules when loaded by import declarations
|
|
124
|
-
// https://github.com/
|
|
125
|
-
'
|
|
124
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
125
|
+
'n/no-restricted-import': 'error',
|
|
126
126
|
|
|
127
127
|
// disallow specified modules when loaded by require
|
|
128
|
-
// https://github.com/
|
|
129
|
-
'
|
|
128
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
129
|
+
'n/no-restricted-require': 'error',
|
|
130
130
|
|
|
131
131
|
// disallow synchronous methods
|
|
132
132
|
// decision: it's ok to use synchronous methods occasionally
|
|
133
|
-
// https://github.com/
|
|
134
|
-
'
|
|
133
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-sync.md
|
|
134
|
+
'n/no-sync': 'off',
|
|
135
135
|
|
|
136
136
|
// enforce either Buffer or require("buffer").Buffer
|
|
137
|
-
// https://github.com/
|
|
138
|
-
'
|
|
137
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/buffer.md
|
|
138
|
+
'n/prefer-global/buffer': 'error',
|
|
139
139
|
|
|
140
140
|
// enforce either console or require("console")
|
|
141
|
-
// https://github.com/
|
|
142
|
-
'
|
|
141
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/console.md
|
|
142
|
+
'n/prefer-global/console': 'error',
|
|
143
143
|
|
|
144
144
|
// enforce either process or require("process")
|
|
145
|
-
// https://github.com/
|
|
146
|
-
'
|
|
145
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/process.md
|
|
146
|
+
'n/prefer-global/process': 'error',
|
|
147
147
|
|
|
148
148
|
// enforce either TextDecoder or require("util").TextDecoder
|
|
149
|
-
// https://github.com/
|
|
150
|
-
'
|
|
149
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-decoder.md
|
|
150
|
+
'n/prefer-global/text-decoder': 'error',
|
|
151
151
|
|
|
152
152
|
// enforce either TextEncoder or require("util").TextEncoder
|
|
153
|
-
// https://github.com/
|
|
154
|
-
'
|
|
153
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-encoder.md
|
|
154
|
+
'n/prefer-global/text-encoder': 'error',
|
|
155
155
|
|
|
156
156
|
// enforce either URLSearchParams or require("url").URLSearchParams
|
|
157
|
-
// https://github.com/
|
|
158
|
-
'
|
|
157
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url-search-params.md
|
|
158
|
+
'n/prefer-global/url-search-params': 'error',
|
|
159
159
|
|
|
160
160
|
// enforce either URL or require("url").URL
|
|
161
|
-
// https://github.com/
|
|
162
|
-
'
|
|
161
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url.md
|
|
162
|
+
'n/prefer-global/url': 'error',
|
|
163
163
|
|
|
164
164
|
// enforce require("dns").promises
|
|
165
|
-
// https://github.com/
|
|
166
|
-
'
|
|
165
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/dns.md
|
|
166
|
+
'n/prefer-promises/dns': 'error',
|
|
167
167
|
|
|
168
168
|
// enforce require("fs").promises
|
|
169
|
-
// https://github.com/
|
|
170
|
-
'
|
|
169
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/fs.md
|
|
170
|
+
'n/prefer-promises/fs': 'error',
|
|
171
|
+
|
|
172
|
+
// require correct usage of hashbang
|
|
173
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/hashbang.md
|
|
174
|
+
'n/hashbang': 'error',
|
|
175
|
+
|
|
176
|
+
// disallow third-party modules which are hiding core modules
|
|
177
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-hide-core-modules.md
|
|
178
|
+
'n/no-hide-core-modules': 'error',
|
|
179
|
+
|
|
180
|
+
// enforce using the node: protocol when importing Node.js builtin modules
|
|
181
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-node-protocol.md
|
|
182
|
+
'n/prefer-node-protocol': 'error',
|
|
171
183
|
},
|
|
172
184
|
};
|
|
@@ -126,11 +126,11 @@ module.exports = {
|
|
|
126
126
|
// https://github.com/gund/eslint-plugin-deprecation?tab=readme-ov-file#disallow-usage-of-deprecated-apis-deprecationdeprecation
|
|
127
127
|
'deprecation/deprecation': 'error',
|
|
128
128
|
|
|
129
|
-
// Require that
|
|
129
|
+
// Require that function overload signatures be consecutive
|
|
130
130
|
// https://typescript-eslint.io/rules/adjacent-overload-signatures
|
|
131
131
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
132
132
|
|
|
133
|
-
// Require using either
|
|
133
|
+
// Require consistently using either T[] or Array<T> for arrays
|
|
134
134
|
// https://typescript-eslint.io/rules/array-type
|
|
135
135
|
'@typescript-eslint/array-type': 'error',
|
|
136
136
|
|
|
@@ -138,35 +138,39 @@ module.exports = {
|
|
|
138
138
|
// https://typescript-eslint.io/rules/await-thenable
|
|
139
139
|
'@typescript-eslint/await-thenable': 'error',
|
|
140
140
|
|
|
141
|
-
// Disallow
|
|
141
|
+
// Disallow @ts-<directive> comments or require descriptions after directives
|
|
142
142
|
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
143
143
|
'@typescript-eslint/ban-ts-comment': 'error',
|
|
144
144
|
|
|
145
|
-
// Disallow
|
|
145
|
+
// Disallow // tslint:<rule-flag> comments
|
|
146
146
|
// https://typescript-eslint.io/rules/ban-tslint-comment
|
|
147
147
|
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
148
148
|
|
|
149
|
-
// Disallow certain types
|
|
150
|
-
// https://typescript-eslint.io/rules/ban-types
|
|
151
|
-
'@typescript-eslint/ban-types': 'error',
|
|
152
|
-
|
|
153
149
|
// Enforce that literals on classes are exposed in a consistent style
|
|
154
150
|
// https://typescript-eslint.io/rules/class-literal-property-style
|
|
155
151
|
'@typescript-eslint/class-literal-property-style': 'error',
|
|
156
152
|
|
|
153
|
+
// Enforce that class methods utilize this
|
|
154
|
+
// https://typescript-eslint.io/rules/class-methods-use-this
|
|
155
|
+
'@typescript-eslint/class-methods-use-this': 'error',
|
|
156
|
+
|
|
157
157
|
// Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
|
|
158
158
|
// https://typescript-eslint.io/rules/consistent-generic-constructors
|
|
159
159
|
'@typescript-eslint/consistent-generic-constructors': 'error',
|
|
160
160
|
|
|
161
|
-
// Require or disallow the
|
|
161
|
+
// Require or disallow the Record type
|
|
162
162
|
// https://typescript-eslint.io/rules/consistent-indexed-object-style
|
|
163
163
|
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
|
164
164
|
|
|
165
|
+
// Require return statements to either always or never specify values
|
|
166
|
+
// https://typescript-eslint.io/rules/consistent-return
|
|
167
|
+
'@typescript-eslint/consistent-return': 'error',
|
|
168
|
+
|
|
165
169
|
// Enforce consistent usage of type assertions
|
|
166
170
|
// https://typescript-eslint.io/rules/consistent-type-assertions
|
|
167
171
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
168
172
|
|
|
169
|
-
// Enforce type definitions to consistently use either
|
|
173
|
+
// Enforce type definitions to consistently use either interface or type
|
|
170
174
|
// https://typescript-eslint.io/rules/consistent-type-definitions
|
|
171
175
|
// decision: prefer type to interface for consistency; type is more flexible, but
|
|
172
176
|
// on the other hand, interface is potentially more familiar so they can override if necessary
|
|
@@ -178,13 +182,19 @@ module.exports = {
|
|
|
178
182
|
|
|
179
183
|
// Enforce consistent usage of type imports
|
|
180
184
|
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
181
|
-
// decision: type definition imports don't evist in javascript so these should
|
|
182
|
-
// be considered decorative and kept separate from standard imports
|
|
183
185
|
'@typescript-eslint/consistent-type-imports': [
|
|
184
186
|
'error',
|
|
185
187
|
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
|
|
186
188
|
],
|
|
187
189
|
|
|
190
|
+
// Enforce default parameters to be last
|
|
191
|
+
// https://typescript-eslint.io/rules/default-param-last
|
|
192
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
193
|
+
|
|
194
|
+
// Enforce dot notation whenever possible
|
|
195
|
+
// https://typescript-eslint.io/rules/dot-notation
|
|
196
|
+
'@typescript-eslint/dot-notation': 'error',
|
|
197
|
+
|
|
188
198
|
// Require explicit return types on functions and class methods
|
|
189
199
|
// https://typescript-eslint.io/rules/explicit-function-return-type
|
|
190
200
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
@@ -197,9 +207,13 @@ module.exports = {
|
|
|
197
207
|
// https://typescript-eslint.io/rules/explicit-module-boundary-types
|
|
198
208
|
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
199
209
|
|
|
200
|
-
// Require
|
|
201
|
-
// https://typescript-eslint.io/rules/
|
|
202
|
-
'@typescript-eslint/
|
|
210
|
+
// Require or disallow initialization in variable declarations
|
|
211
|
+
// https://typescript-eslint.io/rules/init-declarations
|
|
212
|
+
'@typescript-eslint/init-declarations': 'error',
|
|
213
|
+
|
|
214
|
+
// Enforce a maximum number of parameters in function definitions
|
|
215
|
+
// https://typescript-eslint.io/rules/max-params
|
|
216
|
+
'@typescript-eslint/max-params': 'error',
|
|
203
217
|
|
|
204
218
|
// Require a consistent member declaration order
|
|
205
219
|
// https://typescript-eslint.io/rules/member-ordering
|
|
@@ -213,7 +227,15 @@ module.exports = {
|
|
|
213
227
|
// https://typescript-eslint.io/rules/naming-convention
|
|
214
228
|
'@typescript-eslint/naming-convention': 'off',
|
|
215
229
|
|
|
216
|
-
//
|
|
230
|
+
// Disallow generic Array constructors
|
|
231
|
+
// https://typescript-eslint.io/rules/no-array-constructor
|
|
232
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
233
|
+
|
|
234
|
+
// Disallow using the delete operator on array values
|
|
235
|
+
// https://typescript-eslint.io/rules/no-array-delete
|
|
236
|
+
'@typescript-eslint/no-array-delete': 'error',
|
|
237
|
+
|
|
238
|
+
// Require .toString() to only be called on objects which provide useful information when stringified
|
|
217
239
|
// https://typescript-eslint.io/rules/no-base-to-string
|
|
218
240
|
'@typescript-eslint/no-base-to-string': 'error',
|
|
219
241
|
|
|
@@ -230,23 +252,40 @@ module.exports = {
|
|
|
230
252
|
},
|
|
231
253
|
],
|
|
232
254
|
|
|
255
|
+
// Disallow duplicate class members
|
|
256
|
+
// https://typescript-eslint.io/rules/no-dupe-class-members
|
|
257
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
258
|
+
|
|
233
259
|
// Disallow duplicate enum member values
|
|
234
260
|
// https://typescript-eslint.io/rules/no-duplicate-enum-values
|
|
235
261
|
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
236
262
|
|
|
237
|
-
// Disallow
|
|
263
|
+
// Disallow duplicate constituents of union or intersection types
|
|
264
|
+
// https://typescript-eslint.io/rules/no-duplicate-type-constituents
|
|
265
|
+
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
|
266
|
+
|
|
267
|
+
// Disallow using the delete operator on computed key expressions
|
|
238
268
|
// https://typescript-eslint.io/rules/no-dynamic-delete
|
|
239
269
|
'@typescript-eslint/no-dynamic-delete': 'error',
|
|
240
270
|
|
|
271
|
+
// Disallow empty functions
|
|
272
|
+
// https://typescript-eslint.io/rules/no-empty-function
|
|
273
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
274
|
+
|
|
241
275
|
// Disallow the declaration of empty interfaces
|
|
242
276
|
// https://typescript-eslint.io/rules/no-empty-interface
|
|
243
|
-
|
|
277
|
+
// decision: this rule has been deprecated in favour of the more comprehensive @typescript-eslint/no-empty-object-type rule
|
|
278
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
279
|
+
|
|
280
|
+
// Disallow accidentally using the "empty object" type
|
|
281
|
+
// https://typescript-eslint.io/rules/no-empty-object-type
|
|
282
|
+
'@typescript-eslint/no-empty-object-type': 'error',
|
|
244
283
|
|
|
245
|
-
// Disallow the
|
|
284
|
+
// Disallow the any type
|
|
246
285
|
// https://typescript-eslint.io/rules/no-explicit-any
|
|
247
286
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
248
287
|
|
|
249
|
-
// Disallow extra non-null
|
|
288
|
+
// Disallow extra non-null assertions
|
|
250
289
|
// https://typescript-eslint.io/rules/no-extra-non-null-assertion
|
|
251
290
|
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
252
291
|
|
|
@@ -262,19 +301,43 @@ module.exports = {
|
|
|
262
301
|
// https://typescript-eslint.io/rules/no-for-in-array
|
|
263
302
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
264
303
|
|
|
304
|
+
// Disallow the use of eval()-like methods
|
|
305
|
+
// https://typescript-eslint.io/rules/no-implied-eval
|
|
306
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
307
|
+
|
|
308
|
+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
|
|
309
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
310
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
311
|
+
|
|
265
312
|
// Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
|
|
266
313
|
// https://typescript-eslint.io/rules/no-inferrable-types
|
|
267
314
|
'@typescript-eslint/no-inferrable-types': 'error',
|
|
268
315
|
|
|
269
|
-
// Disallow
|
|
316
|
+
// Disallow this keywords outside of classes or class-like objects
|
|
317
|
+
// https://typescript-eslint.io/rules/no-invalid-this
|
|
318
|
+
'@typescript-eslint/no-invalid-this': 'error',
|
|
319
|
+
|
|
320
|
+
// Disallow void type outside of generic or return types
|
|
270
321
|
// https://typescript-eslint.io/rules/no-invalid-void-type
|
|
271
322
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
272
323
|
|
|
273
|
-
// Disallow
|
|
324
|
+
// Disallow function declarations that contain unsafe references inside loop statements
|
|
325
|
+
// https://typescript-eslint.io/rules/no-loop-func
|
|
326
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
327
|
+
|
|
328
|
+
// Disallow literal numbers that lose precision
|
|
329
|
+
// https://typescript-eslint.io/rules/no-loss-of-precision
|
|
330
|
+
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
331
|
+
|
|
332
|
+
// Disallow magic numbers
|
|
333
|
+
// https://typescript-eslint.io/rules/no-magic-numbers
|
|
334
|
+
'@typescript-eslint/no-magic-numbers': 'error',
|
|
335
|
+
|
|
336
|
+
// Disallow the void operator except when used to discard a value
|
|
274
337
|
// https://typescript-eslint.io/rules/no-meaningless-void-operator
|
|
275
338
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
276
339
|
|
|
277
|
-
// Enforce valid definition of
|
|
340
|
+
// Enforce valid definition of new and constructor
|
|
278
341
|
// https://typescript-eslint.io/rules/no-misused-new
|
|
279
342
|
'@typescript-eslint/no-misused-new': 'error',
|
|
280
343
|
|
|
@@ -282,7 +345,11 @@ module.exports = {
|
|
|
282
345
|
// https://typescript-eslint.io/rules/no-misused-promises
|
|
283
346
|
'@typescript-eslint/no-misused-promises': 'error',
|
|
284
347
|
|
|
285
|
-
// Disallow
|
|
348
|
+
// Disallow enums from having both number and string members
|
|
349
|
+
// https://typescript-eslint.io/rules/no-mixed-enums
|
|
350
|
+
'@typescript-eslint/no-mixed-enums': 'error',
|
|
351
|
+
|
|
352
|
+
// Disallow TypeScript namespaces
|
|
286
353
|
// https://typescript-eslint.io/rules/no-namespace
|
|
287
354
|
'@typescript-eslint/no-namespace': 'error',
|
|
288
355
|
|
|
@@ -294,24 +361,41 @@ module.exports = {
|
|
|
294
361
|
// https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
|
|
295
362
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
296
363
|
|
|
297
|
-
// Disallow non-null assertions using the
|
|
364
|
+
// Disallow non-null assertions using the ! postfix operator
|
|
298
365
|
// https://typescript-eslint.io/rules/no-non-null-assertion
|
|
299
366
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
300
367
|
|
|
368
|
+
// Disallow variable redeclaration
|
|
369
|
+
// https://typescript-eslint.io/rules/no-redeclare
|
|
370
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
371
|
+
|
|
301
372
|
// Disallow members of unions and intersections that do nothing or override type information
|
|
302
373
|
// https://typescript-eslint.io/rules/no-redundant-type-constituents
|
|
303
374
|
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
304
375
|
|
|
305
|
-
// Disallow invocation of
|
|
376
|
+
// Disallow invocation of require()
|
|
306
377
|
// https://typescript-eslint.io/rules/no-require-imports
|
|
307
378
|
'@typescript-eslint/no-require-imports': 'error',
|
|
308
379
|
|
|
309
|
-
// Disallow
|
|
380
|
+
// Disallow specified modules when loaded by import
|
|
381
|
+
// https://typescript-eslint.io/rules/no-restricted-imports
|
|
382
|
+
'@typescript-eslint/no-restricted-imports': 'error',
|
|
383
|
+
|
|
384
|
+
// Disallow certain types
|
|
385
|
+
// https://typescript-eslint.io/rules/no-restricted-types
|
|
386
|
+
'@typescript-eslint/no-restricted-types': 'error',
|
|
387
|
+
|
|
388
|
+
// Disallow variable declarations from shadowing variables declared in the outer scope
|
|
389
|
+
// https://typescript-eslint.io/rules/no-shadow
|
|
390
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
391
|
+
|
|
392
|
+
// Disallow aliasing this
|
|
310
393
|
// https://typescript-eslint.io/rules/no-this-alias
|
|
311
394
|
'@typescript-eslint/no-this-alias': 'error',
|
|
312
395
|
|
|
313
396
|
// Disallow type aliases
|
|
314
397
|
// https://typescript-eslint.io/rules/no-type-alias
|
|
398
|
+
// decision: this rule has been deprecated in favour of the @typescript-eslint/consistent-type-definitions rule
|
|
315
399
|
'@typescript-eslint/no-type-alias': 'off',
|
|
316
400
|
|
|
317
401
|
// Disallow unnecessary equality comparisons against boolean literals
|
|
@@ -322,10 +406,18 @@ module.exports = {
|
|
|
322
406
|
// https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
323
407
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
324
408
|
|
|
409
|
+
// Disallow unnecessary assignment of constructor property parameter
|
|
410
|
+
// https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
|
|
411
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
412
|
+
|
|
325
413
|
// Disallow unnecessary namespace qualifiers
|
|
326
414
|
// https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
327
415
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
328
416
|
|
|
417
|
+
// Disallow unnecessary template expressions
|
|
418
|
+
// https://typescript-eslint.io/rules/no-unnecessary-template-expression
|
|
419
|
+
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
420
|
+
|
|
329
421
|
// Disallow type arguments that are equal to the default
|
|
330
422
|
// https://typescript-eslint.io/rules/no-unnecessary-type-arguments
|
|
331
423
|
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
@@ -338,51 +430,104 @@ module.exports = {
|
|
|
338
430
|
// https://typescript-eslint.io/rules/no-unnecessary-type-constraint
|
|
339
431
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
340
432
|
|
|
341
|
-
// Disallow
|
|
433
|
+
// Disallow type parameters that only appear once
|
|
434
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
435
|
+
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
|
436
|
+
|
|
437
|
+
// Disallow calling a function with a value with type any
|
|
342
438
|
// https://typescript-eslint.io/rules/no-unsafe-argument
|
|
343
439
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
344
440
|
|
|
345
|
-
// Disallow assigning a value with type
|
|
441
|
+
// Disallow assigning a value with type any to variables and properties
|
|
346
442
|
// https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
347
443
|
'@typescript-eslint/no-unsafe-assignment': 'error',
|
|
348
444
|
|
|
349
|
-
// Disallow calling a value with type
|
|
445
|
+
// Disallow calling a value with type any
|
|
350
446
|
// https://typescript-eslint.io/rules/no-unsafe-call
|
|
351
447
|
'@typescript-eslint/no-unsafe-call': 'error',
|
|
352
448
|
|
|
353
|
-
// Disallow
|
|
449
|
+
// Disallow unsafe declaration merging
|
|
450
|
+
// https://typescript-eslint.io/rules/no-unsafe-declaration-merging
|
|
451
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
452
|
+
|
|
453
|
+
// Disallow comparing an enum value with a non-enum value
|
|
454
|
+
// https://typescript-eslint.io/rules/no-unsafe-enum-comparison
|
|
455
|
+
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
456
|
+
|
|
457
|
+
// Disallow using the unsafe built-in Function type
|
|
458
|
+
// https://typescript-eslint.io/rules/no-unsafe-function-type
|
|
459
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
460
|
+
|
|
461
|
+
// Disallow member access on a value with type any
|
|
354
462
|
// https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
355
463
|
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
356
464
|
|
|
357
|
-
// Disallow returning a value with type
|
|
465
|
+
// Disallow returning a value with type any from a function
|
|
358
466
|
// https://typescript-eslint.io/rules/no-unsafe-return
|
|
359
467
|
'@typescript-eslint/no-unsafe-return': 'error',
|
|
360
468
|
|
|
469
|
+
// Require unary negation to take a number
|
|
470
|
+
// https://typescript-eslint.io/rules/no-unsafe-unary-minus
|
|
471
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
472
|
+
|
|
473
|
+
// Disallow unused expressions
|
|
474
|
+
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
475
|
+
'@typescript-eslint/no-unused-expressions': 'error',
|
|
476
|
+
|
|
477
|
+
// Disallow unused variables
|
|
478
|
+
// https://typescript-eslint.io/rules/no-unused-vars
|
|
479
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
480
|
+
|
|
481
|
+
// Disallow the use of variables before they are defined
|
|
482
|
+
// https://typescript-eslint.io/rules/no-use-before-define
|
|
483
|
+
'@typescript-eslint/no-use-before-define': 'error',
|
|
484
|
+
|
|
485
|
+
// Disallow unnecessary constructors
|
|
486
|
+
// https://typescript-eslint.io/rules/no-useless-constructor
|
|
487
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
488
|
+
|
|
361
489
|
// Disallow empty exports that don't change anything in a module file
|
|
362
490
|
// https://typescript-eslint.io/rules/no-useless-empty-export
|
|
363
491
|
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
364
492
|
|
|
365
|
-
// Disallow
|
|
493
|
+
// Disallow require statements except in import statements
|
|
366
494
|
// https://typescript-eslint.io/rules/no-var-requires
|
|
367
|
-
|
|
495
|
+
// decision: this rule has been deprecated in favour of the @typescript-eslint/no-require-imports rule.
|
|
496
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
497
|
+
|
|
498
|
+
// Disallow using confusing built-in primitive class wrappers
|
|
499
|
+
// https://typescript-eslint.io/rules/no-wrapper-object-types
|
|
500
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
368
501
|
|
|
369
502
|
// Enforce non-null assertions over explicit type casts
|
|
370
503
|
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style
|
|
371
504
|
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
|
372
505
|
|
|
506
|
+
// Disallow throwing non-Error values as exceptions
|
|
507
|
+
// https://typescript-eslint.io/rules/only-throw-error
|
|
508
|
+
'@typescript-eslint/only-throw-error': 'error',
|
|
509
|
+
|
|
373
510
|
// Require or disallow parameter properties in class constructors
|
|
374
511
|
// https://typescript-eslint.io/rules/parameter-properties
|
|
375
512
|
'@typescript-eslint/parameter-properties': 'error',
|
|
376
513
|
|
|
377
|
-
// Enforce the use of
|
|
514
|
+
// Enforce the use of as const over literal type
|
|
378
515
|
// https://typescript-eslint.io/rules/prefer-as-const
|
|
379
516
|
'@typescript-eslint/prefer-as-const': 'error',
|
|
380
517
|
|
|
518
|
+
// Require destructuring from arrays and/or objects
|
|
519
|
+
// https://typescript-eslint.io/rules/prefer-destructuring
|
|
520
|
+
'@typescript-eslint/prefer-destructuring': 'error',
|
|
521
|
+
|
|
381
522
|
// Require each enum member value to be explicitly initialized
|
|
382
523
|
// https://typescript-eslint.io/rules/prefer-enum-initializers
|
|
383
524
|
'@typescript-eslint/prefer-enum-initializers': 'error',
|
|
384
525
|
|
|
385
|
-
// Enforce the use of
|
|
526
|
+
// Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result
|
|
527
|
+
// https://typescript-eslint.io/rules/prefer-find
|
|
528
|
+
'@typescript-eslint/prefer-find': 'error',
|
|
529
|
+
|
|
530
|
+
// Enforce the use of for-of loop over the standard for loop where possible
|
|
386
531
|
// https://typescript-eslint.io/rules/prefer-for-of
|
|
387
532
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
388
533
|
|
|
@@ -390,7 +535,7 @@ module.exports = {
|
|
|
390
535
|
// https://typescript-eslint.io/rules/prefer-function-type
|
|
391
536
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
392
537
|
|
|
393
|
-
// Enforce
|
|
538
|
+
// Enforce includes method over indexOf method
|
|
394
539
|
// https://typescript-eslint.io/rules/prefer-includes
|
|
395
540
|
'@typescript-eslint/prefer-includes': 'error',
|
|
396
541
|
|
|
@@ -398,74 +543,85 @@ module.exports = {
|
|
|
398
543
|
// https://typescript-eslint.io/rules/prefer-literal-enum-member
|
|
399
544
|
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
400
545
|
|
|
401
|
-
// Require using
|
|
546
|
+
// Require using namespace keyword over module keyword to declare custom TypeScript modules
|
|
402
547
|
// https://typescript-eslint.io/rules/prefer-namespace-keyword
|
|
403
548
|
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
404
549
|
|
|
405
|
-
// Enforce using the nullish coalescing operator instead of logical chaining
|
|
550
|
+
// Enforce using the nullish coalescing operator instead of logical assignments or chaining
|
|
406
551
|
// https://typescript-eslint.io/rules/prefer-nullish-coalescing
|
|
407
552
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
408
553
|
|
|
409
|
-
// Enforce using concise optional chain expressions instead of chained logical ands
|
|
554
|
+
// Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects
|
|
410
555
|
// https://typescript-eslint.io/rules/prefer-optional-chain
|
|
411
556
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
412
557
|
|
|
413
|
-
// Require
|
|
558
|
+
// Require using Error objects as Promise rejection reasons
|
|
559
|
+
// https://typescript-eslint.io/rules/prefer-promise-reject-errors
|
|
560
|
+
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
|
561
|
+
|
|
562
|
+
// Require private members to be marked as readonly if they're never modified outside of the constructor
|
|
414
563
|
// https://typescript-eslint.io/rules/prefer-readonly
|
|
415
564
|
'@typescript-eslint/prefer-readonly': 'error',
|
|
416
565
|
|
|
417
|
-
// Require function parameters to be typed as
|
|
566
|
+
// Require function parameters to be typed as readonly to prevent accidental mutation of inputs
|
|
418
567
|
// https://typescript-eslint.io/rules/prefer-readonly-parameter-types
|
|
419
568
|
// disabled due to development friction and lackluster linting hints to resolve violations
|
|
420
569
|
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
421
570
|
|
|
422
|
-
// Enforce using type parameter when calling
|
|
571
|
+
// Enforce using type parameter when calling Array#reduce instead of casting
|
|
423
572
|
// https://typescript-eslint.io/rules/prefer-reduce-type-parameter
|
|
424
573
|
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
425
574
|
|
|
426
|
-
// Enforce
|
|
575
|
+
// Enforce RegExp#exec over String#match if no global flag is provided
|
|
427
576
|
// https://typescript-eslint.io/rules/prefer-regexp-exec
|
|
428
577
|
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
429
578
|
|
|
430
|
-
// Enforce that
|
|
579
|
+
// Enforce that this is used when only this type is returned
|
|
431
580
|
// https://typescript-eslint.io/rules/prefer-return-this-type
|
|
432
581
|
'@typescript-eslint/prefer-return-this-type': 'error',
|
|
433
582
|
|
|
434
|
-
// Enforce using
|
|
583
|
+
// Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings
|
|
435
584
|
// https://typescript-eslint.io/rules/prefer-string-starts-ends-with
|
|
436
585
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
437
586
|
|
|
438
|
-
// Enforce using
|
|
587
|
+
// Enforce using @ts-expect-error over @ts-ignore
|
|
439
588
|
// https://typescript-eslint.io/rules/prefer-ts-expect-error
|
|
440
|
-
|
|
589
|
+
// decision: this rule has been deprecated in favor of @typescript-eslint/ban-ts-comment
|
|
590
|
+
'@typescript-eslint/prefer-ts-expect-error': 'off',
|
|
441
591
|
|
|
442
592
|
// Require any function or method that returns a Promise to be marked async
|
|
443
593
|
// https://typescript-eslint.io/rules/promise-function-async
|
|
444
594
|
'@typescript-eslint/promise-function-async': 'error',
|
|
445
595
|
|
|
446
|
-
// Require
|
|
596
|
+
// Require Array#sort and Array#toSorted calls to always provide a compareFunction
|
|
447
597
|
// https://typescript-eslint.io/rules/require-array-sort-compare
|
|
448
|
-
|
|
449
|
-
|
|
598
|
+
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
599
|
+
|
|
600
|
+
// Disallow async functions which do not return promises and have no await expression
|
|
601
|
+
// https://typescript-eslint.io/rules/require-await
|
|
602
|
+
'@typescript-eslint/require-await': 'error',
|
|
450
603
|
|
|
451
|
-
// Require both operands of addition to
|
|
604
|
+
// Require both operands of addition to be the same type and be bigint, number, or string
|
|
452
605
|
// https://typescript-eslint.io/rules/restrict-plus-operands
|
|
453
606
|
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
454
607
|
|
|
455
|
-
// Enforce template literal expressions to be of
|
|
608
|
+
// Enforce template literal expressions to be of string type
|
|
456
609
|
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
457
610
|
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
458
611
|
|
|
612
|
+
// Enforce consistent awaiting of returned promises
|
|
613
|
+
// https://typescript-eslint.io/rules/return-await
|
|
614
|
+
'@typescript-eslint/return-await': 'error',
|
|
615
|
+
|
|
616
|
+
// Enforce constituents of a type union/intersection to be sorted alphabetically
|
|
617
|
+
// https://typescript-eslint.io/rules/sort-type-constituents
|
|
618
|
+
'@typescript-eslint/sort-type-constituents': 'error',
|
|
619
|
+
|
|
459
620
|
// Disallow certain types in boolean expressions
|
|
460
621
|
// https://typescript-eslint.io/rules/strict-boolean-expressions
|
|
461
|
-
'@typescript-eslint/strict-boolean-expressions':
|
|
462
|
-
'error',
|
|
463
|
-
{
|
|
464
|
-
allowNullableBoolean: true,
|
|
465
|
-
},
|
|
466
|
-
],
|
|
622
|
+
'@typescript-eslint/strict-boolean-expressions': 'error',
|
|
467
623
|
|
|
468
|
-
// Require switch-case statements to be exhaustive
|
|
624
|
+
// Require switch-case statements to be exhaustive
|
|
469
625
|
// https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
470
626
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
471
627
|
|
|
@@ -473,10 +629,6 @@ module.exports = {
|
|
|
473
629
|
// https://typescript-eslint.io/rules/triple-slash-reference
|
|
474
630
|
'@typescript-eslint/triple-slash-reference': 'error',
|
|
475
631
|
|
|
476
|
-
// Require consistent spacing around type annotations
|
|
477
|
-
// https://typescript-eslint.io/rules/type-annotation-spacing
|
|
478
|
-
'@typescript-eslint/type-annotation-spacing': 'off',
|
|
479
|
-
|
|
480
632
|
// Require type annotations in certain places
|
|
481
633
|
// https://typescript-eslint.io/rules/typedef
|
|
482
634
|
'@typescript-eslint/typedef': 'error',
|
|
@@ -489,10 +641,15 @@ module.exports = {
|
|
|
489
641
|
// https://typescript-eslint.io/rules/unified-signatures
|
|
490
642
|
'@typescript-eslint/unified-signatures': 'error',
|
|
491
643
|
|
|
492
|
-
//
|
|
493
|
-
//
|
|
494
|
-
|
|
495
|
-
|
|
644
|
+
// Enforce typing arguments in .catch() callbacks as unknown
|
|
645
|
+
// https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
646
|
+
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
|
647
|
+
|
|
648
|
+
// deprecated formating rules; project recommends using ESLint Stylistic (https://eslint.style)
|
|
649
|
+
|
|
650
|
+
// Disallow or enforce spaces inside of blocks after opening block and before closing block
|
|
651
|
+
// https://typescript-eslint.io/rules/block-spacing/
|
|
652
|
+
'@typescript-eslint/block-spacing': 'error',
|
|
496
653
|
|
|
497
654
|
// Enforce consistent brace style for blocks
|
|
498
655
|
// https://typescript-eslint.io/rules/brace-style
|
|
@@ -506,14 +663,6 @@ module.exports = {
|
|
|
506
663
|
// https://typescript-eslint.io/rules/comma-spacing
|
|
507
664
|
'@typescript-eslint/comma-spacing': 'off',
|
|
508
665
|
|
|
509
|
-
// Enforce default parameters to be last
|
|
510
|
-
// https://typescript-eslint.io/rules/default-param-last
|
|
511
|
-
'@typescript-eslint/default-param-last': 'error',
|
|
512
|
-
|
|
513
|
-
// Enforce dot notation whenever possible
|
|
514
|
-
// https://typescript-eslint.io/rules/dot-notation
|
|
515
|
-
'@typescript-eslint/dot-notation': 'error',
|
|
516
|
-
|
|
517
666
|
// Require or disallow spacing between function identifiers and their invocations
|
|
518
667
|
// https://typescript-eslint.io/rules/func-call-spacing
|
|
519
668
|
'@typescript-eslint/func-call-spacing': 'off',
|
|
@@ -522,29 +671,25 @@ module.exports = {
|
|
|
522
671
|
// https://typescript-eslint.io/rules/indent
|
|
523
672
|
'@typescript-eslint/indent': 'off',
|
|
524
673
|
|
|
525
|
-
//
|
|
526
|
-
// https://typescript-eslint.io/rules/
|
|
527
|
-
'@typescript-eslint/
|
|
674
|
+
// Enforce consistent spacing between property names and type annotations in types and interfaces
|
|
675
|
+
// https://typescript-eslint.io/rules/key-spacing/
|
|
676
|
+
'@typescript-eslint/key-spacing': 'error',
|
|
528
677
|
|
|
529
678
|
// Enforce consistent spacing before and after keywords
|
|
530
679
|
// https://typescript-eslint.io/rules/keyword-spacing
|
|
531
680
|
'@typescript-eslint/keyword-spacing': 'off',
|
|
532
681
|
|
|
682
|
+
// Require empty lines around comments
|
|
683
|
+
// https://typescript-eslint.io/rules/lines-around-comment/
|
|
684
|
+
'@typescript-eslint/lines-around-comment': 'error',
|
|
685
|
+
|
|
533
686
|
// Require or disallow an empty line between class members
|
|
534
687
|
// https://typescript-eslint.io/rules/lines-between-class-members
|
|
535
688
|
'@typescript-eslint/lines-between-class-members': 'off',
|
|
536
689
|
|
|
537
|
-
//
|
|
538
|
-
// https://typescript-eslint.io/rules/
|
|
539
|
-
'@typescript-eslint/
|
|
540
|
-
|
|
541
|
-
// Disallow duplicate class members
|
|
542
|
-
// https://typescript-eslint.io/rules/no-dupe-class-members
|
|
543
|
-
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
544
|
-
|
|
545
|
-
// Disallow empty functions
|
|
546
|
-
// https://typescript-eslint.io/rules/no-empty-function
|
|
547
|
-
'@typescript-eslint/no-empty-function': 'error',
|
|
690
|
+
// Require a specific member delimiter style for interfaces and type literals
|
|
691
|
+
// https://typescript-eslint.io/rules/member-delimiter-style
|
|
692
|
+
'@typescript-eslint/member-delimiter-style': 'off',
|
|
548
693
|
|
|
549
694
|
// Disallow unnecessary parentheses
|
|
550
695
|
// https://typescript-eslint.io/rules/no-extra-parens
|
|
@@ -554,81 +699,6 @@ module.exports = {
|
|
|
554
699
|
// https://typescript-eslint.io/rules/no-extra-semi
|
|
555
700
|
'@typescript-eslint/no-extra-semi': 'off',
|
|
556
701
|
|
|
557
|
-
// Disallow the use of <code>eval()</code>-like methods
|
|
558
|
-
// https://typescript-eslint.io/rules/no-implied-eval
|
|
559
|
-
'@typescript-eslint/no-implied-eval': 'error',
|
|
560
|
-
|
|
561
|
-
// Disallow <code>this</code> keywords outside of classes or class-like objects
|
|
562
|
-
// https://typescript-eslint.io/rules/no-invalid-this
|
|
563
|
-
'@typescript-eslint/no-invalid-this': 'error',
|
|
564
|
-
|
|
565
|
-
// Disallow function declarations that contain unsafe references inside loop statements
|
|
566
|
-
// https://typescript-eslint.io/rules/no-loop-func
|
|
567
|
-
'@typescript-eslint/no-loop-func': 'error',
|
|
568
|
-
|
|
569
|
-
// Disallow literal numbers that lose precision
|
|
570
|
-
// https://typescript-eslint.io/rules/no-loss-of-precision
|
|
571
|
-
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
572
|
-
|
|
573
|
-
// Disallow magic numbers
|
|
574
|
-
// https://typescript-eslint.io/rules/no-magic-numbers
|
|
575
|
-
'@typescript-eslint/no-magic-numbers': [
|
|
576
|
-
'error',
|
|
577
|
-
{
|
|
578
|
-
ignore: [-1, 0, 1, 2, 3, 4, 5, 100, 1024, 1000, 10000],
|
|
579
|
-
ignoreArrayIndexes: true,
|
|
580
|
-
ignoreDefaultValues: true,
|
|
581
|
-
ignoreTypeIndexes: true,
|
|
582
|
-
ignoreReadonlyClassProperties: true,
|
|
583
|
-
ignoreEnums: true,
|
|
584
|
-
ignoreNumericLiteralTypes: true,
|
|
585
|
-
},
|
|
586
|
-
],
|
|
587
|
-
|
|
588
|
-
// Disallow variable redeclaration
|
|
589
|
-
// https://typescript-eslint.io/rules/no-redeclare
|
|
590
|
-
'@typescript-eslint/no-redeclare': 'error',
|
|
591
|
-
|
|
592
|
-
// Disallow specified modules when loaded by <code>import</code>
|
|
593
|
-
// https://typescript-eslint.io/rules/no-restricted-imports
|
|
594
|
-
'@typescript-eslint/no-restricted-imports': 'error',
|
|
595
|
-
|
|
596
|
-
// Disallow variable declarations from shadowing variables declared in the outer scope
|
|
597
|
-
// https://typescript-eslint.io/rules/no-shadow
|
|
598
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
599
|
-
|
|
600
|
-
// Disallow throwing literals as exceptions
|
|
601
|
-
// https://typescript-eslint.io/rules/no-throw-literal
|
|
602
|
-
'@typescript-eslint/no-throw-literal': 'error',
|
|
603
|
-
|
|
604
|
-
// Disallow unused expressions
|
|
605
|
-
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
606
|
-
'@typescript-eslint/no-unused-expressions': 'error',
|
|
607
|
-
|
|
608
|
-
// Disallow unused variables
|
|
609
|
-
// https://typescript-eslint.io/rules/no-unused-vars
|
|
610
|
-
'@typescript-eslint/no-unused-vars': [
|
|
611
|
-
'error',
|
|
612
|
-
{
|
|
613
|
-
args: 'after-used',
|
|
614
|
-
varsIgnorePattern: '^_',
|
|
615
|
-
argsIgnorePattern: '^_',
|
|
616
|
-
ignoreRestSiblings: true,
|
|
617
|
-
},
|
|
618
|
-
],
|
|
619
|
-
|
|
620
|
-
// Disallow the use of variables before they are defined
|
|
621
|
-
// https://typescript-eslint.io/rules/no-use-before-define
|
|
622
|
-
'@typescript-eslint/no-use-before-define': 'error',
|
|
623
|
-
|
|
624
|
-
// Disallow unnecessary constructors
|
|
625
|
-
// https://typescript-eslint.io/rules/no-useless-constructor
|
|
626
|
-
'@typescript-eslint/no-useless-constructor': 'error',
|
|
627
|
-
|
|
628
|
-
// Enforce consistent spacing inside braces
|
|
629
|
-
// https://typescript-eslint.io/rules/object-curly-spacing
|
|
630
|
-
'@typescript-eslint/object-curly-spacing': 'off',
|
|
631
|
-
|
|
632
702
|
// Require or disallow padding lines between statements
|
|
633
703
|
// https://typescript-eslint.io/rules/padding-line-between-statements
|
|
634
704
|
'@typescript-eslint/padding-line-between-statements': 'error',
|
|
@@ -637,14 +707,6 @@ module.exports = {
|
|
|
637
707
|
// https://typescript-eslint.io/rules/quotes
|
|
638
708
|
'@typescript-eslint/quotes': 'off',
|
|
639
709
|
|
|
640
|
-
// Disallow async functions which have no <code>await</code> expression
|
|
641
|
-
// https://typescript-eslint.io/rules/require-await
|
|
642
|
-
'@typescript-eslint/require-await': 'error',
|
|
643
|
-
|
|
644
|
-
// Enforce consistent returning of awaited values
|
|
645
|
-
// https://typescript-eslint.io/rules/return-await
|
|
646
|
-
'@typescript-eslint/return-await': 'error',
|
|
647
|
-
|
|
648
710
|
// Require or disallow semicolons instead of ASI
|
|
649
711
|
// https://typescript-eslint.io/rules/semi€
|
|
650
712
|
'@typescript-eslint/semi': 'off',
|
|
@@ -661,40 +723,8 @@ module.exports = {
|
|
|
661
723
|
// https://typescript-eslint.io/rules/space-infix-ops
|
|
662
724
|
'@typescript-eslint/space-infix-ops': 'off',
|
|
663
725
|
|
|
664
|
-
//
|
|
665
|
-
// https://typescript-eslint.io/rules/
|
|
666
|
-
'@typescript-eslint/
|
|
667
|
-
|
|
668
|
-
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
|
|
669
|
-
// https://typescript-eslint.io/rules/no-import-type-side-effects/
|
|
670
|
-
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
671
|
-
|
|
672
|
-
// Disallow enums from having both number and string members
|
|
673
|
-
// https://typescript-eslint.io/rules/no-mixed-enums/
|
|
674
|
-
'@typescript-eslint/no-mixed-enums': 'error',
|
|
675
|
-
|
|
676
|
-
// Disallow unsafe declaration merging
|
|
677
|
-
// https://typescript-eslint.io/rules/no-unsafe-declaration-merging/
|
|
678
|
-
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
679
|
-
|
|
680
|
-
// Disallow comparing an enum value with a non-enum value
|
|
681
|
-
// https://typescript-eslint.io/rules/no-unsafe-enum-comparison/
|
|
682
|
-
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
683
|
-
|
|
684
|
-
// Enforce constituents of a type union/intersection to be sorted alphabetically
|
|
685
|
-
// https://typescript-eslint.io/rules/sort-type-constituents/
|
|
686
|
-
'@typescript-eslint/sort-type-constituents': 'error',
|
|
687
|
-
|
|
688
|
-
// Disallow or enforce spaces inside of blocks after opening block and before closing block
|
|
689
|
-
// https://typescript-eslint.io/rules/block-spacing/
|
|
690
|
-
'@typescript-eslint/block-spacing': 'error',
|
|
691
|
-
|
|
692
|
-
// Enforce consistent spacing between property names and type annotations in types and interfaces
|
|
693
|
-
// https://typescript-eslint.io/rules/key-spacing/
|
|
694
|
-
'@typescript-eslint/key-spacing': 'error',
|
|
695
|
-
|
|
696
|
-
// Require empty lines around comments
|
|
697
|
-
// https://typescript-eslint.io/rules/lines-around-comment/
|
|
698
|
-
'@typescript-eslint/lines-around-comment': 'error',
|
|
726
|
+
// Require consistent spacing around type annotations
|
|
727
|
+
// https://typescript-eslint.io/rules/type-annotation-spacing
|
|
728
|
+
'@typescript-eslint/type-annotation-spacing': 'off',
|
|
699
729
|
},
|
|
700
730
|
};
|