@typescript-eslint/eslint-plugin 8.24.2-alpha.4 → 8.25.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/dist/index.d.ts +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/no-misused-spread.d.ts +3 -2
- package/dist/rules/no-misused-spread.d.ts.map +1 -1
- package/dist/rules/no-misused-spread.js +50 -0
- package/dist/rules/return-await.d.ts.map +1 -1
- package/dist/rules/return-await.js +1 -10
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/isHigherPrecedenceThanAwait.d.ts +3 -0
- package/dist/util/isHigherPrecedenceThanAwait.d.ts.map +1 -0
- package/dist/util/isHigherPrecedenceThanAwait.js +46 -0
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
@@ -751,7 +751,7 @@ declare const _default: {
|
|
751
751
|
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOperator" | "removeVoid", import("./rules/no-meaningless-void-operator").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
752
752
|
'no-misused-new': import("@typescript-eslint/utils/ts-eslint").RuleModule<"errorMessageClass" | "errorMessageInterface", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
753
753
|
'no-misused-promises': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-misused-promises").MessageId, import("./rules/no-misused-promises").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
754
|
-
'no-misused-spread': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noArraySpreadInObject" | "noClassDeclarationSpreadInObject" | "noClassInstanceSpreadInObject" | "noFunctionSpreadInObject" | "noIterableSpreadInObject" | "noMapSpreadInObject" | "noPromiseSpreadInObject" | "noStringSpread", [{
|
754
|
+
'no-misused-spread': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addAwait" | "noArraySpreadInObject" | "noClassDeclarationSpreadInObject" | "noClassInstanceSpreadInObject" | "noFunctionSpreadInObject" | "noIterableSpreadInObject" | "noMapSpreadInObject" | "noPromiseSpreadInObject" | "noStringSpread" | "replaceMapSpreadInObject", [{
|
755
755
|
allow?: import("@typescript-eslint/type-utils").TypeOrValueSpecifier[];
|
756
756
|
}], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
757
757
|
'no-mixed-enums': import("@typescript-eslint/utils/ts-eslint").RuleModule<"mixed", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
package/dist/rules/index.d.ts
CHANGED
@@ -83,7 +83,7 @@ declare const rules: {
|
|
83
83
|
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOperator" | "removeVoid", import("./no-meaningless-void-operator").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
84
84
|
'no-misused-new': import("@typescript-eslint/utils/ts-eslint").RuleModule<"errorMessageClass" | "errorMessageInterface", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
85
85
|
'no-misused-promises': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./no-misused-promises").MessageId, import("./no-misused-promises").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
86
|
-
'no-misused-spread': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noArraySpreadInObject" | "noClassDeclarationSpreadInObject" | "noClassInstanceSpreadInObject" | "noFunctionSpreadInObject" | "noIterableSpreadInObject" | "noMapSpreadInObject" | "noPromiseSpreadInObject" | "noStringSpread", [{
|
86
|
+
'no-misused-spread': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addAwait" | "noArraySpreadInObject" | "noClassDeclarationSpreadInObject" | "noClassInstanceSpreadInObject" | "noFunctionSpreadInObject" | "noIterableSpreadInObject" | "noMapSpreadInObject" | "noPromiseSpreadInObject" | "noStringSpread" | "replaceMapSpreadInObject", [{
|
87
87
|
allow?: import("@typescript-eslint/type-utils").TypeOrValueSpecifier[];
|
88
88
|
}], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
89
89
|
'no-mixed-enums': import("@typescript-eslint/utils/ts-eslint").RuleModule<"mixed", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
@@ -1,10 +1,11 @@
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
1
2
|
import type { TypeOrValueSpecifier } from '../util';
|
2
3
|
type Options = [
|
3
4
|
{
|
4
5
|
allow?: TypeOrValueSpecifier[];
|
5
6
|
}
|
6
7
|
];
|
7
|
-
type MessageIds = 'noArraySpreadInObject' | 'noClassDeclarationSpreadInObject' | 'noClassInstanceSpreadInObject' | 'noFunctionSpreadInObject' | 'noIterableSpreadInObject' | 'noMapSpreadInObject' | 'noPromiseSpreadInObject' | 'noStringSpread';
|
8
|
-
declare const _default:
|
8
|
+
type MessageIds = 'addAwait' | 'noArraySpreadInObject' | 'noClassDeclarationSpreadInObject' | 'noClassInstanceSpreadInObject' | 'noFunctionSpreadInObject' | 'noIterableSpreadInObject' | 'noMapSpreadInObject' | 'noPromiseSpreadInObject' | 'noStringSpread' | 'replaceMapSpreadInObject';
|
9
|
+
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
|
9
10
|
export default _default;
|
10
11
|
//# sourceMappingURL=no-misused-spread.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"no-misused-spread.d.ts","sourceRoot":"","sources":["../../src/rules/no-misused-spread.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"no-misused-spread.d.ts","sourceRoot":"","sources":["../../src/rules/no-misused-spread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAMnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAepD,KAAK,OAAO,GAAG;IACb;QACE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;KAChC;CACF,CAAC;AAEF,KAAK,UAAU,GACX,UAAU,GACV,uBAAuB,GACvB,kCAAkC,GAClC,+BAA+B,GAC/B,0BAA0B,GAC1B,0BAA0B,GAC1B,qBAAqB,GACrB,yBAAyB,GACzB,gBAAgB,GAChB,0BAA0B,CAAC;;AAE/B,wBA2NG"}
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
33
33
|
};
|
34
34
|
})();
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
|
+
const utils_1 = require("@typescript-eslint/utils");
|
36
37
|
const tsutils = __importStar(require("ts-api-utils"));
|
37
38
|
const ts = __importStar(require("typescript"));
|
38
39
|
const util_1 = require("../util");
|
@@ -45,7 +46,9 @@ exports.default = (0, util_1.createRule)({
|
|
45
46
|
recommended: 'strict',
|
46
47
|
requiresTypeChecking: true,
|
47
48
|
},
|
49
|
+
hasSuggestions: true,
|
48
50
|
messages: {
|
51
|
+
addAwait: 'Add await operator.',
|
49
52
|
noArraySpreadInObject: 'Using the spread operator on an array in an object will result in a list of indices.',
|
50
53
|
noClassDeclarationSpreadInObject: 'Using the spread operator on class declarations will spread only their static properties, and will lose their class prototype.',
|
51
54
|
noClassInstanceSpreadInObject: 'Using the spread operator on class instances will lose their class prototype.',
|
@@ -60,6 +63,7 @@ exports.default = (0, util_1.createRule)({
|
|
60
63
|
'Consider using `Intl.Segmenter` for locale-aware string decomposition.',
|
61
64
|
"Otherwise, if you don't need to preserve emojis or other non-Ascii characters, disable this lint rule on this line or configure the 'allow' rule option.",
|
62
65
|
].join('\n'),
|
66
|
+
replaceMapSpreadInObject: 'Replace map spread in object with `Object.fromEntries()`',
|
63
67
|
},
|
64
68
|
schema: [
|
65
69
|
{
|
@@ -92,6 +96,50 @@ exports.default = (0, util_1.createRule)({
|
|
92
96
|
});
|
93
97
|
}
|
94
98
|
}
|
99
|
+
function getMapSpreadSuggestions(node, type) {
|
100
|
+
const types = tsutils.unionTypeParts(type);
|
101
|
+
if (types.some(t => !isMap(services.program, t))) {
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
if (node.parent.type === utils_1.AST_NODE_TYPES.ObjectExpression &&
|
105
|
+
node.parent.properties.length === 1) {
|
106
|
+
return [
|
107
|
+
{
|
108
|
+
messageId: 'replaceMapSpreadInObject',
|
109
|
+
fix: (0, util_1.getWrappingFixer)({
|
110
|
+
node: node.parent,
|
111
|
+
innerNode: node.argument,
|
112
|
+
sourceCode: context.sourceCode,
|
113
|
+
wrap: code => `Object.fromEntries(${code})`,
|
114
|
+
}),
|
115
|
+
},
|
116
|
+
];
|
117
|
+
}
|
118
|
+
return [
|
119
|
+
{
|
120
|
+
messageId: 'replaceMapSpreadInObject',
|
121
|
+
fix: (0, util_1.getWrappingFixer)({
|
122
|
+
node: node.argument,
|
123
|
+
sourceCode: context.sourceCode,
|
124
|
+
wrap: code => `Object.fromEntries(${code})`,
|
125
|
+
}),
|
126
|
+
},
|
127
|
+
];
|
128
|
+
}
|
129
|
+
function getPromiseSpreadSuggestions(node) {
|
130
|
+
const isHighPrecendence = (0, util_1.isHigherPrecedenceThanAwait)(services.esTreeNodeToTSNodeMap.get(node));
|
131
|
+
return [
|
132
|
+
{
|
133
|
+
messageId: 'addAwait',
|
134
|
+
fix: fixer => isHighPrecendence
|
135
|
+
? fixer.insertTextBefore(node, 'await ')
|
136
|
+
: [
|
137
|
+
fixer.insertTextBefore(node, 'await ('),
|
138
|
+
fixer.insertTextAfter(node, ')'),
|
139
|
+
],
|
140
|
+
},
|
141
|
+
];
|
142
|
+
}
|
95
143
|
function checkObjectSpread(node) {
|
96
144
|
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node.argument);
|
97
145
|
if ((0, util_1.typeMatchesSomeSpecifier)(type, options.allow, services.program)) {
|
@@ -101,6 +149,7 @@ exports.default = (0, util_1.createRule)({
|
|
101
149
|
context.report({
|
102
150
|
node,
|
103
151
|
messageId: 'noPromiseSpreadInObject',
|
152
|
+
suggest: getPromiseSpreadSuggestions(node.argument),
|
104
153
|
});
|
105
154
|
return;
|
106
155
|
}
|
@@ -115,6 +164,7 @@ exports.default = (0, util_1.createRule)({
|
|
115
164
|
context.report({
|
116
165
|
node,
|
117
166
|
messageId: 'noMapSpreadInObject',
|
167
|
+
suggest: getMapSpreadSuggestions(node, type),
|
118
168
|
});
|
119
169
|
return;
|
120
170
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"return-await.d.ts","sourceRoot":"","sources":["../../src/rules/return-await.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;;AAiCnE,
|
1
|
+
{"version":3,"file":"return-await.d.ts","sourceRoot":"","sources":["../../src/rules/return-await.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;;AAiCnE,wBAuXG"}
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const utils_1 = require("@typescript-eslint/utils");
|
37
37
|
const ts = __importStar(require("typescript"));
|
38
38
|
const util_1 = require("../util");
|
39
|
-
const getOperatorPrecedence_1 = require("../util/getOperatorPrecedence");
|
40
39
|
exports.default = (0, util_1.createRule)({
|
41
40
|
name: 'return-await',
|
42
41
|
meta: {
|
@@ -232,14 +231,6 @@ exports.default = (0, util_1.createRule)({
|
|
232
231
|
fixer.insertTextAfter(node, ')'),
|
233
232
|
];
|
234
233
|
}
|
235
|
-
function isHigherPrecedenceThanAwait(node) {
|
236
|
-
const operator = ts.isBinaryExpression(node)
|
237
|
-
? node.operatorToken.kind
|
238
|
-
: ts.SyntaxKind.Unknown;
|
239
|
-
const nodePrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(node.kind, operator);
|
240
|
-
const awaitPrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(ts.SyntaxKind.AwaitExpression, ts.SyntaxKind.Unknown);
|
241
|
-
return nodePrecedence > awaitPrecedence;
|
242
|
-
}
|
243
234
|
function test(node, expression) {
|
244
235
|
let child;
|
245
236
|
const isAwait = ts.isAwaitExpression(expression);
|
@@ -283,7 +274,7 @@ exports.default = (0, util_1.createRule)({
|
|
283
274
|
fixOrSuggest: useAutoFix ? 'fix' : 'suggest',
|
284
275
|
suggestion: {
|
285
276
|
messageId: 'requiredPromiseAwaitSuggestion',
|
286
|
-
fix: fixer => insertAwait(fixer, node, isHigherPrecedenceThanAwait(expression)),
|
277
|
+
fix: fixer => insertAwait(fixer, node, (0, util_1.isHigherPrecedenceThanAwait)(expression)),
|
287
278
|
},
|
288
279
|
}),
|
289
280
|
});
|
package/dist/util/index.d.ts
CHANGED
@@ -25,8 +25,9 @@ export * from './scopeUtils';
|
|
25
25
|
export * from './types';
|
26
26
|
export * from './getConstraintInfo';
|
27
27
|
export * from './getValueOfLiteralType';
|
28
|
-
export * from './
|
28
|
+
export * from './isHigherPrecedenceThanAwait';
|
29
29
|
export * from './skipChainExpression';
|
30
|
+
export * from './truthinessAndNullishUtils';
|
30
31
|
export * from '@typescript-eslint/type-utils';
|
31
32
|
export declare const applyDefault: typeof ESLintUtils.applyDefault, deepMerge: typeof ESLintUtils.deepMerge, getParserServices: typeof ESLintUtils.getParserServices, isObjectNotArray: typeof ESLintUtils.isObjectNotArray, nullThrows: typeof ESLintUtils.nullThrows, NullThrowsReasons: {
|
32
33
|
readonly MissingParent: "Expected node to have a parent.";
|
package/dist/util/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAG5C,cAAc,+BAA+B,CAAC;AAE9C,eAAO,MACL,YAAY,mCACZ,SAAS,gCACT,iBAAiB,wCACjB,gBAAgB,uCAChB,UAAU,iCACV,iBAAiB;;;CACJ,CAAC;AAChB,MAAM,MAAM,2BAA2B,CAAC,CAAC,IACvC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,MAAM,wBAAwB,CAAC,CAAC,IACpC,WAAW,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/util/index.js
CHANGED
@@ -42,8 +42,9 @@ __exportStar(require("./scopeUtils"), exports);
|
|
42
42
|
__exportStar(require("./types"), exports);
|
43
43
|
__exportStar(require("./getConstraintInfo"), exports);
|
44
44
|
__exportStar(require("./getValueOfLiteralType"), exports);
|
45
|
-
__exportStar(require("./
|
45
|
+
__exportStar(require("./isHigherPrecedenceThanAwait"), exports);
|
46
46
|
__exportStar(require("./skipChainExpression"), exports);
|
47
|
+
__exportStar(require("./truthinessAndNullishUtils"), exports);
|
47
48
|
// this is done for convenience - saves migrating all of the old rules
|
48
49
|
__exportStar(require("@typescript-eslint/type-utils"), exports);
|
49
50
|
exports.applyDefault = utils_1.ESLintUtils.applyDefault, exports.deepMerge = utils_1.ESLintUtils.deepMerge, exports.getParserServices = utils_1.ESLintUtils.getParserServices, exports.isObjectNotArray = utils_1.ESLintUtils.isObjectNotArray, exports.nullThrows = utils_1.ESLintUtils.nullThrows, exports.NullThrowsReasons = utils_1.ESLintUtils.NullThrowsReasons;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isHigherPrecedenceThanAwait.d.ts","sourceRoot":"","sources":["../../src/util/isHigherPrecedenceThanAwait.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAUpE"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
36
|
+
exports.isHigherPrecedenceThanAwait = isHigherPrecedenceThanAwait;
|
37
|
+
const ts = __importStar(require("typescript"));
|
38
|
+
const getOperatorPrecedence_1 = require("./getOperatorPrecedence");
|
39
|
+
function isHigherPrecedenceThanAwait(tsNode) {
|
40
|
+
const operator = ts.isBinaryExpression(tsNode)
|
41
|
+
? tsNode.operatorToken.kind
|
42
|
+
: ts.SyntaxKind.Unknown;
|
43
|
+
const nodePrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(tsNode.kind, operator);
|
44
|
+
const awaitPrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(ts.SyntaxKind.AwaitExpression, ts.SyntaxKind.Unknown);
|
45
|
+
return nodePrecedence > awaitPrecedence;
|
46
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.25.0",
|
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.
|
66
|
-
"@typescript-eslint/type-utils": "8.
|
67
|
-
"@typescript-eslint/utils": "8.
|
68
|
-
"@typescript-eslint/visitor-keys": "8.
|
65
|
+
"@typescript-eslint/scope-manager": "8.25.0",
|
66
|
+
"@typescript-eslint/type-utils": "8.25.0",
|
67
|
+
"@typescript-eslint/utils": "8.25.0",
|
68
|
+
"@typescript-eslint/visitor-keys": "8.25.0",
|
69
69
|
"graphemer": "^1.4.0",
|
70
70
|
"ignore": "^5.3.1",
|
71
71
|
"natural-compare": "^1.4.0",
|
@@ -76,8 +76,8 @@
|
|
76
76
|
"@types/marked": "^5.0.2",
|
77
77
|
"@types/mdast": "^4.0.3",
|
78
78
|
"@types/natural-compare": "*",
|
79
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.
|
80
|
-
"@typescript-eslint/rule-tester": "8.
|
79
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.25.0",
|
80
|
+
"@typescript-eslint/rule-tester": "8.25.0",
|
81
81
|
"ajv": "^6.12.6",
|
82
82
|
"cross-env": "^7.0.3",
|
83
83
|
"cross-fetch": "*",
|