@typescript-eslint/eslint-plugin 8.31.1-alpha.1 → 8.31.1-alpha.2
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.
@@ -7,7 +7,7 @@ export type Options = [
|
|
7
7
|
checkTypePredicates?: boolean;
|
8
8
|
}
|
9
9
|
];
|
10
|
-
export type MessageId = 'alwaysFalsy' | 'alwaysFalsyFunc' | 'alwaysNullish' | 'alwaysTruthy' | 'alwaysTruthyFunc' | 'comparisonBetweenLiteralTypes' | 'never' | 'neverNullish' | 'neverOptionalChain' | 'noOverlapBooleanExpression' | 'noStrictNullCheck' | 'typeGuardAlreadyIsType';
|
10
|
+
export type MessageId = 'alwaysFalsy' | 'alwaysFalsyFunc' | 'alwaysNullish' | 'alwaysTruthy' | 'alwaysTruthyFunc' | 'comparisonBetweenLiteralTypes' | 'never' | 'neverNullish' | 'neverOptionalChain' | 'noOverlapBooleanExpression' | 'noStrictNullCheck' | 'suggestRemoveOptionalChain' | 'typeGuardAlreadyIsType';
|
11
11
|
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageId, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
12
12
|
export default _default;
|
13
13
|
//# sourceMappingURL=no-unnecessary-condition.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"no-unnecessary-condition.d.ts","sourceRoot":"","sources":["../../src/rules/no-unnecessary-condition.ts"],"names":[],"mappings":"AAyHA,KAAK,iCAAiC,GAAG,OAAO,CAAC;AAEjD,KAAK,2BAA2B,GAAG,QAAQ,GAAG,OAAO,GAAG,uBAAuB,CAAC;AAShF,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,2BAA2B,CAAC,EACxB,2BAA2B,GAC3B,iCAAiC,CAAC;QACtC,sDAAsD,CAAC,EAAE,OAAO,CAAC;QACjE,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B;CACF,CAAC;AAEF,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,+BAA+B,GAC/B,OAAO,GACP,cAAc,GACd,oBAAoB,GACpB,4BAA4B,GAC5B,mBAAmB,GACnB,wBAAwB,CAAC;;AAE7B,
|
1
|
+
{"version":3,"file":"no-unnecessary-condition.d.ts","sourceRoot":"","sources":["../../src/rules/no-unnecessary-condition.ts"],"names":[],"mappings":"AAyHA,KAAK,iCAAiC,GAAG,OAAO,CAAC;AAEjD,KAAK,2BAA2B,GAAG,QAAQ,GAAG,OAAO,GAAG,uBAAuB,CAAC;AAShF,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,2BAA2B,CAAC,EACxB,2BAA2B,GAC3B,iCAAiC,CAAC;QACtC,sDAAsD,CAAC,EAAE,OAAO,CAAC;QACjE,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B;CACF,CAAC;AAEF,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,+BAA+B,GAC/B,OAAO,GACP,cAAc,GACd,oBAAoB,GACpB,4BAA4B,GAC5B,mBAAmB,GACnB,4BAA4B,GAC5B,wBAAwB,CAAC;;AAE7B,wBA0wBG"}
|
@@ -123,7 +123,7 @@ exports.default = (0, util_1.createRule)({
|
|
123
123
|
recommended: 'strict',
|
124
124
|
requiresTypeChecking: true,
|
125
125
|
},
|
126
|
-
|
126
|
+
hasSuggestions: true,
|
127
127
|
messages: {
|
128
128
|
alwaysFalsy: 'Unnecessary conditional, value is always falsy.',
|
129
129
|
alwaysFalsyFunc: 'This callback should return a conditional, but return is always falsy.',
|
@@ -136,6 +136,7 @@ exports.default = (0, util_1.createRule)({
|
|
136
136
|
neverOptionalChain: 'Unnecessary optional chain on a non-nullish value.',
|
137
137
|
noOverlapBooleanExpression: 'Unnecessary conditional, the types have no overlap.',
|
138
138
|
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
|
139
|
+
suggestRemoveOptionalChain: 'Remove unnecessary optional chain',
|
139
140
|
typeGuardAlreadyIsType: 'Unnecessary conditional, expression already has the type being checked by the {{typeGuardOrAssertionFunction}}.',
|
140
141
|
},
|
141
142
|
schema: [
|
@@ -612,9 +613,14 @@ exports.default = (0, util_1.createRule)({
|
|
612
613
|
loc: questionDotOperator.loc,
|
613
614
|
node,
|
614
615
|
messageId: 'neverOptionalChain',
|
615
|
-
|
616
|
-
|
617
|
-
|
616
|
+
suggest: [
|
617
|
+
{
|
618
|
+
messageId: 'suggestRemoveOptionalChain',
|
619
|
+
fix(fixer) {
|
620
|
+
return fixer.replaceText(questionDotOperator, fix);
|
621
|
+
},
|
622
|
+
},
|
623
|
+
],
|
618
624
|
});
|
619
625
|
}
|
620
626
|
function checkOptionalMemberExpression(node) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
3
|
-
"version": "8.31.1-alpha.
|
3
|
+
"version": "8.31.1-alpha.2",
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -62,10 +62,10 @@
|
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
64
|
"@eslint-community/regexpp": "^4.10.0",
|
65
|
-
"@typescript-eslint/scope-manager": "8.31.1-alpha.
|
66
|
-
"@typescript-eslint/type-utils": "8.31.1-alpha.
|
67
|
-
"@typescript-eslint/utils": "8.31.1-alpha.
|
68
|
-
"@typescript-eslint/visitor-keys": "8.31.1-alpha.
|
65
|
+
"@typescript-eslint/scope-manager": "8.31.1-alpha.2",
|
66
|
+
"@typescript-eslint/type-utils": "8.31.1-alpha.2",
|
67
|
+
"@typescript-eslint/utils": "8.31.1-alpha.2",
|
68
|
+
"@typescript-eslint/visitor-keys": "8.31.1-alpha.2",
|
69
69
|
"graphemer": "^1.4.0",
|
70
70
|
"ignore": "^5.3.1",
|
71
71
|
"natural-compare": "^1.4.0",
|
@@ -75,8 +75,8 @@
|
|
75
75
|
"@types/marked": "^5.0.2",
|
76
76
|
"@types/mdast": "^4.0.3",
|
77
77
|
"@types/natural-compare": "*",
|
78
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.31.1-alpha.
|
79
|
-
"@typescript-eslint/rule-tester": "8.31.1-alpha.
|
78
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.31.1-alpha.2",
|
79
|
+
"@typescript-eslint/rule-tester": "8.31.1-alpha.2",
|
80
80
|
"@vitest/coverage-v8": "^3.1.1",
|
81
81
|
"ajv": "^6.12.6",
|
82
82
|
"cross-fetch": "*",
|