@typescript-eslint/eslint-plugin 6.9.1 → 6.9.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,9 +14,12 @@ exports.default = (0, util_1.createRule)({
|
|
|
14
14
|
},
|
|
15
15
|
messages: {
|
|
16
16
|
tsDirectiveComment: 'Do not use "@ts-{{directive}}" because it alters compilation errors.',
|
|
17
|
+
tsIgnoreInsteadOfExpectError: 'Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free.',
|
|
17
18
|
tsDirectiveCommentRequiresDescription: 'Include a description after the "@ts-{{directive}}" directive to explain why the @ts-{{directive}} is necessary. The description must be {{minimumDescriptionLength}} characters or longer.',
|
|
18
19
|
tsDirectiveCommentDescriptionNotMatchPattern: 'The description for the "@ts-{{directive}}" directive must match the {{format}} format.',
|
|
20
|
+
replaceTsIgnoreWithTsExpectError: 'Replace "@ts-ignore" with "@ts-expect-error".',
|
|
19
21
|
},
|
|
22
|
+
hasSuggestions: true,
|
|
20
23
|
schema: [
|
|
21
24
|
{
|
|
22
25
|
$defs: {
|
|
@@ -99,11 +102,31 @@ exports.default = (0, util_1.createRule)({
|
|
|
99
102
|
const fullDirective = `ts-${directive}`;
|
|
100
103
|
const option = options[fullDirective];
|
|
101
104
|
if (option === true) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
if (directive === 'ignore') {
|
|
106
|
+
// Special case to suggest @ts-expect-error instead of @ts-ignore
|
|
107
|
+
context.report({
|
|
108
|
+
node: comment,
|
|
109
|
+
messageId: 'tsIgnoreInsteadOfExpectError',
|
|
110
|
+
suggest: [
|
|
111
|
+
{
|
|
112
|
+
messageId: 'replaceTsIgnoreWithTsExpectError',
|
|
113
|
+
fix(fixer) {
|
|
114
|
+
const commentText = comment.value.replace(/@ts-ignore/, '@ts-expect-error');
|
|
115
|
+
return fixer.replaceText(comment, comment.type === utils_1.AST_TOKEN_TYPES.Line
|
|
116
|
+
? `//${commentText}`
|
|
117
|
+
: `/*${commentText}*/`);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
context.report({
|
|
125
|
+
data: { directive },
|
|
126
|
+
node: comment,
|
|
127
|
+
messageId: 'tsDirectiveComment',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
107
130
|
}
|
|
108
131
|
if (option === 'allow-with-description' ||
|
|
109
132
|
(typeof option === 'object' && option.descriptionFormat)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ban-ts-comment.js","sourceRoot":"","sources":["../../src/rules/ban-ts-comment.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ban-ts-comment.js","sourceRoot":"","sources":["../../src/rules/ban-ts-comment.ts"],"names":[],"mappings":";;;AAAA,oDAA0E;AAE1E,kCAAsD;AAezC,QAAA,+BAA+B,GAAG,CAAC,CAAC;AASjD,kBAAe,IAAA,iBAAU,EAAwB;IAC/C,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8EAA8E;YAChF,WAAW,EAAE,aAAa;SAC3B;QACD,QAAQ,EAAE;YACR,kBAAkB,EAChB,sEAAsE;YACxE,4BAA4B,EAC1B,sHAAsH;YACxH,qCAAqC,EACnC,6LAA6L;YAC/L,4CAA4C,EAC1C,yFAAyF;YAC3F,gCAAgC,EAC9B,+CAA+C;SAClD;QACD,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE;YACN;gBACE,KAAK,EAAE;oBACL,qBAAqB,EAAE;wBACrB,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,SAAS;gCACf,OAAO,EAAE,IAAI;6BACd;4BACD;gCACE,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,C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ACL,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE;gCACnB,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,oBAAoB;6BAChC,CAAC,CAAC;yBACJ;qBACF;oBAED,IACE,MAAM,KAAK,wBAAwB;wBACnC,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,iBAAiB,CAAC,EACxD;wBACA,MAAM,EACJ,wBAAwB,GAAG,uCAA+B,GAC3D,GAAG,OAAO,CAAC;wBACZ,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;wBACrD,IACE,IAAA,sBAAe,EAAC,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,wBAAwB,EAC9D;4BACA,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE;gCAC7C,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,uCAAuC;6BACnD,CAAC,CAAC;yBACJ;6BAAM,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;4BAC9C,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;gCAC1C,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,8CAA8C;6BAC1D,CAAC,CAAC;yBACJ;qBACF;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "6.9.1",
|
|
3
|
+
"version": "6.9.2-alpha.1+c2ab78132",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@eslint-community/regexpp": "^4.5.1",
|
|
60
|
-
"@typescript-eslint/scope-manager": "6.9.1",
|
|
61
|
-
"@typescript-eslint/type-utils": "6.9.1",
|
|
62
|
-
"@typescript-eslint/utils": "6.9.1",
|
|
63
|
-
"@typescript-eslint/visitor-keys": "6.9.1",
|
|
60
|
+
"@typescript-eslint/scope-manager": "6.9.2-alpha.1+c2ab78132",
|
|
61
|
+
"@typescript-eslint/type-utils": "6.9.2-alpha.1+c2ab78132",
|
|
62
|
+
"@typescript-eslint/utils": "6.9.2-alpha.1+c2ab78132",
|
|
63
|
+
"@typescript-eslint/visitor-keys": "6.9.2-alpha.1+c2ab78132",
|
|
64
64
|
"debug": "^4.3.4",
|
|
65
65
|
"graphemer": "^1.4.0",
|
|
66
66
|
"ignore": "^5.2.4",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/marked": "*",
|
|
75
75
|
"@types/natural-compare": "*",
|
|
76
76
|
"@typescript-eslint/rule-schema-to-typescript-types": "6.9.1",
|
|
77
|
-
"@typescript-eslint/rule-tester": "6.9.1",
|
|
77
|
+
"@typescript-eslint/rule-tester": "6.9.2-alpha.1+c2ab78132",
|
|
78
78
|
"ajv": "^6.12.6",
|
|
79
79
|
"chalk": "^5.3.0",
|
|
80
80
|
"cross-fetch": "*",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"type": "opencollective",
|
|
104
104
|
"url": "https://opencollective.com/typescript-eslint"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "c2ab7813262bbcc53e71bfcc8a3e451b4984435e"
|
|
107
107
|
}
|