Update checked-in dependencies
This commit is contained in:
parent
a66a5fe0e4
commit
f0c7f1d0c0
161 changed files with 888 additions and 3211 deletions
27
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
27
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
|
|
@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const util_1 = require("../util");
|
||||
const getForStatementHeadLoc_1 = require("../util/getForStatementHeadLoc");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'await-thenable',
|
||||
meta: {
|
||||
|
|
@ -36,7 +37,9 @@ exports.default = (0, util_1.createRule)({
|
|||
hasSuggestions: true,
|
||||
messages: {
|
||||
await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.',
|
||||
forAwaitOfNonThenable: 'Unexpected `for await...of` of a value that is not async iterable.',
|
||||
removeAwait: 'Remove unnecessary `await`.',
|
||||
convertToOrdinaryFor: 'Convert to an ordinary `for...of` loop.',
|
||||
},
|
||||
schema: [],
|
||||
type: 'problem',
|
||||
|
|
@ -68,6 +71,30 @@ exports.default = (0, util_1.createRule)({
|
|||
});
|
||||
}
|
||||
},
|
||||
'ForOfStatement[await=true]'(node) {
|
||||
const type = services.getTypeAtLocation(node.right);
|
||||
if ((0, util_1.isTypeAnyType)(type)) {
|
||||
return;
|
||||
}
|
||||
const asyncIteratorSymbol = tsutils.getWellKnownSymbolPropertyOfType(type, 'asyncIterator', checker);
|
||||
if (asyncIteratorSymbol == null) {
|
||||
context.report({
|
||||
loc: (0, getForStatementHeadLoc_1.getForStatementHeadLoc)(context.sourceCode, node),
|
||||
messageId: 'forAwaitOfNonThenable',
|
||||
suggest: [
|
||||
// Note that this suggestion causes broken code for sync iterables
|
||||
// of promises, since the loop variable is not awaited.
|
||||
{
|
||||
messageId: 'convertToOrdinaryFor',
|
||||
fix(fixer) {
|
||||
const awaitToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isAwaitKeyword), util_1.NullThrowsReasons.MissingToken('await', 'for await loop'));
|
||||
return fixer.remove(awaitToken);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"await-thenable.js","sourceRoot":"","sources":["../../src/rules/await-thenable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AAExC,kCAQiB;AAEjB,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,kDAAkD;YAC/D,WAAW,EAAE,aAAa;YAC1B,oBAAoB,EAAE,IAAI;SAC3B;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,KAAK,EAAE,6DAA6D;YACpE,WAAW,EAAE,6BAA6B;SAC3C;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAChB;IACD,cAAc,EAAE,EAAE;IAElB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,OAAO;YACL,eAAe,CAAC,IAAI;gBAClB,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACvD,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,IAAI,IAAA,wBAAiB,EAAC,IAAI,CAAC,EAAE,CAAC;oBACnD,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,CAAC;gBAED,MAAM,mBAAmB,GAAG,OAAO,CAAC,gCAAgC,CAClE,IAAI,EACJ,eAAe,EACf,OAAO,CACR,CAAC;gBAEF,IAAI,mBAAmB,IAAI,IAAI,EAAE,CAAC;oBAChC,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,EAAE,IAAA,+CAAsB,EAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;wBACrD,SAAS,EAAE,uBAAuB;wBAClC,OAAO,EAAE;4BACP,kEAAkE;4BAClE,uDAAuD;4BACvD;gCACE,SAAS,EAAE,sBAAsB;gCACjC,GAAG,CAAC,KAAK;oCACP,MAAM,UAAU,GAAG,IAAA,iBAAU,EAC3B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,qBAAc,CAAC,EACtD,wBAAiB,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAC1D,CAAC;oCACF,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gCAClC,CAAC;6BACF;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
|
|
@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const getMemberHeadLoc_1 = require("../util/getMemberHeadLoc");
|
||||
const rangeToLoc_1 = require("../util/rangeToLoc");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'explicit-member-accessibility',
|
||||
meta: {
|
||||
|
|
@ -110,7 +111,7 @@ exports.default = (0, util_1.createRule)({
|
|||
methodDefinition.accessibility === 'public') {
|
||||
const publicKeyword = findPublicKeyword(methodDefinition);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeyword.range),
|
||||
loc: (0, rangeToLoc_1.rangeToLoc)(context.sourceCode, publicKeyword.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
|
|
@ -209,7 +210,7 @@ exports.default = (0, util_1.createRule)({
|
|||
propertyDefinition.accessibility === 'public') {
|
||||
const publicKeywordRange = findPublicKeyword(propertyDefinition);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeywordRange.range),
|
||||
loc: (0, rangeToLoc_1.rangeToLoc)(context.sourceCode, publicKeywordRange.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
|
|
@ -265,7 +266,7 @@ exports.default = (0, util_1.createRule)({
|
|||
if (node.accessibility === 'public' && node.readonly) {
|
||||
const publicKeyword = findPublicKeyword(node);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeyword.range),
|
||||
loc: (0, rangeToLoc_1.rangeToLoc)(context.sourceCode, publicKeyword.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
|
|
@ -285,10 +286,4 @@ exports.default = (0, util_1.createRule)({
|
|||
};
|
||||
},
|
||||
});
|
||||
function rangeToLoc(sourceCode, range) {
|
||||
return {
|
||||
start: sourceCode.getLocFromIndex(range[0]),
|
||||
end: sourceCode.getLocFromIndex(range[1]),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=explicit-member-accessibility.js.map
|
||||
File diff suppressed because one or more lines are too long
12
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-deprecated.js
generated
vendored
12
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-deprecated.js
generated
vendored
|
|
@ -147,9 +147,15 @@ exports.default = (0, util_1.createRule)({
|
|||
}
|
||||
}
|
||||
function getJsDocDeprecation(symbol) {
|
||||
const tag = symbol
|
||||
?.getJsDocTags(checker)
|
||||
.find(tag => tag.name === 'deprecated');
|
||||
let jsDocTags;
|
||||
try {
|
||||
jsDocTags = symbol?.getJsDocTags(checker);
|
||||
}
|
||||
catch {
|
||||
// workaround for https://github.com/microsoft/TypeScript/issues/60024
|
||||
return;
|
||||
}
|
||||
const tag = jsDocTags?.find(tag => tag.name === 'deprecated');
|
||||
if (!tag) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-deprecated.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-deprecated.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js
generated
vendored
|
|
@ -577,6 +577,10 @@ function checkThenableOrVoidArgument(checker, node, type, index, thenableReturnI
|
|||
!thenableReturnIndices.has(index)) {
|
||||
voidReturnIndices.add(index);
|
||||
}
|
||||
const contextualType = checker.getContextualTypeForArgumentAtIndex(node, index);
|
||||
if (contextualType !== type) {
|
||||
checkThenableOrVoidArgument(checker, node, contextualType, index, thenableReturnIndices, voidReturnIndices);
|
||||
}
|
||||
}
|
||||
// Get the positions of arguments which are void functions (and not also
|
||||
// thenable functions). These are the candidates for the void-return check at
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js.map
generated
vendored
File diff suppressed because one or more lines are too long
31
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js
generated
vendored
31
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js
generated
vendored
|
|
@ -27,6 +27,7 @@ const utils_1 = require("@typescript-eslint/utils");
|
|||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const assertionFunctionUtils_1 = require("../util/assertionFunctionUtils");
|
||||
// Truthiness utilities
|
||||
// #region
|
||||
const isTruthyLiteral = (type) => tsutils.isTrueLiteralType(type) ||
|
||||
|
|
@ -80,6 +81,10 @@ exports.default = (0, util_1.createRule)({
|
|||
description: 'Whether to not error when running with a tsconfig that has strictNullChecks turned.',
|
||||
type: 'boolean',
|
||||
},
|
||||
checkTypePredicates: {
|
||||
description: 'Whether to check the asserted argument of a type predicate function for unnecessary conditions',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
|
|
@ -93,19 +98,22 @@ exports.default = (0, util_1.createRule)({
|
|||
neverNullish: 'Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.',
|
||||
alwaysNullish: 'Unnecessary conditional, left-hand side of `??` operator is always `null` or `undefined`.',
|
||||
literalBooleanExpression: 'Unnecessary conditional, both sides of the expression are literal values.',
|
||||
replaceWithTrue: 'Replace always true expression with `true`.',
|
||||
noOverlapBooleanExpression: 'Unnecessary conditional, the types have no overlap.',
|
||||
never: 'Unnecessary conditional, value is `never`.',
|
||||
neverOptionalChain: 'Unnecessary optional chain on a non-nullish value.',
|
||||
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
|
||||
typeGuardAlreadyIsType: 'Unnecessary conditional, expression already has the type being checked by the {{typeGuardOrAssertionFunction}}.',
|
||||
},
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allowConstantLoopConditions: false,
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
||||
checkTypePredicates: false,
|
||||
},
|
||||
],
|
||||
create(context, [{ allowConstantLoopConditions, allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing, },]) {
|
||||
create(context, [{ allowConstantLoopConditions, allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing, checkTypePredicates, },]) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
const compilerOptions = services.program.getCompilerOptions();
|
||||
|
|
@ -335,6 +343,27 @@ exports.default = (0, util_1.createRule)({
|
|||
checkNode(node.test);
|
||||
}
|
||||
function checkCallExpression(node) {
|
||||
if (checkTypePredicates) {
|
||||
const truthinessAssertedArgument = (0, assertionFunctionUtils_1.findTruthinessAssertedArgument)(services, node);
|
||||
if (truthinessAssertedArgument != null) {
|
||||
checkNode(truthinessAssertedArgument);
|
||||
}
|
||||
const typeGuardAssertedArgument = (0, assertionFunctionUtils_1.findTypeGuardAssertedArgument)(services, node);
|
||||
if (typeGuardAssertedArgument != null) {
|
||||
const typeOfArgument = (0, util_1.getConstrainedTypeAtLocation)(services, typeGuardAssertedArgument.argument);
|
||||
if (typeOfArgument === typeGuardAssertedArgument.type) {
|
||||
context.report({
|
||||
node: typeGuardAssertedArgument.argument,
|
||||
messageId: 'typeGuardAlreadyIsType',
|
||||
data: {
|
||||
typeGuardOrAssertionFunction: typeGuardAssertedArgument.asserts
|
||||
? 'assertion function'
|
||||
: 'type guard',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// If this is something like arr.filter(x => /*condition*/), check `condition`
|
||||
if ((0, util_1.isArrayMethodCallWithPredicate)(context, services, node) &&
|
||||
node.arguments.length) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const rangeToLoc_1 = require("../util/rangeToLoc");
|
||||
const evenNumOfBackslashesRegExp = /(?<!(?:[^\\]|^)(?:\\\\)*\\)/;
|
||||
// '\\$' <- false
|
||||
// '\\\\$' <- true
|
||||
|
|
@ -90,7 +91,10 @@ exports.default = (0, util_1.createRule)({
|
|||
isUnderlyingTypeString(node.expressions[0]);
|
||||
if (hasSingleStringVariable) {
|
||||
context.report({
|
||||
node: node.expressions[0],
|
||||
loc: (0, rangeToLoc_1.rangeToLoc)(context.sourceCode, [
|
||||
node.expressions[0].range[0] - 2,
|
||||
node.expressions[0].range[1] + 1,
|
||||
]),
|
||||
messageId: 'noUnnecessaryTemplateExpression',
|
||||
fix(fixer) {
|
||||
const wrappingCode = (0, util_1.getMovedNodeCode)({
|
||||
|
|
@ -191,20 +195,16 @@ exports.default = (0, util_1.createRule)({
|
|||
fixer.replaceTextRange([prevQuasi.range[1] - 3, prevQuasi.range[1] - 2], '\\$'),
|
||||
]);
|
||||
}
|
||||
const warnLocStart = prevQuasi.range[1] - 2;
|
||||
const warnLocEnd = nextQuasi.range[0] + 1;
|
||||
context.report({
|
||||
node: expression,
|
||||
loc: (0, rangeToLoc_1.rangeToLoc)(context.sourceCode, [warnLocStart, warnLocEnd]),
|
||||
messageId: 'noUnnecessaryTemplateExpression',
|
||||
fix(fixer) {
|
||||
return [
|
||||
// Remove the quasis' parts that are related to the current expression.
|
||||
fixer.removeRange([
|
||||
prevQuasi.range[1] - 2,
|
||||
expression.range[0],
|
||||
]),
|
||||
fixer.removeRange([
|
||||
expression.range[1],
|
||||
nextQuasi.range[0] + 1,
|
||||
]),
|
||||
fixer.removeRange([warnLocStart, expression.range[0]]),
|
||||
fixer.removeRange([expression.range[1], warnLocEnd]),
|
||||
...fixers.flatMap(cb => cb(fixer)),
|
||||
];
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
66
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-literal-enum-member.js
generated
vendored
66
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-literal-enum-member.js
generated
vendored
|
|
@ -12,7 +12,7 @@ exports.default = (0, util_1.createRule)({
|
|||
requiresTypeChecking: false,
|
||||
},
|
||||
messages: {
|
||||
notLiteral: `Explicit enum value must only be a literal value (string, number, boolean, etc).`,
|
||||
notLiteral: `Explicit enum value must only be a literal value (string or number).`,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
|
|
@ -59,48 +59,48 @@ exports.default = (0, util_1.createRule)({
|
|||
}
|
||||
return false;
|
||||
}
|
||||
function isAllowedBitwiseOperand(decl, node) {
|
||||
return (node.type === utils_1.AST_NODE_TYPES.Literal || isSelfEnumMember(decl, node));
|
||||
}
|
||||
return {
|
||||
TSEnumMember(node) {
|
||||
// If there is no initializer, then this node is just the name of the member, so ignore.
|
||||
if (node.initializer == null) {
|
||||
return;
|
||||
}
|
||||
// any old literal
|
||||
if (node.initializer.type === utils_1.AST_NODE_TYPES.Literal) {
|
||||
return;
|
||||
}
|
||||
// TemplateLiteral without expressions
|
||||
if (node.initializer.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
|
||||
node.initializer.expressions.length === 0) {
|
||||
return;
|
||||
}
|
||||
const declaration = node.parent.parent;
|
||||
// -1 and +1
|
||||
if (node.initializer.type === utils_1.AST_NODE_TYPES.UnaryExpression) {
|
||||
if (node.initializer.argument.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
['+', '-'].includes(node.initializer.operator)) {
|
||||
return;
|
||||
function isAllowedInitializerExpressionRecursive(node, partOfBitwiseComputation) {
|
||||
// You can only refer to an enum member if it's part of a bitwise computation.
|
||||
// so C = B isn't allowed (special case), but C = A | B is.
|
||||
if (partOfBitwiseComputation && isSelfEnumMember(declaration, node)) {
|
||||
return true;
|
||||
}
|
||||
if (allowBitwiseExpressions &&
|
||||
node.initializer.operator === '~' &&
|
||||
isAllowedBitwiseOperand(declaration, node.initializer.argument)) {
|
||||
return;
|
||||
switch (node.type) {
|
||||
// any old literal
|
||||
case utils_1.AST_NODE_TYPES.Literal:
|
||||
return true;
|
||||
// TemplateLiteral without expressions
|
||||
case utils_1.AST_NODE_TYPES.TemplateLiteral:
|
||||
return node.expressions.length === 0;
|
||||
case utils_1.AST_NODE_TYPES.UnaryExpression:
|
||||
// +123, -123, etc.
|
||||
if (['+', '-'].includes(node.operator)) {
|
||||
return isAllowedInitializerExpressionRecursive(node.argument, partOfBitwiseComputation);
|
||||
}
|
||||
if (allowBitwiseExpressions) {
|
||||
return (node.operator === '~' &&
|
||||
isAllowedInitializerExpressionRecursive(node.argument, true));
|
||||
}
|
||||
return false;
|
||||
case utils_1.AST_NODE_TYPES.BinaryExpression:
|
||||
if (allowBitwiseExpressions) {
|
||||
return (['|', '&', '^', '<<', '>>', '>>>'].includes(node.operator) &&
|
||||
isAllowedInitializerExpressionRecursive(node.left, true) &&
|
||||
isAllowedInitializerExpressionRecursive(node.right, true));
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (node.initializer.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||
node.initializer.argument.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
(['+', '-'].includes(node.initializer.operator) ||
|
||||
(allowBitwiseExpressions && node.initializer.operator === '~'))) {
|
||||
return;
|
||||
}
|
||||
if (allowBitwiseExpressions &&
|
||||
node.initializer.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
|
||||
['|', '&', '^', '<<', '>>', '>>>'].includes(node.initializer.operator) &&
|
||||
isAllowedBitwiseOperand(declaration, node.initializer.left) &&
|
||||
isAllowedBitwiseOperand(declaration, node.initializer.right)) {
|
||||
if (isAllowedInitializerExpressionRecursive(node.initializer, false)) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"prefer-literal-enum-member.js","sourceRoot":"","sources":["../../src/rules/prefer-literal-enum-member.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAA2D;AAE3D,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;YAC5D,WAAW,EAAE,QAAQ;YACrB,oBAAoB,EAAE,KAAK;SAC5B;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,kFAAkF;SAC/F;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,uBAAuB,EAAE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/rules/prefer-optional-chain.js
generated
vendored
29
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js
generated
vendored
|
|
@ -1,30 +1,6 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const analyzeChain_1 = require("./prefer-optional-chain-utils/analyzeChain");
|
||||
const checkNullishAndReport_1 = require("./prefer-optional-chain-utils/checkNullishAndReport");
|
||||
|
|
@ -117,10 +93,7 @@ exports.default = (0, util_1.createRule)({
|
|||
function isLeftSideLowerPrecedence() {
|
||||
const logicalTsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
||||
const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(leftNode);
|
||||
const operator = ts.isBinaryExpression(logicalTsNode)
|
||||
? logicalTsNode.operatorToken.kind
|
||||
: ts.SyntaxKind.Unknown;
|
||||
const leftPrecedence = (0, util_1.getOperatorPrecedence)(leftTsNode.kind, operator);
|
||||
const leftPrecedence = (0, util_1.getOperatorPrecedence)(leftTsNode.kind, logicalTsNode.operatorToken.kind);
|
||||
return leftPrecedence < util_1.OperatorPrecedence.LeftHandSide;
|
||||
}
|
||||
(0, checkNullishAndReport_1.checkNullishAndReport)(context, parserServices, options, [leftNode], {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"prefer-optional-chain.js","sourceRoot":"","sources":["../../src/rules/prefer-optional-chain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAE1D,+CAAiC;AAEjC,kCAKiB;AACjB,6EAA0E;AAC1E,+FAA4F;AAE5F,+FAG6D;AAM7D,kBAAe,IAAA,iBAAU,EAGvB;IACA,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,yHAAyH;YAC3H,WAAW,EAAE,WAAW;YACxB,oBAAoB,EAAE,IAAI;SAC3B;QACD,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,mBAAmB,EACjB,6FAA6F;YAC/F,oBAAoB,EAAE,8BAA8B;SACrD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,kFAAkF;qBACrF;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,sFAAsF;qBACzF;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,qFAAqF;qBACxF;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;wBACf,WAAW,EAC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CAC3B,UAAU,CAAC,KAAK,EAChB,GAAG,oBAAoB,KAAK,oBAAoB,EAAE,CACnD,CAAC;4BACJ,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;YAED,mCAAmC,CACjC,IAAgC;gBAEhC,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,OAAO;gBACT,CAAC;gBAED,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAA,6CAAqB,EAC3D,IAAI,EACJ,cAAc,EACd,OAAO,CAAC,UAAU,EAClB,OAAO,CACR,CAAC;gBACF,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;oBACxC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC5B,CAAC;gBAED,IAAI,YAAY,GAAmB,EAAE,CAAC;gBACtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,IAAI,OAAO,CAAC,IAAI,4CAA4B,EAAE,CAAC;wBAC7C,IAAA,2BAAY,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,QAAQ,EACb,YAAY,CACb,CAAC;wBACF,YAAY,GAAG,EAAE,CAAC;oBACpB,CAAC;yBAAM,CAAC;wBACN,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBAED,qCAAqC;gBACrC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC5B,IAAA,2BAAY,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,QAAQ,EACb,YAAY,CACb,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"prefer-optional-chain.js","sourceRoot":"","sources":["../../src/rules/prefer-optional-chain.ts"],"names":[],"mappings":";;AACA,oDAA0D;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,CAAC,IAAI,4CAA4B,EAAE,CAAC;wBAC7C,IAAA,2BAAY,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,QAAQ,EACb,YAAY,CACb,CAAC;wBACF,YAAY,GAAG,EAAE,CAAC;oBACpB,CAAC;yBAAM,CAAC;wBACN,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBAED,qCAAqC;gBACrC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC5B,IAAA,2BAAY,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,QAAQ,EACb,YAAY,CACb,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
|
|
@ -375,9 +375,7 @@ exports.default = (0, util_1.createRule)({
|
|||
].join(', ')](node) {
|
||||
const callNode = getParent(node);
|
||||
const parentNode = getParent(callNode);
|
||||
if (!isEqualityComparison(parentNode) ||
|
||||
!isNull(parentNode.right) ||
|
||||
!isStringType(node.object)) {
|
||||
if (!isNull(parentNode.right) || !isStringType(node.object)) {
|
||||
return;
|
||||
}
|
||||
const parsed = callNode.arguments.length === 1
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
96
node_modules/@typescript-eslint/eslint-plugin/dist/rules/strict-boolean-expressions.js
generated
vendored
96
node_modules/@typescript-eslint/eslint-plugin/dist/rules/strict-boolean-expressions.js
generated
vendored
|
|
@ -27,6 +27,7 @@ const utils_1 = require("@typescript-eslint/utils");
|
|||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const assertionFunctionUtils_1 = require("../util/assertionFunctionUtils");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'strict-boolean-expressions',
|
||||
meta: {
|
||||
|
|
@ -187,104 +188,11 @@ exports.default = (0, util_1.createRule)({
|
|||
traverseNode(node.right, isCondition);
|
||||
}
|
||||
function traverseCallExpression(node) {
|
||||
const assertedArgument = findAssertedArgument(node);
|
||||
const assertedArgument = (0, assertionFunctionUtils_1.findTruthinessAssertedArgument)(services, node);
|
||||
if (assertedArgument != null) {
|
||||
traverseNode(assertedArgument, true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Inspect a call expression to see if it's a call to an assertion function.
|
||||
* If it is, return the node of the argument that is asserted.
|
||||
*/
|
||||
function findAssertedArgument(node) {
|
||||
// If the call looks like `assert(expr1, expr2, ...c, d, e, f)`, then we can
|
||||
// only care if `expr1` or `expr2` is asserted, since anything that happens
|
||||
// within or after a spread argument is out of scope to reason about.
|
||||
const checkableArguments = [];
|
||||
for (const argument of node.arguments) {
|
||||
if (argument.type === utils_1.AST_NODE_TYPES.SpreadElement) {
|
||||
break;
|
||||
}
|
||||
checkableArguments.push(argument);
|
||||
}
|
||||
// nothing to do
|
||||
if (checkableArguments.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
// Game plan: we're going to check the type of the callee. If it has call
|
||||
// signatures and they _ALL_ agree that they assert on a parameter at the
|
||||
// _SAME_ position, we'll consider the argument in that position to be an
|
||||
// asserted argument.
|
||||
const calleeType = (0, util_1.getConstrainedTypeAtLocation)(services, node.callee);
|
||||
const callSignatures = tsutils.getCallSignaturesOfType(calleeType);
|
||||
let assertedParameterIndex = undefined;
|
||||
for (const signature of callSignatures) {
|
||||
const declaration = signature.getDeclaration();
|
||||
const returnTypeAnnotation = declaration.type;
|
||||
// Be sure we're dealing with a truthiness assertion function.
|
||||
if (!(returnTypeAnnotation != null &&
|
||||
ts.isTypePredicateNode(returnTypeAnnotation) &&
|
||||
// This eliminates things like `x is string` and `asserts x is T`
|
||||
// leaving us with just the `asserts x` cases.
|
||||
returnTypeAnnotation.type == null &&
|
||||
// I think this is redundant but, still, it needs to be true
|
||||
returnTypeAnnotation.assertsModifier != null)) {
|
||||
return undefined;
|
||||
}
|
||||
const assertionTarget = returnTypeAnnotation.parameterName;
|
||||
if (assertionTarget.kind !== ts.SyntaxKind.Identifier) {
|
||||
// This can happen when asserting on `this`. Ignore!
|
||||
return undefined;
|
||||
}
|
||||
// If the first parameter is `this`, skip it, so that our index matches
|
||||
// the index of the argument at the call site.
|
||||
const firstParameter = declaration.parameters.at(0);
|
||||
const nonThisParameters = firstParameter?.name.kind === ts.SyntaxKind.Identifier &&
|
||||
firstParameter.name.text === 'this'
|
||||
? declaration.parameters.slice(1)
|
||||
: declaration.parameters;
|
||||
// Don't bother inspecting parameters past the number of
|
||||
// arguments we have at the call site.
|
||||
const checkableNonThisParameters = nonThisParameters.slice(0, checkableArguments.length);
|
||||
let assertedParameterIndexForThisSignature;
|
||||
for (const [index, parameter] of checkableNonThisParameters.entries()) {
|
||||
if (parameter.dotDotDotToken != null) {
|
||||
// Cannot assert a rest parameter, and can't have a rest parameter
|
||||
// before the asserted parameter. It's not only a TS error, it's
|
||||
// not something we can logically make sense of, so give up here.
|
||||
return undefined;
|
||||
}
|
||||
if (parameter.name.kind !== ts.SyntaxKind.Identifier) {
|
||||
// Only identifiers are valid for assertion targets, so skip over
|
||||
// anything like `{ destructuring: parameter }: T`
|
||||
continue;
|
||||
}
|
||||
// we've found a match between the "target"s in
|
||||
// `function asserts(target: T): asserts target;`
|
||||
if (parameter.name.text === assertionTarget.text) {
|
||||
assertedParameterIndexForThisSignature = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (assertedParameterIndexForThisSignature == null) {
|
||||
// Didn't find an assertion target in this signature that could match
|
||||
// the call site.
|
||||
return undefined;
|
||||
}
|
||||
if (assertedParameterIndex != null &&
|
||||
assertedParameterIndex !== assertedParameterIndexForThisSignature) {
|
||||
// The asserted parameter we found for this signature didn't match
|
||||
// previous signatures.
|
||||
return undefined;
|
||||
}
|
||||
assertedParameterIndex = assertedParameterIndexForThisSignature;
|
||||
}
|
||||
// Didn't find a unique assertion index.
|
||||
if (assertedParameterIndex == null) {
|
||||
return undefined;
|
||||
}
|
||||
return checkableArguments[assertedParameterIndex];
|
||||
}
|
||||
/**
|
||||
* Inspects any node.
|
||||
*
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
109
node_modules/@typescript-eslint/eslint-plugin/dist/util/assertionFunctionUtils.js
generated
vendored
Normal file
109
node_modules/@typescript-eslint/eslint-plugin/dist/util/assertionFunctionUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.findTruthinessAssertedArgument = findTruthinessAssertedArgument;
|
||||
exports.findTypeGuardAssertedArgument = findTypeGuardAssertedArgument;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
/**
|
||||
* Inspect a call expression to see if it's a call to an assertion function.
|
||||
* If it is, return the node of the argument that is asserted.
|
||||
*/
|
||||
function findTruthinessAssertedArgument(services, node) {
|
||||
// If the call looks like `assert(expr1, expr2, ...c, d, e, f)`, then we can
|
||||
// only care if `expr1` or `expr2` is asserted, since anything that happens
|
||||
// within or after a spread argument is out of scope to reason about.
|
||||
const checkableArguments = [];
|
||||
for (const argument of node.arguments) {
|
||||
if (argument.type === utils_1.AST_NODE_TYPES.SpreadElement) {
|
||||
break;
|
||||
}
|
||||
checkableArguments.push(argument);
|
||||
}
|
||||
// nothing to do
|
||||
if (checkableArguments.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const checker = services.program.getTypeChecker();
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const signature = checker.getResolvedSignature(tsNode);
|
||||
if (signature == null) {
|
||||
return undefined;
|
||||
}
|
||||
const firstTypePredicateResult = checker.getTypePredicateOfSignature(signature);
|
||||
if (firstTypePredicateResult == null) {
|
||||
return undefined;
|
||||
}
|
||||
const { parameterIndex, kind, type } = firstTypePredicateResult;
|
||||
if (!(kind === ts.TypePredicateKind.AssertsIdentifier && type == null)) {
|
||||
return undefined;
|
||||
}
|
||||
return checkableArguments.at(parameterIndex);
|
||||
}
|
||||
/**
|
||||
* Inspect a call expression to see if it's a call to an assertion function.
|
||||
* If it is, return the node of the argument that is asserted and other useful info.
|
||||
*/
|
||||
function findTypeGuardAssertedArgument(services, node) {
|
||||
// If the call looks like `assert(expr1, expr2, ...c, d, e, f)`, then we can
|
||||
// only care if `expr1` or `expr2` is asserted, since anything that happens
|
||||
// within or after a spread argument is out of scope to reason about.
|
||||
const checkableArguments = [];
|
||||
for (const argument of node.arguments) {
|
||||
if (argument.type === utils_1.AST_NODE_TYPES.SpreadElement) {
|
||||
break;
|
||||
}
|
||||
checkableArguments.push(argument);
|
||||
}
|
||||
// nothing to do
|
||||
if (checkableArguments.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const checker = services.program.getTypeChecker();
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const callSignature = checker.getResolvedSignature(tsNode);
|
||||
if (callSignature == null) {
|
||||
return undefined;
|
||||
}
|
||||
const typePredicateInfo = checker.getTypePredicateOfSignature(callSignature);
|
||||
if (typePredicateInfo == null) {
|
||||
return undefined;
|
||||
}
|
||||
const { parameterIndex, kind, type } = typePredicateInfo;
|
||||
if (!((kind === ts.TypePredicateKind.AssertsIdentifier ||
|
||||
kind === ts.TypePredicateKind.Identifier) &&
|
||||
type != null)) {
|
||||
return undefined;
|
||||
}
|
||||
if (parameterIndex >= checkableArguments.length) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
type,
|
||||
asserts: kind === ts.TypePredicateKind.AssertsIdentifier,
|
||||
argument: checkableArguments[parameterIndex],
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=assertionFunctionUtils.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/assertionFunctionUtils.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/assertionFunctionUtils.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"assertionFunctionUtils.js","sourceRoot":"","sources":["../../src/util/assertionFunctionUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,wEAyCC;AAMD,sEA4DC;AAlHD,oDAA0D;AAC1D,+CAAiC;AAEjC;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,QAA2C,EAC3C,IAA6B;IAE7B,4EAA4E;IAC5E,2EAA2E;IAC3E,qEAAqE;IACrE,MAAM,kBAAkB,GAA0B,EAAE,CAAC;IACrD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,IAAI,QAAQ,CAAC,IAAI,KAAK,sBAAc,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM;QACR,CAAC;QACD,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB;IAChB,IAAI,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KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;IAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE3D,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,iBAAiB,GAAG,OAAO,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;IAE7E,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC;IACzD,IACE,CAAC,CACC,CAAC,IAAI,KAAK,EAAE,CAAC,iBAAiB,CAAC,iBAAiB;QAC9C,IAAI,KAAK,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC;QAC3C,IAAI,IAAI,IAAI,CACb,EACD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,cAAc,IAAI,kBAAkB,CAAC,MAAM,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC,iBAAiB,CAAC,iBAAiB;QACxD,QAAQ,EAAE,kBAAkB,CAAC,cAAc,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
generated
vendored
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
generated
vendored
|
|
@ -34,6 +34,7 @@ __exportStar(require("./misc"), exports);
|
|||
__exportStar(require("./needsPrecedingSemiColon"), exports);
|
||||
__exportStar(require("./objectIterators"), exports);
|
||||
__exportStar(require("./scopeUtils"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./isAssignee"), exports);
|
||||
__exportStar(require("./getFixOrSuggest"), exports);
|
||||
__exportStar(require("./isArrayMethodCallWithPredicate"), exports);
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,+CAA6B;AAE7B,+CAA6B;AAC7B,oDAAkC;AAClC,mEAAiD;AAEjD,sEAAsE;AACtE,gEAA8C;AAC9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,4CAAgB;AAChB,8CAAiB;AACjB,gCAAU;AAGV,8CAAiB"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B;AAC7B,oDAAkC;AAClC,mEAAiD;AAEjD,sEAAsE;AACtE,gEAA8C;AAC9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,4CAAgB;AAChB,8CAAiB;AACjB,gCAAU;AAGV,8CAAiB"}
|
||||
10
node_modules/@typescript-eslint/eslint-plugin/dist/util/rangeToLoc.js
generated
vendored
Normal file
10
node_modules/@typescript-eslint/eslint-plugin/dist/util/rangeToLoc.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rangeToLoc = rangeToLoc;
|
||||
function rangeToLoc(sourceCode, range) {
|
||||
return {
|
||||
start: sourceCode.getLocFromIndex(range[0]),
|
||||
end: sourceCode.getLocFromIndex(range[1]),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=rangeToLoc.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/rangeToLoc.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/util/rangeToLoc.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"rangeToLoc.js","sourceRoot":"","sources":["../../src/util/rangeToLoc.ts"],"names":[],"mappings":";;AAEA,gCAQC;AARD,SAAgB,UAAU,CACxB,UAA+B,EAC/B,KAAyB;IAEzB,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3C,GAAG,EAAE,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
||||
84
node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.mdx
generated
vendored
84
node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.mdx
generated
vendored
|
|
@ -10,9 +10,9 @@ import TabItem from '@theme/TabItem';
|
|||
> See **https://typescript-eslint.io/rules/await-thenable** for documentation.
|
||||
|
||||
A "Thenable" value is an object which has a `then` method, such as a Promise.
|
||||
The `await` keyword is generally used to retrieve the result of calling a Thenable's `then` method.
|
||||
The [`await` keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) is generally used to retrieve the result of calling a Thenable's `then` method.
|
||||
|
||||
If the `await` keyword is used on a value that is not a Thenable, the value is directly resolved immediately.
|
||||
If the `await` keyword is used on a value that is not a Thenable, the value is directly resolved, but will still pause execution until the next microtask.
|
||||
While doing so is valid JavaScript, it is often a programmer error, such as forgetting to add parenthesis to call a function that returns a Promise.
|
||||
|
||||
## Examples
|
||||
|
|
@ -40,6 +40,86 @@ await createValue();
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Async Iteration (`for await...of` Loops)
|
||||
|
||||
This rule also inspects [`for await...of` statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of), and reports if the value being iterated over is not async-iterable.
|
||||
|
||||
:::info[Why does the rule report on `for await...of` loops used on an array of Promises?]
|
||||
|
||||
While `for await...of` can be used with synchronous iterables, and it will await each promise produced by the iterable, it is inadvisable to do so.
|
||||
There are some tiny nuances that you may want to consider.
|
||||
|
||||
The biggest difference between using `for await...of` and using `for...of` (plus awaiting each result yourself) is error handling.
|
||||
When an error occurs within the loop body, `for await...of` does _not_ close the original sync iterable, while `for...of` does.
|
||||
For detailed examples of this, see the [MDN documentation on using `for await...of` with sync-iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#iterating_over_sync_iterables_and_generators).
|
||||
|
||||
Also consider whether you need sequential awaiting at all. Using `for await...of` may obscure potential opportunities for concurrent processing, such as those reported by [`no-await-in-loop`](https://eslint.org/docs/latest/rules/no-await-in-loop). Consider instead using one of the [promise concurrency methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#promise_concurrency) for better performance.
|
||||
|
||||
:::
|
||||
|
||||
### Examples
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="❌ Incorrect">
|
||||
|
||||
```ts
|
||||
async function syncIterable() {
|
||||
const arrayOfValues = [1, 2, 3];
|
||||
for await (const value of arrayOfValues) {
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
|
||||
async function syncIterableOfPromises() {
|
||||
const arrayOfPromises = [
|
||||
Promise.resolve(1),
|
||||
Promise.resolve(2),
|
||||
Promise.resolve(3),
|
||||
];
|
||||
for await (const promisedValue of arrayOfPromises) {
|
||||
console.log(promisedValue);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="✅ Correct">
|
||||
|
||||
```ts
|
||||
async function syncIterable() {
|
||||
const arrayOfValues = [1, 2, 3];
|
||||
for (const value of arrayOfValues) {
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
|
||||
async function syncIterableOfPromises() {
|
||||
const arrayOfPromises = [
|
||||
Promise.resolve(1),
|
||||
Promise.resolve(2),
|
||||
Promise.resolve(3),
|
||||
];
|
||||
for (const promisedValue of await Promise.all(arrayOfPromises)) {
|
||||
console.log(promisedValue);
|
||||
}
|
||||
}
|
||||
|
||||
async function validUseOfForAwaitOnAsyncIterable() {
|
||||
async function* yieldThingsAsynchronously() {
|
||||
yield 1;
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
yield 2;
|
||||
}
|
||||
|
||||
for await (const promisedValue of yieldThingsAsynchronously()) {
|
||||
console.log(promisedValue);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## When Not To Use It
|
||||
|
||||
If you want to allow code to `await` non-Promise values.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ For example, given `type A = string` and `type T = string | A`, this rule would
|
|||
|
||||
This rule also disallows explicitly listing `undefined` in a type union when a function parameter is marked as optional.
|
||||
Doing so is unnecessary.
|
||||
Please note that this check only applies to parameters, not properties.
|
||||
Therefore, it does not conflict with the [`exactOptionalPropertyTypes`](https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes) TypeScript compiler setting.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="❌ Incorrect">
|
||||
|
|
|
|||
40
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.mdx
generated
vendored
40
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.mdx
generated
vendored
|
|
@ -90,6 +90,46 @@ for (; true; ) {}
|
|||
do {} while (true);
|
||||
```
|
||||
|
||||
### `checkTypePredicates`
|
||||
|
||||
Example of additional incorrect code with `{ checkTypePredicates: true }`:
|
||||
|
||||
```ts option='{ "checkTypePredicates": true }' showPlaygroundButton
|
||||
function assert(condition: unknown): asserts condition {
|
||||
if (!condition) {
|
||||
throw new Error('Condition is falsy');
|
||||
}
|
||||
}
|
||||
|
||||
assert(false); // Unnecessary; condition is always falsy.
|
||||
|
||||
const neverNull = {};
|
||||
assert(neverNull); // Unnecessary; condition is always truthy.
|
||||
|
||||
function isString(value: unknown): value is string {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
|
||||
declare const s: string;
|
||||
|
||||
// Unnecessary; s is always a string.
|
||||
if (isString(s)) {
|
||||
}
|
||||
|
||||
function assertIsString(value: unknown): asserts value is string {
|
||||
if (!isString(value)) {
|
||||
throw new Error('Value is not a string');
|
||||
}
|
||||
}
|
||||
|
||||
assertIsString(s); // Unnecessary; s is always a string.
|
||||
```
|
||||
|
||||
Whether this option makes sense for your project may vary.
|
||||
Some projects may intentionally use type predicates to ensure that runtime values do indeed match the types according to TypeScript, especially in test code.
|
||||
Often, it makes sense to use eslint-disable comments in these cases, with a comment indicating why the condition should be checked at runtime, despite appearing unnecessary.
|
||||
However, in some contexts, it may be more appropriate to keep this option disabled entirely.
|
||||
|
||||
### `allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing`
|
||||
|
||||
:::danger Deprecated
|
||||
|
|
|
|||
28
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.mdx
generated
vendored
28
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.mdx
generated
vendored
|
|
@ -9,7 +9,9 @@ import TabItem from '@theme/TabItem';
|
|||
>
|
||||
> See **https://typescript-eslint.io/rules/no-unsafe-enum-comparison** for documentation.
|
||||
|
||||
The TypeScript compiler can be surprisingly lenient when working with enums. String enums are widely considered to be safer than number enums, but even string enums have some pitfalls. For example, it is allowed to compare enum values against literals:
|
||||
The TypeScript compiler can be surprisingly lenient when working with enums.
|
||||
While overt safety problems with enums were [resolved in TypeScript 5.0](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#all-enums-are-union-enums), some logical pitfalls remain permitted.
|
||||
For example, it is allowed to compare enum values against non-enum values:
|
||||
|
||||
```ts
|
||||
enum Vegetable {
|
||||
|
|
@ -21,7 +23,9 @@ declare const vegetable: Vegetable;
|
|||
vegetable === 'asparagus'; // No error
|
||||
```
|
||||
|
||||
The above code snippet should instead be written as `vegetable === Vegetable.Asparagus`. Allowing literals in comparisons subverts the point of using enums in the first place. By enforcing comparisons with properly typed enums:
|
||||
The above code snippet should instead be written as `vegetable === Vegetable.Asparagus`.
|
||||
Allowing non-enums in comparisons subverts the point of using enums in the first place.
|
||||
By enforcing comparisons with properly typed enums:
|
||||
|
||||
- It makes a codebase more resilient to enum members changing values.
|
||||
- It allows for code IDEs to use the "Rename Symbol" feature to quickly rename an enum.
|
||||
|
|
@ -39,17 +43,22 @@ enum Fruit {
|
|||
|
||||
declare let fruit: Fruit;
|
||||
|
||||
// bad - comparison between enum and explicit value instead of named enum member
|
||||
fruit === 0;
|
||||
```
|
||||
|
||||
```ts
|
||||
enum Vegetable {
|
||||
Asparagus = 'asparagus',
|
||||
}
|
||||
|
||||
declare let vegetable: Vegetable;
|
||||
|
||||
// bad - comparison between enum and explicit value instead of named enum member
|
||||
vegetable === 'asparagus';
|
||||
|
||||
declare let anyString: string;
|
||||
|
||||
// bad - comparison between enum and non-enum value
|
||||
anyString === Vegetable.Asparagus;
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
|
@ -63,9 +72,7 @@ enum Fruit {
|
|||
declare let fruit: Fruit;
|
||||
|
||||
fruit === Fruit.Apple;
|
||||
```
|
||||
|
||||
```ts
|
||||
enum Vegetable {
|
||||
Asparagus = 'asparagus',
|
||||
}
|
||||
|
|
@ -80,7 +87,12 @@ vegetable === Vegetable.Asparagus;
|
|||
|
||||
## When Not To Use It
|
||||
|
||||
If you don't mind number and/or literal string constants being compared against enums, you likely don't need this rule.
|
||||
If you don't mind enums being treated as a namespaced bag of values, rather than opaque identifiers, you likely don't need this rule.
|
||||
|
||||
Separately, in the rare case of relying on an third party enums that are only imported as `type`s, it may be difficult to adhere to this rule.
|
||||
Sometimes, you may want to ingest a value from an API or user input, then use it as an enum throughout your application.
|
||||
While validating the input, it may be appropriate to disable the rule.
|
||||
Alternately, you might consider making use of a validation library like [Zod](https://zod.dev/?id=native-enums).
|
||||
See further discussion of this topic in [#8557](https://github.com/typescript-eslint/typescript-eslint/issues/8557).
|
||||
|
||||
Finally, in the rare case of relying on an third party enums that are only imported as `type`s, it may be difficult to adhere to this rule.
|
||||
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
|
||||
|
|
|
|||
17
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx
generated
vendored
17
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx
generated
vendored
|
|
@ -38,12 +38,14 @@ This rule reports when an enum member is given a value that is not a literal.
|
|||
|
||||
```ts
|
||||
const str = 'Test';
|
||||
const string1 = 'string1';
|
||||
const string2 = 'string2';
|
||||
|
||||
enum Invalid {
|
||||
A = str, // Variable assignment
|
||||
B = {}, // Object assignment
|
||||
C = `A template literal string`, // Template literal
|
||||
D = new Set(1, 2, 3), // Constructor in assignment
|
||||
E = 2 + 2, // Expression assignment
|
||||
B = `Interpolates ${string1} and ${string2}`, // Template literal with interpolation
|
||||
C = 2 + 2, // Expression assignment
|
||||
D = C, // Assignment to another enum member
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -52,11 +54,10 @@ enum Invalid {
|
|||
|
||||
```ts
|
||||
enum Valid {
|
||||
A,
|
||||
A, // No initializer; initialized with ascending integers starting from 0
|
||||
B = 'TestStr', // A regular string
|
||||
C = 4, // A number
|
||||
D = null,
|
||||
E = /some_regex/,
|
||||
C = `A template literal string`, // A template literal without interpolation
|
||||
D = 4, // A number
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
14
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
14
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/eslint-plugin",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "TypeScript plugin for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -60,10 +60,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "8.7.0",
|
||||
"@typescript-eslint/type-utils": "8.7.0",
|
||||
"@typescript-eslint/utils": "8.7.0",
|
||||
"@typescript-eslint/visitor-keys": "8.7.0",
|
||||
"@typescript-eslint/scope-manager": "8.8.0",
|
||||
"@typescript-eslint/type-utils": "8.8.0",
|
||||
"@typescript-eslint/utils": "8.8.0",
|
||||
"@typescript-eslint/visitor-keys": "8.8.0",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
|
|
@ -74,8 +74,8 @@
|
|||
"@types/marked": "^5.0.2",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/natural-compare": "*",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "8.7.0",
|
||||
"@typescript-eslint/rule-tester": "8.7.0",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "8.8.0",
|
||||
"@typescript-eslint/rule-tester": "8.8.0",
|
||||
"ajv": "^6.12.6",
|
||||
"cross-env": "^7.0.3",
|
||||
"cross-fetch": "*",
|
||||
|
|
|
|||
10
node_modules/@typescript-eslint/parser/package.json
generated
vendored
10
node_modules/@typescript-eslint/parser/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/parser",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -52,10 +52,10 @@
|
|||
"eslint": "^8.57.0 || ^9.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.7.0",
|
||||
"@typescript-eslint/types": "8.7.0",
|
||||
"@typescript-eslint/typescript-estree": "8.7.0",
|
||||
"@typescript-eslint/visitor-keys": "8.7.0",
|
||||
"@typescript-eslint/scope-manager": "8.8.0",
|
||||
"@typescript-eslint/types": "8.8.0",
|
||||
"@typescript-eslint/typescript-estree": "8.8.0",
|
||||
"@typescript-eslint/visitor-keys": "8.8.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.d.ts
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.d.ts
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
export * from './CatchClauseDefinition';
|
||||
export * from './ClassNameDefinition';
|
||||
export type * from './Definition';
|
||||
export * from './Definition';
|
||||
export * from './DefinitionType';
|
||||
export * from './FunctionNameDefinition';
|
||||
export * from './ImplicitGlobalVariableDefinition';
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,mBAAmB,cAAc,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
||||
1
node_modules/@typescript-eslint/scope-manager/dist/definition/index.js
generated
vendored
1
node_modules/@typescript-eslint/scope-manager/dist/definition/index.js
generated
vendored
|
|
@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./CatchClauseDefinition"), exports);
|
||||
__exportStar(require("./ClassNameDefinition"), exports);
|
||||
__exportStar(require("./Definition"), exports);
|
||||
__exportStar(require("./DefinitionType"), exports);
|
||||
__exportStar(require("./FunctionNameDefinition"), exports);
|
||||
__exportStar(require("./ImplicitGlobalVariableDefinition"), exports);
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/definition/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AAEtC,mDAAiC;AACjC,2DAAyC;AACzC,qEAAmD;AACnD,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,yDAAuC;AACvC,2DAAyC;AACzC,mDAAiC;AACjC,uDAAqC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,2DAAyC;AACzC,qEAAmD;AACnD,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,yDAAuC;AACvC,2DAAyC;AACzC,mDAAiC;AACjC,uDAAqC"}
|
||||
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.d.ts
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.d.ts
generated
vendored
|
|
@ -10,7 +10,7 @@ export * from './FunctionTypeScope';
|
|||
export * from './GlobalScope';
|
||||
export * from './MappedTypeScope';
|
||||
export * from './ModuleScope';
|
||||
export type * from './Scope';
|
||||
export * from './Scope';
|
||||
export * from './ScopeType';
|
||||
export * from './SwitchScope';
|
||||
export * from './TSEnumScope';
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
||||
1
node_modules/@typescript-eslint/scope-manager/dist/scope/index.js
generated
vendored
1
node_modules/@typescript-eslint/scope-manager/dist/scope/index.js
generated
vendored
|
|
@ -26,6 +26,7 @@ __exportStar(require("./FunctionTypeScope"), exports);
|
|||
__exportStar(require("./GlobalScope"), exports);
|
||||
__exportStar(require("./MappedTypeScope"), exports);
|
||||
__exportStar(require("./ModuleScope"), exports);
|
||||
__exportStar(require("./Scope"), exports);
|
||||
__exportStar(require("./ScopeType"), exports);
|
||||
__exportStar(require("./SwitchScope"), exports);
|
||||
__exportStar(require("./TSEnumScope"), exports);
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/scope-manager/dist/scope/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,+DAA6C;AAC7C,+CAA6B;AAC7B,yDAAuC;AACvC,6CAA2B;AAC3B,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAE9B,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,+DAA6C;AAC7C,+CAA6B;AAC7B,yDAAuC;AACvC,6CAA2B;AAC3B,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAC9B,0CAAwB;AACxB,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B"}
|
||||
8
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
8
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/scope-manager",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "TypeScript scope analyser for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -46,13 +46,13 @@
|
|||
"typecheck": "npx nx typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.7.0",
|
||||
"@typescript-eslint/visitor-keys": "8.7.0"
|
||||
"@typescript-eslint/types": "8.8.0",
|
||||
"@typescript-eslint/visitor-keys": "8.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/types": "29.6.3",
|
||||
"@types/glob": "*",
|
||||
"@typescript-eslint/typescript-estree": "8.7.0",
|
||||
"@typescript-eslint/typescript-estree": "8.8.0",
|
||||
"glob": "*",
|
||||
"jest-specific-snapshot": "*",
|
||||
"make-dir": "*",
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"builtinSymbolLikes.d.ts","sourceRoot":"","sources":["../src/builtinSymbolLikes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAEzE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ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AAmB,CACjC,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAC5B,OAAO,CAoBT;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,GAAG,IAAI,GAC9C,OAAO,CAwCT"}
|
||||
9
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.js
generated
vendored
9
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.js
generated
vendored
|
|
@ -31,6 +31,7 @@ exports.isReadonlyTypeLike = isReadonlyTypeLike;
|
|||
exports.isBuiltinTypeAliasLike = isBuiltinTypeAliasLike;
|
||||
exports.isBuiltinSymbolLike = isBuiltinSymbolLike;
|
||||
exports.isBuiltinSymbolLikeRecurser = isBuiltinSymbolLikeRecurser;
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const isSymbolFromDefaultLibrary_1 = require("./isSymbolFromDefaultLibrary");
|
||||
/**
|
||||
|
|
@ -128,6 +129,14 @@ function isBuiltinSymbolLikeRecurser(program, type, predicate) {
|
|||
if (type.isUnion()) {
|
||||
return type.types.every(t => isBuiltinSymbolLikeRecurser(program, t, predicate));
|
||||
}
|
||||
// https://github.com/JoshuaKGoldberg/ts-api-utils/issues/382
|
||||
if (tsutils.isTypeParameter(type)) {
|
||||
const t = type.getConstraint();
|
||||
if (t) {
|
||||
return isBuiltinSymbolLikeRecurser(program, t, predicate);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const predicateResult = predicate(type);
|
||||
if (typeof predicateResult === 'boolean') {
|
||||
return predicateResult;
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.js.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/builtinSymbolLikes.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"builtinSymbolLikes.js","sourceRoot":"","sources":["../src/builtinSymbolLikes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,sCAEC;AAUD,4DAKC;AAUD,kCAEC;AASD,kDAWC;AASD,gDAeC;AACD,wDA+BC;AAED,kDAwBC;AAED,kEAkCC;AAnLD,+CAAiC;AAEjC,6EAA0E;AAE1E;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,OAAmB,EAAE,IAAa;IAC9D,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CACtC,OAAmB,EACnB,IAAa;IAEb,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,OAAmB,EAAE,IAAa;IAC5D,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,OAAmB,EACnB,IAAa;IAEb,OAAO,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE;QACjD,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAClD,OAAO,CACL,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC;YAClC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAC3C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAmB,EACnB,IAAa,EACb,SAKY;IAEZ,OAAO,sBAAsB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE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AAC;AACf,CAAC"}
|
||||
2
node_modules/@typescript-eslint/type-utils/dist/getTypeName.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/getTypeName.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"getTypeName.d.ts","sourceRoot":"","sources":["../src/getTypeName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,EAAE,CAAC,WAAW,EAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,MAAM,CAoDR"}
|
||||
{"version":3,"file":"getTypeName.d.ts","sourceRoot":"","sources":["../src/getTypeName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,EAAE,CAAC,WAAW,EAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,MAAM,CAqDR"}
|
||||
3
node_modules/@typescript-eslint/type-utils/dist/getTypeName.js
generated
vendored
3
node_modules/@typescript-eslint/type-utils/dist/getTypeName.js
generated
vendored
|
|
@ -45,7 +45,8 @@ function getTypeName(typeChecker, type) {
|
|||
const symbol = type.getSymbol();
|
||||
const decls = symbol?.getDeclarations();
|
||||
const typeParamDecl = decls?.[0];
|
||||
if (ts.isTypeParameterDeclaration(typeParamDecl) &&
|
||||
if (typeParamDecl != null &&
|
||||
ts.isTypeParameterDeclaration(typeParamDecl) &&
|
||||
typeParamDecl.constraint != null) {
|
||||
return getTypeName(typeChecker, typeChecker.getTypeFromTypeNode(typeParamDecl.constraint));
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/type-utils/dist/getTypeName.js.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/getTypeName.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"getTypeName.js","sourceRoot":"","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CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,gCAAgC;IAChC,2BAA2B;IAC3B,uCAAuC;IACvC,IACE,IAAI,CAAC,OAAO,EAAE;QACd,IAAI,CAAC,KAAK;aACP,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;aAC7C,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,EAC7B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,0EAA0E;IAC1E,uEAAuE;IACvE,IACE,IAAI,CAAC,cAAc,EAAE;QACrB,IAAI,CAAC,KAAK;aACP,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;aAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,EAC5B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
|
||||
8
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
8
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/type-utils",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "Type utilities for working with TypeScript + ESLint together",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -46,14 +46,14 @@
|
|||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "8.7.0",
|
||||
"@typescript-eslint/utils": "8.7.0",
|
||||
"@typescript-eslint/typescript-estree": "8.8.0",
|
||||
"@typescript-eslint/utils": "8.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/types": "29.6.3",
|
||||
"@typescript-eslint/parser": "8.7.0",
|
||||
"@typescript-eslint/parser": "8.8.0",
|
||||
"ajv": "^6.12.6",
|
||||
"downlevel-dts": "*",
|
||||
"jest": "29.7.0",
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/types/dist/index.d.ts
generated
vendored
4
node_modules/@typescript-eslint/types/dist/index.d.ts
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
export { AST_NODE_TYPES, AST_TOKEN_TYPES } from './generated/ast-spec';
|
||||
export type * from './lib';
|
||||
export type * from './parser-options';
|
||||
export * from './lib';
|
||||
export * from './parser-options';
|
||||
export * from './ts-estree';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
node_modules/@typescript-eslint/types/dist/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/types/dist/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,kBAAkB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
||||
2
node_modules/@typescript-eslint/types/dist/index.js
generated
vendored
2
node_modules/@typescript-eslint/types/dist/index.js
generated
vendored
|
|
@ -18,5 +18,7 @@ exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = void 0;
|
|||
var ast_spec_1 = require("./generated/ast-spec");
|
||||
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return ast_spec_1.AST_NODE_TYPES; } });
|
||||
Object.defineProperty(exports, "AST_TOKEN_TYPES", { enumerable: true, get: function () { return ast_spec_1.AST_TOKEN_TYPES; } });
|
||||
__exportStar(require("./lib"), exports);
|
||||
__exportStar(require("./parser-options"), exports);
|
||||
__exportStar(require("./ts-estree"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
node_modules/@typescript-eslint/types/dist/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/types/dist/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuE;AAA9D,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AAGxC,8CAA4B"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuE;AAA9D,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AACxC,wCAAsB;AACtB,mDAAiC;AACjC,8CAA4B"}
|
||||
2
node_modules/@typescript-eslint/types/package.json
generated
vendored
2
node_modules/@typescript-eslint/types/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/types",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "Types for the TypeScript-ESTree AST spec",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.d.ts
generated
vendored
4
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.d.ts
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
export { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/types';
|
||||
export type * from './ts-nodes';
|
||||
export type * from './estree-to-ts-node-types';
|
||||
export * from './ts-nodes';
|
||||
export * from './estree-to-ts-node-types';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,0BAA0B,CAAC;AAClC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,2BAA2B,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,0BAA0B,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC"}
|
||||
16
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.js
generated
vendored
16
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.js
generated
vendored
|
|
@ -1,4 +1,18 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSESTree = exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = void 0;
|
||||
// for simplicity and backwards-compatibility
|
||||
|
|
@ -6,4 +20,6 @@ var types_1 = require("@typescript-eslint/types");
|
|||
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return types_1.AST_NODE_TYPES; } });
|
||||
Object.defineProperty(exports, "AST_TOKEN_TYPES", { enumerable: true, get: function () { return types_1.AST_TOKEN_TYPES; } });
|
||||
Object.defineProperty(exports, "TSESTree", { enumerable: true, get: function () { return types_1.TSESTree; } });
|
||||
__exportStar(require("./ts-nodes"), exports);
|
||||
__exportStar(require("./estree-to-ts-node-types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,kDAIkC;AAHhC,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA6C;AAC7C,kDAIkC;AAHhC,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AAEV,6CAA2B;AAC3B,4DAA0C"}
|
||||
6
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
6
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/typescript-estree",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -54,8 +54,8 @@
|
|||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.7.0",
|
||||
"@typescript-eslint/visitor-keys": "8.7.0",
|
||||
"@typescript-eslint/types": "8.8.0",
|
||||
"@typescript-eslint/visitor-keys": "8.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"fast-glob": "^3.3.2",
|
||||
"is-glob": "^4.0.3",
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
generated
vendored
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getParserServices = getParserServices;
|
||||
const parserSeemsToBeTSESLint_1 = require("./parserSeemsToBeTSESLint");
|
||||
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.';
|
||||
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = "You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://typescript-eslint.io/getting-started/typed-linting for enabling linting with type information.";
|
||||
const ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.';
|
||||
function getParserServices(context, allowWithoutFullTypeInformation = false) {
|
||||
const parser = context.parserPath || context.languageOptions.parser?.meta?.name;
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"getParserServices.js","sourceRoot":"","sources":["../../src/eslint-utils/getParserServices.ts"],"names":[],"mappings":";;AA0GS,8CAAiB;AApG1B,uEAAoE;AAEpE,MAAM,sCAAsC,GAC1C,gLAAgL,CAAC;AAEnL,MAAM,4BAA4B,GAChC,mKAAmK,CAAC;AA+CtK,SAAS,iBAAiB,CACxB,OAA0D,EAC1D,+BAA+B,GAAG,KAAK;IAEvC,MAAM,MAAM,GACV,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;IAEnE,mFAAmF;IACnF,EAAE;IACF,mCAAmC;IACnC,yCAAyC;IACzC,yGAAyG;IACzG,sEAAsE;IACtE,0FAA0F;IAC1F,EAAE;IACF,qFAAqF;IACrF,wCAAwC;IACxC,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,IAAI,IAAI;QAChE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,IAAI,IAAI,EAC/D,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,+EAA+E;IAC/E,uDAAuD;IACvD,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,IAAI,IAAI;QACjD,CAAC,+BAA+B,EAChC,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,cAAgC,CAAC;AAC7D,CAAC;AACD,yDAAyD;AAEzD,SAAS,UAAU,CAAC,MAA0B;IAC5C,MAAM,QAAQ,GAAG;QACf,sCAAsC;QACtC,WAAW,MAAM,IAAI,WAAW,EAAE;QAClC,CAAC,IAAA,iDAAuB,EAAC,MAAM,CAAC,IAAI,4BAA4B;KACjE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
||||
{"version":3,"file":"getParserServices.js","sourceRoot":"","sources":["../../src/eslint-utils/getParserServices.ts"],"names":[],"mappings":";;AA0GS,8CAAiB;AApG1B,uEAAoE;AAEpE,MAAM,sCAAsC,GAC1C,+OAA+O,CAAC;AAElP,MAAM,4BAA4B,GAChC,mKAAmK,CAAC;AA+CtK,SAAS,iBAAiB,CACxB,OAA0D,EAC1D,+BAA+B,GAAG,KAAK;IAEvC,MAAM,MAAM,GACV,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;IAEnE,mFAAmF;IACnF,EAAE;IACF,mCAAmC;IACnC,yCAAyC;IACzC,yGAAyG;IACzG,sEAAsE;IACtE,0FAA0F;IAC1F,EAAE;IACF,qFAAqF;IACrF,wCAAwC;IACxC,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,IAAI,IAAI;QAChE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,IAAI,IAAI,EAC/D,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,+EAA+E;IAC/E,uDAAuD;IACvD,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,IAAI,IAAI;QACjD,CAAC,+BAA+B,EAChC,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,cAAgC,CAAC;AAC7D,CAAC;AACD,yDAAyD;AAEzD,SAAS,UAAU,CAAC,MAA0B;IAC5C,MAAM,QAAQ,GAAG;QACf,sCAAsC;QACtC,WAAW,MAAM,IAAI,WAAW,EAAE;QAClC,CAAC,IAAA,iDAAuB,EAAC,MAAM,CAAC,IAAI,4BAA4B;KACjE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
||||
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
export * from './applyDefault';
|
||||
export * from './deepMerge';
|
||||
export * from './getParserServices';
|
||||
export type * from './InferTypesFromRule';
|
||||
export * from './InferTypesFromRule';
|
||||
export * from './nullThrows';
|
||||
export * from './RuleCreator';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,mBAAmB,sBAAsB,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
||||
1
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
generated
vendored
1
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
generated
vendored
|
|
@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
__exportStar(require("./applyDefault"), exports);
|
||||
__exportStar(require("./deepMerge"), exports);
|
||||
__exportStar(require("./getParserServices"), exports);
|
||||
__exportStar(require("./InferTypesFromRule"), exports);
|
||||
__exportStar(require("./nullThrows"), exports);
|
||||
__exportStar(require("./RuleCreator"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,sDAAoC;AAEpC,+CAA6B;AAC7B,gDAA8B"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,sDAAoC;AACpC,uDAAqC;AACrC,+CAA6B;AAC7B,gDAA8B"}
|
||||
2
node_modules/@typescript-eslint/utils/dist/index.d.ts
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/index.d.ts
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
export * as ASTUtils from './ast-utils';
|
||||
export * as ESLintUtils from './eslint-utils';
|
||||
export type * as JSONSchema from './json-schema';
|
||||
export * as JSONSchema from './json-schema';
|
||||
export * as TSESLint from './ts-eslint';
|
||||
export * from './ts-estree';
|
||||
export * as TSUtils from './ts-utils';
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,YAAY,KAAK,UAAU,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC"}
|
||||
3
node_modules/@typescript-eslint/utils/dist/index.js
generated
vendored
3
node_modules/@typescript-eslint/utils/dist/index.js
generated
vendored
|
|
@ -26,9 +26,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSUtils = exports.TSESLint = exports.ESLintUtils = exports.ASTUtils = void 0;
|
||||
exports.TSUtils = exports.TSESLint = exports.JSONSchema = exports.ESLintUtils = exports.ASTUtils = void 0;
|
||||
exports.ASTUtils = __importStar(require("./ast-utils"));
|
||||
exports.ESLintUtils = __importStar(require("./eslint-utils"));
|
||||
exports.JSONSchema = __importStar(require("./json-schema"));
|
||||
exports.TSESLint = __importStar(require("./ts-eslint"));
|
||||
__exportStar(require("./ts-estree"), exports);
|
||||
exports.TSUtils = __importStar(require("./ts-utils"));
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAwC;AAExC,8DAA8C;AAE9C,wDAAwC;AACxC,8CAA4B;AAC5B,sDAAsC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAwC;AAExC,8DAA8C;AAC9C,4DAA4C;AAC5C,wDAAwC;AACxC,8CAA4B;AAC5B,sDAAsC"}
|
||||
12
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.d.ts
generated
vendored
12
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.d.ts
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
export type * from './AST';
|
||||
export type * from './Config';
|
||||
export * from './AST';
|
||||
export * from './Config';
|
||||
export * from './ESLint';
|
||||
export * from './Linter';
|
||||
export type * from './Parser';
|
||||
export type * from './ParserOptions';
|
||||
export type * from './Processor';
|
||||
export type * from './Rule';
|
||||
export * from './Parser';
|
||||
export * from './ParserOptions';
|
||||
export * from './Processor';
|
||||
export * from './Rule';
|
||||
export * from './RuleTester';
|
||||
export * from './Scope';
|
||||
export * from './SourceCode';
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,UAAU,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,QAAQ,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
||||
6
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.js
generated
vendored
6
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.js
generated
vendored
|
|
@ -14,8 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./AST"), exports);
|
||||
__exportStar(require("./Config"), exports);
|
||||
__exportStar(require("./ESLint"), exports);
|
||||
__exportStar(require("./Linter"), exports);
|
||||
__exportStar(require("./Parser"), exports);
|
||||
__exportStar(require("./ParserOptions"), exports);
|
||||
__exportStar(require("./Processor"), exports);
|
||||
__exportStar(require("./Rule"), exports);
|
||||
__exportStar(require("./RuleTester"), exports);
|
||||
__exportStar(require("./Scope"), exports);
|
||||
__exportStar(require("./SourceCode"), exports);
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/utils/dist/ts-eslint/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,2CAAyB;AACzB,2CAAyB;AAKzB,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,8CAA4B;AAC5B,yCAAuB;AACvB,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B"}
|
||||
8
node_modules/@typescript-eslint/utils/package.json
generated
vendored
8
node_modules/@typescript-eslint/utils/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/utils",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "Utilities for working with TypeScript + ESLint together",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -64,9 +64,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "8.7.0",
|
||||
"@typescript-eslint/types": "8.7.0",
|
||||
"@typescript-eslint/typescript-estree": "8.7.0"
|
||||
"@typescript-eslint/scope-manager": "8.8.0",
|
||||
"@typescript-eslint/types": "8.8.0",
|
||||
"@typescript-eslint/typescript-estree": "8.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0 || ^9.0.0"
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
4
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typescript-eslint/visitor-keys",
|
||||
"version": "8.7.0",
|
||||
"version": "8.8.0",
|
||||
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
||||
"files": [
|
||||
"dist",
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.7.0",
|
||||
"@typescript-eslint/types": "8.8.0",
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue