@spscommerce/eslint-config-typescript 0.0.12-rc.2 → 0.0.12-rc.3
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/lib/index.js +2 -1
- package/lib/rules/bestPractices.js +16 -1
- package/lib/rules/es6.js +10 -0
- package/lib/rules/possibleErrors.js +1 -3
- package/lib/rules/stylisticIssues.js +11 -29
- package/lib/rules/typescript.js +15 -9
- package/package.json +3 -1
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const config = {
|
|
|
13
13
|
project: "./tsconfig.json",
|
|
14
14
|
},
|
|
15
15
|
plugins: [
|
|
16
|
-
"@typescript-eslint", "import",
|
|
16
|
+
"@typescript-eslint", "import", "@stylistic"
|
|
17
17
|
],
|
|
18
18
|
settings: {
|
|
19
19
|
"import/extensions": [".ts", ".tsx"],
|
|
@@ -42,4 +42,5 @@ const config = {
|
|
|
42
42
|
...typescript_1.typescript,
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
|
+
typescript_1.typescript.rules;
|
|
45
46
|
module.exports = config;
|
|
@@ -199,6 +199,11 @@ exports.bestPractices = {
|
|
|
199
199
|
*/
|
|
200
200
|
"no-implied-eval": "off",
|
|
201
201
|
"@typescript-eslint/no-implied-eval": "error",
|
|
202
|
+
/**
|
|
203
|
+
* disallow assignment to imported bindings
|
|
204
|
+
* https://eslint.org/docs/rules/no-import-assign
|
|
205
|
+
*/
|
|
206
|
+
"no-import-assign": "error",
|
|
202
207
|
/**
|
|
203
208
|
* disallow this keywords outside of classes or class-like objects
|
|
204
209
|
* https://eslint.org/docs/rules/no-invalid-this
|
|
@@ -400,7 +405,7 @@ exports.bestPractices = {
|
|
|
400
405
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
401
406
|
*/
|
|
402
407
|
"no-throw-literal": "off",
|
|
403
|
-
"@typescript-eslint/
|
|
408
|
+
"@typescript-eslint/only-throw-error": "error",
|
|
404
409
|
/**
|
|
405
410
|
* disallow unmodified conditions of loops
|
|
406
411
|
* https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
@@ -418,6 +423,11 @@ exports.bestPractices = {
|
|
|
418
423
|
* https://eslint.org/docs/rules/no-unused-labels
|
|
419
424
|
*/
|
|
420
425
|
"no-unused-labels": "error",
|
|
426
|
+
/**
|
|
427
|
+
* disallow useless backreferences in regular expressions
|
|
428
|
+
* https://eslint.org/docs/rules/no-useless-backreference
|
|
429
|
+
*/
|
|
430
|
+
"no-useless-backreference": "error",
|
|
421
431
|
/**
|
|
422
432
|
* disallow unnecessary .call() and .apply()
|
|
423
433
|
* https://eslint.org/docs/rules/no-useless-call
|
|
@@ -459,6 +469,11 @@ exports.bestPractices = {
|
|
|
459
469
|
* https://eslint.org/docs/rules/no-with
|
|
460
470
|
*/
|
|
461
471
|
"no-with": "error",
|
|
472
|
+
/**
|
|
473
|
+
* require `Object.hasOwn` instead of `Object.prototype.hasOwnProperty.call`
|
|
474
|
+
* https://eslint.org/docs/rules/prefer-object-has-own
|
|
475
|
+
*/
|
|
476
|
+
"prefer-object-has-own": "error",
|
|
462
477
|
/**
|
|
463
478
|
* require using Error objects as Promise rejection reasons
|
|
464
479
|
* https://eslint.org/docs/rules/prefer-promise-reject-errors
|
package/lib/rules/es6.js
CHANGED
|
@@ -28,6 +28,11 @@ exports.es6 = {
|
|
|
28
28
|
* https://eslint.org/docs/rules/generator-star-spacing
|
|
29
29
|
*/
|
|
30
30
|
"generator-star-spacing": ["error", { before: false, after: true }],
|
|
31
|
+
/**
|
|
32
|
+
* enforce logical assignment operators
|
|
33
|
+
* https://eslint.org/docs/rules/logical-assignment-operators
|
|
34
|
+
*/
|
|
35
|
+
"logical-assignment-operators": "error",
|
|
31
36
|
/**
|
|
32
37
|
* disallow modifying variables of class declarations ✅
|
|
33
38
|
* https://eslint.org/docs/rules/no-class-assign
|
|
@@ -137,6 +142,11 @@ exports.es6 = {
|
|
|
137
142
|
{
|
|
138
143
|
enforceForRenamedProperties: false,
|
|
139
144
|
}],
|
|
145
|
+
/**
|
|
146
|
+
* prefer exponentiation operator
|
|
147
|
+
* https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
148
|
+
*/
|
|
149
|
+
"prefer-exponentiation-operator": "error",
|
|
140
150
|
/**
|
|
141
151
|
* disallow parseInt() in favor of binary, octal, and hexadecimal literals 🔧
|
|
142
152
|
* https://eslint.org/docs/rules/prefer-numeric-literals
|
|
@@ -106,10 +106,8 @@ exports.possibleErrors = {
|
|
|
106
106
|
/**
|
|
107
107
|
* disallow unnecessary semicolons ✅ 🔧
|
|
108
108
|
* https://eslint.org/docs/rules/no-extra-semi
|
|
109
|
-
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
110
109
|
*/
|
|
111
|
-
"no-extra-semi": "
|
|
112
|
-
"@typescript-eslint/no-extra-semi": "error",
|
|
110
|
+
"no-extra-semi": "error",
|
|
113
111
|
/**
|
|
114
112
|
* disallow overwriting functions written as function declarations ✅
|
|
115
113
|
* https://eslint.org/docs/rules/no-func-assign
|
|
@@ -28,8 +28,7 @@ exports.stylisticIssues = {
|
|
|
28
28
|
* https://eslint.org/docs/rules/brace-style
|
|
29
29
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
|
|
30
30
|
*/
|
|
31
|
-
"brace-style": "
|
|
32
|
-
"@typescript-eslint/brace-style": "error",
|
|
31
|
+
"@stylistic/brace-style": "error",
|
|
33
32
|
/**
|
|
34
33
|
* require camel case names
|
|
35
34
|
* https://eslint.org/docs/rules/camelcase
|
|
@@ -45,15 +44,13 @@ exports.stylisticIssues = {
|
|
|
45
44
|
* https://eslint.org/docs/rules/comma-dangle
|
|
46
45
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
47
46
|
*/
|
|
48
|
-
"comma-dangle": "
|
|
49
|
-
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
|
|
47
|
+
"@stylistic/comma-dangle": ["error", "always-multiline"],
|
|
50
48
|
/**
|
|
51
49
|
* enforce spacing before/after comma 🔧
|
|
52
50
|
* https://eslint.org/docs/rules/comma-spacing
|
|
53
51
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
54
52
|
*/
|
|
55
|
-
"comma-spacing": "
|
|
56
|
-
"@typescript-eslint/comma-spacing": "error",
|
|
53
|
+
"@stylistic/comma-spacing": "error",
|
|
57
54
|
/**
|
|
58
55
|
* enforce one true comma style 🔧
|
|
59
56
|
* https://eslint.org/docs/rules/comma-style
|
|
@@ -80,8 +77,7 @@ exports.stylisticIssues = {
|
|
|
80
77
|
* https://eslint.org/docs/rules/func-call-spacing
|
|
81
78
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
82
79
|
*/
|
|
83
|
-
"func-call-spacing": "
|
|
84
|
-
"@typescript-eslint/func-call-spacing": "error",
|
|
80
|
+
"@stylistic/func-call-spacing": "error",
|
|
85
81
|
/**
|
|
86
82
|
* requires function names to match the name of the
|
|
87
83
|
* variable or property to which they are assigned
|
|
@@ -136,13 +132,6 @@ exports.stylisticIssues = {
|
|
|
136
132
|
* Disabled because it results in conflicts with Prettier
|
|
137
133
|
*/
|
|
138
134
|
"implicit-arrow-linebreak": "off",
|
|
139
|
-
/**
|
|
140
|
-
* this option sets a specific tab width for your code 🔧
|
|
141
|
-
* https://eslint.org/docs/rules/indent
|
|
142
|
-
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
|
|
143
|
-
*/
|
|
144
|
-
indent: "off",
|
|
145
|
-
"@typescript-eslint/indent": ["error", 2],
|
|
146
135
|
/**
|
|
147
136
|
* specify whether double or single quotes should be used in JSX attributes 🔧
|
|
148
137
|
* https://eslint.org/docs/rules/jsx-quotes
|
|
@@ -158,8 +147,7 @@ exports.stylisticIssues = {
|
|
|
158
147
|
* https://eslint.org/docs/rules/keyword-spacing
|
|
159
148
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
160
149
|
*/
|
|
161
|
-
"keyword-spacing": "
|
|
162
|
-
"@typescript-eslint/keyword-spacing": "error",
|
|
150
|
+
"@stylistic/keyword-spacing": "error",
|
|
163
151
|
/**
|
|
164
152
|
* enforce position of line comments
|
|
165
153
|
* https://eslint.org/docs/rules/line-comment-position
|
|
@@ -180,8 +168,7 @@ exports.stylisticIssues = {
|
|
|
180
168
|
* https://eslint.org/docs/rules/lines-between-class-members
|
|
181
169
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
182
170
|
*/
|
|
183
|
-
"lines-between-class-members": "
|
|
184
|
-
"@typescript-eslint/lines-between-class-members": "error",
|
|
171
|
+
"@stylistic/lines-between-class-members": "error",
|
|
185
172
|
/**
|
|
186
173
|
* specify the maximum depth that blocks can be nested
|
|
187
174
|
* https://eslint.org/docs/rules/max-depth
|
|
@@ -393,8 +380,7 @@ exports.stylisticIssues = {
|
|
|
393
380
|
* https://eslint.org/docs/rules/object-curly-spacing
|
|
394
381
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
|
|
395
382
|
*/
|
|
396
|
-
"object-curly-spacing": "
|
|
397
|
-
"@typescript-eslint/object-curly-spacing": ["error", "always"],
|
|
383
|
+
"@stylistic/object-curly-spacing": ["error", "always"],
|
|
398
384
|
/**
|
|
399
385
|
* enforce "same line" or "multiple line" on object properties. 🔧
|
|
400
386
|
* https://eslint.org/docs/rules/object-property-newline
|
|
@@ -466,8 +452,7 @@ exports.stylisticIssues = {
|
|
|
466
452
|
* https://eslint.org/docs/rules/quotes
|
|
467
453
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
|
|
468
454
|
*/
|
|
469
|
-
quotes: "
|
|
470
|
-
"@typescript-eslint/quotes": ["error",
|
|
455
|
+
"@stylistic/quotes": ["error",
|
|
471
456
|
"double",
|
|
472
457
|
{ avoidEscape: true }],
|
|
473
458
|
/**
|
|
@@ -475,8 +460,7 @@ exports.stylisticIssues = {
|
|
|
475
460
|
* https://eslint.org/docs/rules/
|
|
476
461
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
477
462
|
*/
|
|
478
|
-
semi: "
|
|
479
|
-
"@typescript-eslint/semi": "error",
|
|
463
|
+
"@stylistic/semi": "error",
|
|
480
464
|
/**
|
|
481
465
|
* enforce spacing before and after semicolons 🔧
|
|
482
466
|
* https://eslint.org/docs/rules/semi-spacing
|
|
@@ -507,8 +491,7 @@ exports.stylisticIssues = {
|
|
|
507
491
|
* https://eslint.org/docs/rules/space-before-function-paren
|
|
508
492
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
509
493
|
*/
|
|
510
|
-
"space-before-function-paren":
|
|
511
|
-
"@typescript-eslint/space-before-function-paren": [
|
|
494
|
+
"@stylistic/space-before-function-paren": [
|
|
512
495
|
"error",
|
|
513
496
|
{
|
|
514
497
|
anonymous: "always",
|
|
@@ -526,8 +509,7 @@ exports.stylisticIssues = {
|
|
|
526
509
|
* https://eslint.org/docs/rules/space-infix-ops
|
|
527
510
|
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
528
511
|
*/
|
|
529
|
-
"space-infix-ops": "
|
|
530
|
-
"@typescript-eslint/space-infix-ops": "error",
|
|
512
|
+
"@stylistic/space-infix-ops": "error",
|
|
531
513
|
/**
|
|
532
514
|
* Require or disallow spaces before/after unary operators 🔧
|
|
533
515
|
* https://eslint.org/docs/rules/space-unary-ops
|
package/lib/rules/typescript.js
CHANGED
|
@@ -28,13 +28,6 @@ exports.typescript = {
|
|
|
28
28
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-tslint-comment.md
|
|
29
29
|
*/
|
|
30
30
|
"@typescript-eslint/ban-tslint-comment": "off",
|
|
31
|
-
/**
|
|
32
|
-
* Bans specific types from being used ✅ 🔧
|
|
33
|
-
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-types.md
|
|
34
|
-
* The default config you get if you enable this recommended rule without specifying your own
|
|
35
|
-
* should be reviewed.
|
|
36
|
-
*/
|
|
37
|
-
"@typescript-eslint/ban-types": "error",
|
|
38
31
|
/**
|
|
39
32
|
* Ensures that literals on classes are exposed in a consistent style 🔧
|
|
40
33
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/class-literal-property-style.md
|
|
@@ -80,7 +73,7 @@ exports.typescript = {
|
|
|
80
73
|
* Require a specific member delimiter style for interfaces and type literals 🔧
|
|
81
74
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/member-delimiter-style.md
|
|
82
75
|
*/
|
|
83
|
-
"@
|
|
76
|
+
"@stylistic/member-delimiter-style": "error",
|
|
84
77
|
/**
|
|
85
78
|
* Require a consistent member declaration order
|
|
86
79
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/member-ordering.md
|
|
@@ -122,6 +115,11 @@ exports.typescript = {
|
|
|
122
115
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-empty-interface.md
|
|
123
116
|
*/
|
|
124
117
|
"@typescript-eslint/no-empty-interface": "error",
|
|
118
|
+
/**
|
|
119
|
+
* Disallow usage of the `object` type with an object literal
|
|
120
|
+
* as a type annotation ✅
|
|
121
|
+
*/
|
|
122
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
125
123
|
/**
|
|
126
124
|
* Disallow usage of the `any` type ✅ 🔧
|
|
127
125
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-explicit-any.md
|
|
@@ -253,6 +251,10 @@ exports.typescript = {
|
|
|
253
251
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-call.md
|
|
254
252
|
*/
|
|
255
253
|
"@typescript-eslint/no-unsafe-call": "error",
|
|
254
|
+
/**
|
|
255
|
+
* Disallows member access on `any` typed variables ✅ 💭
|
|
256
|
+
*/
|
|
257
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
256
258
|
/**
|
|
257
259
|
* Disallows member access on `any` typed variables ✅ 💭
|
|
258
260
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
|
|
@@ -268,6 +270,10 @@ exports.typescript = {
|
|
|
268
270
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-var-requires.md
|
|
269
271
|
*/
|
|
270
272
|
"@typescript-eslint/no-var-requires": "error",
|
|
273
|
+
/**
|
|
274
|
+
* Disallow using confusing built-in primitive class wrappers.
|
|
275
|
+
*/
|
|
276
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
271
277
|
/**
|
|
272
278
|
* Prefers a non-null assertion over explicit type cast when possible 🔧 💭
|
|
273
279
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md
|
|
@@ -401,7 +407,7 @@ exports.typescript = {
|
|
|
401
407
|
* Require consistent spacing around type annotations 🔧
|
|
402
408
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
|
|
403
409
|
*/
|
|
404
|
-
"@
|
|
410
|
+
"@stylistic/type-annotation-spacing": "error",
|
|
405
411
|
/**
|
|
406
412
|
* Requires type annotations to exist
|
|
407
413
|
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/typedef.md
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/eslint-config-typescript",
|
|
3
|
-
"version": "0.0.12-rc.
|
|
3
|
+
"version": "0.0.12-rc.3",
|
|
4
4
|
"description": "SPS official linter configuration for TypeScript.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"eslint-plugin-import": "^2.31.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
42
|
+
"@types/eslint": "^8.56.10",
|
|
41
43
|
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
42
44
|
"@typescript-eslint/parser": "^8.24.0",
|
|
43
45
|
"eslint-import-resolver-typescript": "^3.7.0",
|