@josundt/eslint-config 5.2.10 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@josundt/eslint-config",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.4.0",
|
4
4
|
"description": "ESLint ruleset with required plugins for josundt TypeScript projects",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -27,22 +27,22 @@
|
|
27
27
|
"utils/**/*.js"
|
28
28
|
],
|
29
29
|
"peerDependencies": {
|
30
|
-
"typescript": ">=5.
|
30
|
+
"typescript": ">=5.4.2"
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
|
-
"@josundt/prettier-config": "^3.0
|
34
|
-
"@typescript-eslint/eslint-plugin": "
|
35
|
-
"@typescript-eslint/parser": "
|
36
|
-
"eslint": "8.
|
37
|
-
"eslint-import-resolver-typescript": "3.6.
|
38
|
-
"eslint-plugin-deprecation": "
|
33
|
+
"@josundt/prettier-config": "^3.1.0",
|
34
|
+
"@typescript-eslint/eslint-plugin": "7.2.0",
|
35
|
+
"@typescript-eslint/parser": "7.2.0",
|
36
|
+
"eslint": "8.57.0",
|
37
|
+
"eslint-import-resolver-typescript": "3.6.1",
|
38
|
+
"eslint-plugin-deprecation": "2.0.0",
|
39
39
|
"eslint-plugin-eslint-comments": "3.2.0",
|
40
|
-
"eslint-plugin-import": "2.
|
40
|
+
"eslint-plugin-import": "2.29.1",
|
41
41
|
"eslint-plugin-jasmine": "4.1.3",
|
42
|
-
"eslint-plugin-jest": "27.
|
43
|
-
"eslint-plugin-jsdoc": "
|
42
|
+
"eslint-plugin-jest": "27.9.0",
|
43
|
+
"eslint-plugin-jsdoc": "48.2.1",
|
44
44
|
"eslint-plugin-no-lookahead-lookbehind-regexp": "0.3.0",
|
45
|
-
"eslint-plugin-prettier": "5.
|
46
|
-
"eslint-plugin-unicorn": "
|
45
|
+
"eslint-plugin-prettier": "5.1.3",
|
46
|
+
"eslint-plugin-unicorn": "51.0.1"
|
47
47
|
}
|
48
48
|
}
|
package/rules/eslint.js
CHANGED
@@ -150,6 +150,16 @@ module.exports = {
|
|
150
150
|
"error",
|
151
151
|
{ destructuring: "all", ignoreReadBeforeAssign: false }
|
152
152
|
],
|
153
|
+
"prefer-destructuring": [
|
154
|
+
"warn",
|
155
|
+
{
|
156
|
+
array: true,
|
157
|
+
object: true
|
158
|
+
},
|
159
|
+
{
|
160
|
+
enforceForRenamedProperties: false
|
161
|
+
}
|
162
|
+
],
|
153
163
|
"prefer-exponentiation-operator": "error",
|
154
164
|
"prefer-object-spread": "error",
|
155
165
|
"prefer-promise-reject-errors": "error",
|
@@ -10,7 +10,7 @@ const eslintRules = eslintRuleSet.rules;
|
|
10
10
|
// If the map value is an object:
|
11
11
|
// The object will be merged merged with standard rule (rule object 1).
|
12
12
|
// If the map value is an array:
|
13
|
-
// The items of the array will be
|
13
|
+
// The options items of the array (expected to be object literals or undefined) will be merged with the options items of the standard rule (expected to be object literals or undefined).
|
14
14
|
// If the map value is a function:
|
15
15
|
// The standard eslint options object will be passed as parameters, the return statement will be added as options.
|
16
16
|
|
@@ -23,6 +23,7 @@ const extensions = new Map([
|
|
23
23
|
// ignoreClassesThatImplementAnInterface: false
|
24
24
|
// }
|
25
25
|
],
|
26
|
+
["consistent-return", true],
|
26
27
|
["default-param-last", true],
|
27
28
|
[
|
28
29
|
"dot-notation",
|
@@ -76,6 +77,11 @@ const extensions = new Map([
|
|
76
77
|
["no-unused-vars", false],
|
77
78
|
["no-use-before-define", false],
|
78
79
|
["no-useless-constructor", false],
|
80
|
+
[
|
81
|
+
"prefer-destructuring",
|
82
|
+
[{}, { enforceForDeclarationWithTypeAnnotation: false }]
|
83
|
+
],
|
84
|
+
["prefer-promise-reject-errors", true],
|
79
85
|
["require-await", true],
|
80
86
|
["return-await", true]
|
81
87
|
]);
|
@@ -105,7 +111,19 @@ module.exports.typescriptEslintExtensionrules = Object.entries(
|
|
105
111
|
// Ensure value is array if only severity string:
|
106
112
|
value = Array.isArray(value) ? [...value] : [value];
|
107
113
|
if (Array.isArray(extension)) {
|
108
|
-
value
|
114
|
+
const [severity, ...orgOpts] = value;
|
115
|
+
const extOpts = extension;
|
116
|
+
value = [severity];
|
117
|
+
for (
|
118
|
+
let i = 0;
|
119
|
+
i < Math.max(orgOpts.length, extOpts.length);
|
120
|
+
i++
|
121
|
+
) {
|
122
|
+
value.push({
|
123
|
+
...(orgOpts[i] ?? {}),
|
124
|
+
...(extOpts[i] ?? {})
|
125
|
+
});
|
126
|
+
}
|
109
127
|
} else if (typeof extension === "object") {
|
110
128
|
// If array only contains severity string, push object
|
111
129
|
if (value.length === 1) {
|
@@ -128,11 +128,16 @@ const rules = {
|
|
128
128
|
leadingUnderscore: "allow",
|
129
129
|
trailingUnderscore: "forbid"
|
130
130
|
},
|
131
|
+
{
|
132
|
+
selector: "import",
|
133
|
+
format: ["camelCase", "PascalCase"]
|
134
|
+
},
|
131
135
|
{
|
132
136
|
selector: "enumMember",
|
133
137
|
format: ["camelCase", "PascalCase"]
|
134
138
|
}
|
135
139
|
],
|
140
|
+
"no-array-delete": "error",
|
136
141
|
"no-base-to-string": "error",
|
137
142
|
"no-confusing-non-null-assertion": "error",
|
138
143
|
"no-confusing-void-expression": [
|
@@ -188,6 +193,7 @@ const rules = {
|
|
188
193
|
"no-redundant-type-constituents": "error",
|
189
194
|
"no-require-imports": "error",
|
190
195
|
"no-unsafe-enum-comparison": "error",
|
196
|
+
"no-unsafe-unary-minus": "error",
|
191
197
|
"no-this-alias": "error",
|
192
198
|
"no-throw-literal": [
|
193
199
|
"error",
|
@@ -209,6 +215,7 @@ const rules = {
|
|
209
215
|
"no-unsafe-return": "error",
|
210
216
|
"no-unused-vars-experimental": "off", // to strict with method params...
|
211
217
|
"no-useless-empty-export": "error",
|
218
|
+
"no-useless-template-literals": "error",
|
212
219
|
"no-var-requires": "error",
|
213
220
|
"non-nullable-type-assertion-style": "error",
|
214
221
|
"parameter-properties": [
|
@@ -220,6 +227,7 @@ const rules = {
|
|
220
227
|
],
|
221
228
|
"prefer-as-const": "off",
|
222
229
|
"prefer-enum-initializers": "error",
|
230
|
+
"prefer-find": "error",
|
223
231
|
"prefer-for-of": "error",
|
224
232
|
"prefer-function-type": "error",
|
225
233
|
"prefer-includes": "error",
|
@@ -245,7 +253,12 @@ const rules = {
|
|
245
253
|
"prefer-reduce-type-parameter": "error",
|
246
254
|
"prefer-regexp-exec": "error",
|
247
255
|
"prefer-return-this-type": "error",
|
248
|
-
"prefer-string-starts-ends-with":
|
256
|
+
"prefer-string-starts-ends-with": [
|
257
|
+
"error",
|
258
|
+
{
|
259
|
+
allowSingleElementEquality: "never"
|
260
|
+
}
|
261
|
+
],
|
249
262
|
"prefer-ts-expect-error": "error",
|
250
263
|
"promise-function-async": "off",
|
251
264
|
"require-array-sort-compare": [
|
@@ -285,7 +298,13 @@ const rules = {
|
|
285
298
|
allowAny: false
|
286
299
|
}
|
287
300
|
],
|
288
|
-
"switch-exhaustiveness-check":
|
301
|
+
"switch-exhaustiveness-check": [
|
302
|
+
"error",
|
303
|
+
{
|
304
|
+
allowDefaultCaseForExhaustiveSwitch: true,
|
305
|
+
requireDefaultForNonUnion: false
|
306
|
+
}
|
307
|
+
],
|
289
308
|
"triple-slash-reference": "error",
|
290
309
|
"type-annotation-spacing": "error", // This is a formatting rule
|
291
310
|
"typedef": [
|