Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2025-03-24 21:18:42 +00:00
parent 08e5c8d618
commit 5275714183
148 changed files with 4045 additions and 39247 deletions

View file

@ -1 +1 @@
{"version":3,"file":"consistent-type-exports.d.ts","sourceRoot":"","sources":["../../src/rules/consistent-type-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAgBnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,sCAAsC,EAAE,OAAO,CAAC;KACjD;CACF,CAAC;AAgBF,MAAM,MAAM,UAAU,GAClB,yBAAyB,GACzB,oBAAoB,GACpB,eAAe,CAAC;;AAEpB,wBAgSG"}
{"version":3,"file":"consistent-type-exports.d.ts","sourceRoot":"","sources":["../../src/rules/consistent-type-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAgBnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,sCAAsC,EAAE,OAAO,CAAC;KACjD;CACF,CAAC;AAgBF,MAAM,MAAM,UAAU,GAClB,yBAAyB,GACzB,oBAAoB,GACpB,eAAe,CAAC;;AAEpB,wBA8RG"}

View file

@ -158,14 +158,12 @@ exports.default = (0, util_1.createRule)({
// Cache the first encountered exports for the package. We will need to come
// back to these later when fixing the problems.
if (node.exportKind === 'type') {
if (sourceExports.typeOnlyNamedExport == null) {
// The export is a type export
sourceExports.typeOnlyNamedExport = node;
}
// The export is a type export
sourceExports.typeOnlyNamedExport ??= node;
}
else if (sourceExports.valueOnlyNamedExport == null) {
else {
// The export is a value export
sourceExports.valueOnlyNamedExport = node;
sourceExports.valueOnlyNamedExport ??= node;
}
// Next for the current export, we will separate type/value specifiers.
const typeBasedSpecifiers = [];

View file

@ -1 +1 @@
{"version":3,"file":"no-empty-interface.d.ts","sourceRoot":"","sources":["../../src/rules/no-empty-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOzD,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,kBAAkB,CAAC;;AAExD,wBAwGG"}
{"version":3,"file":"no-empty-interface.d.ts","sourceRoot":"","sources":["../../src/rules/no-empty-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOzD,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,kBAAkB,CAAC;;AAExD,wBAmHG"}

View file

@ -7,7 +7,18 @@ exports.default = (0, util_1.createRule)({
name: 'no-empty-interface',
meta: {
type: 'suggestion',
deprecated: true,
deprecated: {
deprecatedSince: '8.0.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/no-empty-object-type',
url: 'https://typescript-eslint.io/rules/no-empty-object-type',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/8977',
},
docs: {
description: 'Disallow the declaration of empty interfaces',
},

View file

@ -1 +1 @@
{"version":3,"file":"no-loss-of-precision.d.ts","sourceRoot":"","sources":["../../src/rules/no-loss-of-precision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,QAAA,MAAM,QAAQ,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAElD,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,wBAAwB,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC;AAC7E,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAClD,WAAW,CAAC,OAAO,QAAQ,CAAC,CAC7B,CAAC;;AAEF,wBAkBG"}
{"version":3,"file":"no-loss-of-precision.d.ts","sourceRoot":"","sources":["../../src/rules/no-loss-of-precision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,QAAA,MAAM,QAAQ,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAElD,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,wBAAwB,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC;AAC7E,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAClD,WAAW,CAAC,OAAO,QAAQ,CAAC,CAC7B,CAAC;;AAEF,wBA6BG"}

View file

@ -8,7 +8,18 @@ exports.default = (0, util_1.createRule)({
meta: {
type: 'problem',
// defaultOptions, -- base rule does not use defaultOptions
deprecated: true,
deprecated: {
deprecatedSince: '8.0.0',
replacedBy: [
{
rule: {
name: 'no-loss-of-precision',
url: 'https://eslint.org/docs/latest/rules/no-loss-of-precision',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/8832',
},
docs: {
description: 'Disallow literal numbers that lose precision',
extendsBaseRule: true,

View file

@ -1 +1 @@
{"version":3,"file":"no-type-alias.d.ts","sourceRoot":"","sources":["../../src/rules/no-type-alias.ts"],"names":[],"mappings":"AAMA,KAAK,MAAM,GACP,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,6BAA6B,GAC7B,OAAO,CAAC;AAEZ,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACpC,qBAAqB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QAC3C,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACvC,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACnC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,aAAa,CAAC;;AAU9D,wBAwTG"}
{"version":3,"file":"no-type-alias.d.ts","sourceRoot":"","sources":["../../src/rules/no-type-alias.ts"],"names":[],"mappings":"AAMA,KAAK,MAAM,GACP,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,6BAA6B,GAC7B,OAAO,CAAC;AAEZ,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACpC,qBAAqB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QAC3C,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACvC,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QACnC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,aAAa,CAAC;;AAU9D,wBAmUG"}

View file

@ -6,7 +6,18 @@ exports.default = (0, util_1.createRule)({
name: 'no-type-alias',
meta: {
type: 'suggestion',
deprecated: true,
deprecated: {
deprecatedSince: '6.0.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/consistent-type-definitions',
url: 'https://typescript-eslint.io/rules/consistent-type-definitions',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/6229',
},
docs: {
description: 'Disallow type aliases',
// too opinionated to be recommended

View file

@ -1 +1 @@
{"version":3,"file":"no-unsafe-function-type.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-function-type.ts"],"names":[],"mappings":";AAMA,wBA4CG"}
{"version":3,"file":"no-unsafe-function-type.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-function-type.ts"],"names":[],"mappings":";AAMA,wBA2CG"}

View file

@ -10,7 +10,6 @@ exports.default = (0, util_1.createRule)({
description: 'Disallow using the unsafe built-in Function type',
recommended: 'recommended',
},
fixable: 'code',
messages: {
bannedFunctionType: [
'The `Function` type accepts any function-like value.',

View file

@ -1 +1 @@
{"version":3,"file":"no-unsafe-return.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-return.ts"],"names":[],"mappings":";AAqBA,wBAwMG"}
{"version":3,"file":"no-unsafe-return.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-return.ts"],"names":[],"mappings":";AAqBA,wBAsMG"}

View file

@ -81,9 +81,7 @@ exports.default = (0, util_1.createRule)({
ts.isArrowFunction(functionTSNode)
? (0, util_1.getContextualType)(checker, functionTSNode)
: services.getTypeAtLocation(functionNode);
if (!functionType) {
functionType = services.getTypeAtLocation(functionNode);
}
functionType ??= services.getTypeAtLocation(functionNode);
const callSignatures = tsutils.getCallSignaturesOfType(functionType);
// If there is an explicit type annotation *and* that type matches the actual
// function return type, we shouldn't complain (it's intentional, even if unsafe)

View file

@ -1 +1 @@
{"version":3,"file":"no-var-requires.d.ts","sourceRoot":"","sources":["../../src/rules/no-var-requires.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;;AAErC,wBAmFG"}
{"version":3,"file":"no-var-requires.d.ts","sourceRoot":"","sources":["../../src/rules/no-var-requires.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;;AAErC,wBA8FG"}

View file

@ -6,7 +6,18 @@ exports.default = (0, util_1.createRule)({
name: 'no-var-requires',
meta: {
type: 'problem',
deprecated: true,
deprecated: {
deprecatedSince: '8.0.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/no-require-imports',
url: 'https://typescript-eslint.io/rules/no-require-imports',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/8334',
},
docs: {
description: 'Disallow `require` statements except in import statements',
},

View file

@ -14,7 +14,7 @@ export type Options = [
ignoreTernaryTests?: boolean;
}
];
export type MessageIds = 'noStrictNullCheck' | 'preferNullishOverOr' | 'preferNullishOverTernary' | 'suggestNullish';
export type MessageIds = 'noStrictNullCheck' | 'preferNullishOverAssignment' | 'preferNullishOverOr' | 'preferNullishOverTernary' | 'suggestNullish';
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
//# sourceMappingURL=prefer-nullish-coalescing.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"prefer-nullish-coalescing.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-nullish-coalescing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AA8BnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,sDAAsD,CAAC,EAAE,OAAO,CAAC;QACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,gBAAgB,CAAC,EACb;YACE,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;SAClB,GACD,IAAI,CAAC;QACT,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;CACF,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,0BAA0B,GAC1B,gBAAgB,CAAC;;AAErB,wBAsfG"}
{"version":3,"file":"prefer-nullish-coalescing.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-nullish-coalescing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAqCnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,sDAAsD,CAAC,EAAE,OAAO,CAAC;QACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,gBAAgB,CAAC,EACb;YACE,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;SAClB,GACD,IAAI,CAAC;QACT,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;CACF,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,mBAAmB,GACnB,6BAA6B,GAC7B,qBAAqB,GACrB,0BAA0B,GAC1B,gBAAgB,CAAC;;AAErB,wBAujBG"}

View file

@ -37,11 +37,14 @@ 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 isIdentifierOrMemberOrChainExpression = (0, util_1.isNodeOfTypes)([
const isMemberAccessLike = (0, util_1.isNodeOfTypes)([
utils_1.AST_NODE_TYPES.ChainExpression,
utils_1.AST_NODE_TYPES.Identifier,
utils_1.AST_NODE_TYPES.MemberExpression,
]);
const isNullLiteralOrUndefinedIdentifier = (node) => (0, util_1.isNullLiteral)(node) || (0, util_1.isUndefinedIdentifier)(node);
const isNodeNullishComparison = (node) => isNullLiteralOrUndefinedIdentifier(node.left) &&
isNullLiteralOrUndefinedIdentifier(node.right);
exports.default = (0, util_1.createRule)({
name: 'prefer-nullish-coalescing',
meta: {
@ -54,6 +57,7 @@ exports.default = (0, util_1.createRule)({
hasSuggestions: true,
messages: {
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
preferNullishOverAssignment: 'Prefer using nullish coalescing operator (`??{{ equals }}`) instead of an assignment expression, as it is simpler to read.',
preferNullishOverOr: 'Prefer using nullish coalescing operator (`??{{ equals }}`) instead of a logical {{ description }} (`||{{ equals }}`), as it is a safer operator.',
preferNullishOverTernary: 'Prefer using nullish coalescing operator (`??{{ equals }}`) instead of a ternary expression, as it is simpler to read.',
suggestNullish: 'Fix to nullish coalescing operator (`??{{ equals }}`).',
@ -258,6 +262,81 @@ exports.default = (0, util_1.createRule)({
],
});
}
function getNullishCoalescingParams(node, nonNullishNode, nodesInsideTestExpression, operator) {
let nullishCoalescingLeftNode;
let hasTruthinessCheck = false;
let hasNullCheckWithoutTruthinessCheck = false;
let hasUndefinedCheckWithoutTruthinessCheck = false;
if (!nodesInsideTestExpression.length) {
hasTruthinessCheck = true;
nullishCoalescingLeftNode =
node.test.type === utils_1.AST_NODE_TYPES.UnaryExpression
? node.test.argument
: node.test;
if (!areNodesSimilarMemberAccess(nullishCoalescingLeftNode, nonNullishNode)) {
return { isFixable: false };
}
}
else {
// we check that the test only contains null, undefined and the identifier
for (const testNode of nodesInsideTestExpression) {
if ((0, util_1.isNullLiteral)(testNode)) {
hasNullCheckWithoutTruthinessCheck = true;
}
else if ((0, util_1.isUndefinedIdentifier)(testNode)) {
hasUndefinedCheckWithoutTruthinessCheck = true;
}
else if (areNodesSimilarMemberAccess(testNode, nonNullishNode)) {
// Only consider the first expression in a multi-part nullish check,
// as subsequent expressions might not require all the optional chaining operators.
// For example: a?.b?.c !== undefined && a.b.c !== null ? a.b.c : 'foo';
// This works because `node.test` is always evaluated first in the loop
// and has the same or more necessary optional chaining operators
// than `node.alternate` or `node.consequent`.
nullishCoalescingLeftNode ??= testNode;
}
else {
return { isFixable: false };
}
}
}
if (!nullishCoalescingLeftNode) {
return { isFixable: false };
}
const isFixable = (() => {
if (hasTruthinessCheck) {
return isTruthinessCheckEligibleForPreferNullish({
node,
testNode: nullishCoalescingLeftNode,
});
}
// it is fixable if we check for both null and undefined, or not if neither
if (hasUndefinedCheckWithoutTruthinessCheck ===
hasNullCheckWithoutTruthinessCheck) {
return hasUndefinedCheckWithoutTruthinessCheck;
}
// it is fixable if we loosely check for either null or undefined
if (['==', '!='].includes(operator)) {
return true;
}
const type = parserServices.getTypeAtLocation(nullishCoalescingLeftNode);
const flags = (0, util_1.getTypeFlags)(type);
if (flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
return false;
}
const hasNullType = (flags & ts.TypeFlags.Null) !== 0;
// it is fixable if we check for undefined and the type is not nullable
if (hasUndefinedCheckWithoutTruthinessCheck && !hasNullType) {
return true;
}
const hasUndefinedType = (flags & ts.TypeFlags.Undefined) !== 0;
// it is fixable if we check for null and the type can't be undefined
return hasNullCheckWithoutTruthinessCheck && !hasUndefinedType;
})();
return isFixable
? { isFixable: true, nullishCoalescingLeftNode }
: { isFixable: false };
}
return {
'AssignmentExpression[operator = "||="]'(node) {
checkAndFixWithPreferNullishOverOr(node, 'assignment', '=');
@ -266,134 +345,12 @@ exports.default = (0, util_1.createRule)({
if (ignoreTernaryTests) {
return;
}
let operator;
let nodesInsideTestExpression = [];
if (node.test.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
nodesInsideTestExpression = [node.test.left, node.test.right];
if (node.test.operator === '==' ||
node.test.operator === '!=' ||
node.test.operator === '===' ||
node.test.operator === '!==') {
operator = node.test.operator;
}
}
else if (node.test.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
node.test.left.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
node.test.right.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
nodesInsideTestExpression = [
node.test.left.left,
node.test.left.right,
node.test.right.left,
node.test.right.right,
];
if (['||', '||='].includes(node.test.operator)) {
if (node.test.left.operator === '===' &&
node.test.right.operator === '===') {
operator = '===';
}
else if (((node.test.left.operator === '===' ||
node.test.right.operator === '===') &&
(node.test.left.operator === '==' ||
node.test.right.operator === '==')) ||
(node.test.left.operator === '==' &&
node.test.right.operator === '==')) {
operator = '==';
}
}
else if (node.test.operator === '&&') {
if (node.test.left.operator === '!==' &&
node.test.right.operator === '!==') {
operator = '!==';
}
else if (((node.test.left.operator === '!==' ||
node.test.right.operator === '!==') &&
(node.test.left.operator === '!=' ||
node.test.right.operator === '!=')) ||
(node.test.left.operator === '!=' &&
node.test.right.operator === '!=')) {
operator = '!=';
}
}
}
let nullishCoalescingLeftNode;
let hasTruthinessCheck = false;
let hasNullCheckWithoutTruthinessCheck = false;
let hasUndefinedCheckWithoutTruthinessCheck = false;
if (!operator) {
let testNode;
hasTruthinessCheck = true;
if (isIdentifierOrMemberOrChainExpression(node.test)) {
testNode = node.test;
}
else if (node.test.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
isIdentifierOrMemberOrChainExpression(node.test.argument) &&
node.test.operator === '!') {
testNode = node.test.argument;
operator = '!';
}
if (testNode &&
areNodesSimilarMemberAccess(testNode, getBranchNodes(node, operator).nonNullishBranch)) {
nullishCoalescingLeftNode = testNode;
}
}
else {
// we check that the test only contains null, undefined and the identifier
for (const testNode of nodesInsideTestExpression) {
if ((0, util_1.isNullLiteral)(testNode)) {
hasNullCheckWithoutTruthinessCheck = true;
}
else if ((0, util_1.isUndefinedIdentifier)(testNode)) {
hasUndefinedCheckWithoutTruthinessCheck = true;
}
else if (areNodesSimilarMemberAccess(testNode, getBranchNodes(node, operator).nonNullishBranch)) {
// Only consider the first expression in a multi-part nullish check,
// as subsequent expressions might not require all the optional chaining operators.
// For example: a?.b?.c !== undefined && a.b.c !== null ? a.b.c : 'foo';
// This works because `node.test` is always evaluated first in the loop
// and has the same or more necessary optional chaining operators
// than `node.alternate` or `node.consequent`.
nullishCoalescingLeftNode ??= testNode;
}
else {
return;
}
}
}
if (!nullishCoalescingLeftNode) {
const { nodesInsideTestExpression, operator } = getOperatorAndNodesInsideTestExpression(node);
if (operator == null) {
return;
}
const isFixableWithPreferNullishOverTernary = (() => {
// x ? x : y and !x ? y : x patterns
if (hasTruthinessCheck) {
return isTruthinessCheckEligibleForPreferNullish({
node,
testNode: nullishCoalescingLeftNode,
});
}
// it is fixable if we check for both null and undefined, or not if neither
if (hasUndefinedCheckWithoutTruthinessCheck ===
hasNullCheckWithoutTruthinessCheck) {
return hasUndefinedCheckWithoutTruthinessCheck;
}
// it is fixable if we loosely check for either null or undefined
if (operator === '==' || operator === '!=') {
return true;
}
const type = parserServices.getTypeAtLocation(nullishCoalescingLeftNode);
const flags = (0, util_1.getTypeFlags)(type);
if (flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
return false;
}
const hasNullType = (flags & ts.TypeFlags.Null) !== 0;
// it is fixable if we check for undefined and the type is not nullable
if (hasUndefinedCheckWithoutTruthinessCheck && !hasNullType) {
return true;
}
const hasUndefinedType = (flags & ts.TypeFlags.Undefined) !== 0;
// it is fixable if we check for null and the type can't be undefined
return hasNullCheckWithoutTruthinessCheck && !hasUndefinedType;
})();
if (isFixableWithPreferNullishOverTernary) {
const nullishCoalescingParams = getNullishCoalescingParams(node, getBranchNodes(node, operator).nonNullishBranch, nodesInsideTestExpression, operator);
if (nullishCoalescingParams.isFixable) {
context.report({
node,
messageId: 'preferNullishOverTernary',
@ -404,7 +361,63 @@ exports.default = (0, util_1.createRule)({
messageId: 'suggestNullish',
data: { equals: '' },
fix(fixer) {
return fixer.replaceText(node, `${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingLeftNode)} ?? ${(0, util_1.getTextWithParentheses)(context.sourceCode, getBranchNodes(node, operator).nullishBranch)}`);
return fixer.replaceText(node, `${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingParams.nullishCoalescingLeftNode)} ?? ${(0, util_1.getTextWithParentheses)(context.sourceCode, getBranchNodes(node, operator).nullishBranch)}`);
},
},
],
});
}
},
IfStatement(node) {
if (node.alternate != null) {
return;
}
let assignmentExpression;
if (node.consequent.type === utils_1.AST_NODE_TYPES.BlockStatement &&
node.consequent.body.length === 1 &&
node.consequent.body[0].type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
assignmentExpression = node.consequent.body[0].expression;
}
else if (node.consequent.type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
assignmentExpression = node.consequent.expression;
}
if (!assignmentExpression ||
assignmentExpression.type !== utils_1.AST_NODE_TYPES.AssignmentExpression ||
!isMemberAccessLike(assignmentExpression.left)) {
return;
}
const nullishCoalescingLeftNode = assignmentExpression.left;
const nullishCoalescingRightNode = assignmentExpression.right;
const { nodesInsideTestExpression, operator } = getOperatorAndNodesInsideTestExpression(node);
if (operator == null || !['!', '==', '==='].includes(operator)) {
return;
}
const nullishCoalescingParams = getNullishCoalescingParams(node, nullishCoalescingLeftNode, nodesInsideTestExpression, operator);
if (nullishCoalescingParams.isFixable) {
// Handle comments
const isConsequentNodeBlockStatement = node.consequent.type === utils_1.AST_NODE_TYPES.BlockStatement;
const commentsBefore = formatComments(context.sourceCode.getCommentsBefore(assignmentExpression), isConsequentNodeBlockStatement ? '\n' : ' ');
const commentsAfter = isConsequentNodeBlockStatement
? formatComments(context.sourceCode.getCommentsAfter(assignmentExpression.parent), '\n')
: '';
context.report({
node,
messageId: 'preferNullishOverAssignment',
data: { equals: '=' },
suggest: [
{
messageId: 'suggestNullish',
data: { equals: '=' },
fix(fixer) {
const fixes = [];
if (commentsBefore) {
fixes.push(fixer.insertTextBefore(node, commentsBefore));
}
fixes.push(fixer.replaceText(node, `${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingLeftNode)} ??= ${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingRightNode)};`));
if (commentsAfter) {
fixes.push(fixer.insertTextAfter(node, ` ${commentsAfter.slice(0, -1)}`));
}
return fixes;
},
},
],
@ -512,8 +525,21 @@ function isMixedLogicalExpression(node) {
function areNodesSimilarMemberAccess(a, b) {
if (a.type === utils_1.AST_NODE_TYPES.MemberExpression &&
b.type === utils_1.AST_NODE_TYPES.MemberExpression) {
return ((0, util_1.isNodeEqual)(a.property, b.property) &&
areNodesSimilarMemberAccess(a.object, b.object));
if (!areNodesSimilarMemberAccess(a.object, b.object)) {
return false;
}
if (a.computed === b.computed) {
return (0, util_1.isNodeEqual)(a.property, b.property);
}
if (a.property.type === utils_1.AST_NODE_TYPES.Literal &&
b.property.type === utils_1.AST_NODE_TYPES.Identifier) {
return a.property.value === b.property.name;
}
if (a.property.type === utils_1.AST_NODE_TYPES.Identifier &&
b.property.type === utils_1.AST_NODE_TYPES.Literal) {
return a.property.name === b.property.value;
}
return false;
}
if (a.type === utils_1.AST_NODE_TYPES.ChainExpression ||
b.type === utils_1.AST_NODE_TYPES.ChainExpression) {
@ -527,8 +553,82 @@ function areNodesSimilarMemberAccess(a, b) {
* - the "nullish branch" is the branch when test node is nullish
*/
function getBranchNodes(node, operator) {
if (!operator || ['!=', '!=='].includes(operator)) {
if (['', '!=', '!=='].includes(operator)) {
return { nonNullishBranch: node.consequent, nullishBranch: node.alternate };
}
return { nonNullishBranch: node.alternate, nullishBranch: node.consequent };
}
function getOperatorAndNodesInsideTestExpression(node) {
let operator = null;
let nodesInsideTestExpression = [];
if (isMemberAccessLike(node.test) ||
node.test.type === utils_1.AST_NODE_TYPES.UnaryExpression) {
operator = getNonBinaryNodeOperator(node.test);
}
else if (node.test.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
nodesInsideTestExpression = [node.test.left, node.test.right];
if (node.test.operator === '==' ||
node.test.operator === '!=' ||
node.test.operator === '===' ||
node.test.operator === '!==') {
operator = node.test.operator;
}
}
else if (node.test.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
node.test.left.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
node.test.right.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
if (isNodeNullishComparison(node.test.left) ||
isNodeNullishComparison(node.test.right)) {
return { nodesInsideTestExpression, operator };
}
nodesInsideTestExpression = [
node.test.left.left,
node.test.left.right,
node.test.right.left,
node.test.right.right,
];
if (['||', '||='].includes(node.test.operator)) {
if (node.test.left.operator === '===' &&
node.test.right.operator === '===') {
operator = '===';
}
else if (((node.test.left.operator === '===' ||
node.test.right.operator === '===') &&
(node.test.left.operator === '==' ||
node.test.right.operator === '==')) ||
(node.test.left.operator === '==' && node.test.right.operator === '==')) {
operator = '==';
}
}
else if (node.test.operator === '&&') {
if (node.test.left.operator === '!==' &&
node.test.right.operator === '!==') {
operator = '!==';
}
else if (((node.test.left.operator === '!==' ||
node.test.right.operator === '!==') &&
(node.test.left.operator === '!=' ||
node.test.right.operator === '!=')) ||
(node.test.left.operator === '!=' && node.test.right.operator === '!=')) {
operator = '!=';
}
}
}
return { nodesInsideTestExpression, operator };
}
function getNonBinaryNodeOperator(node) {
if (node.type !== utils_1.AST_NODE_TYPES.UnaryExpression) {
return '';
}
if (isMemberAccessLike(node.argument) && node.operator === '!') {
return '!';
}
return null;
}
function formatComments(comments, separator) {
return comments
.map(({ type, value }) => type === utils_1.AST_TOKEN_TYPES.Line
? `//${value}${separator}`
: `/*${value}*/${separator}`)
.join('');
}

View file

@ -1 +1 @@
{"version":3,"file":"prefer-ts-expect-error.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-ts-expect-error.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,0BAA0B,CAAC;;AAEpD,wBA0EG"}
{"version":3,"file":"prefer-ts-expect-error.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-ts-expect-error.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,0BAA0B,CAAC;;AAEpD,wBAqFG"}

View file

@ -6,7 +6,18 @@ exports.default = (0, util_1.createRule)({
name: 'prefer-ts-expect-error',
meta: {
type: 'problem',
deprecated: true,
deprecated: {
deprecatedSince: '7.11.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/ban-ts-comment',
url: 'https://typescript-eslint.io/rules/ban-ts-comment',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/9081',
},
docs: {
description: 'Enforce using `@ts-expect-error` over `@ts-ignore`',
},

View file

@ -1 +1 @@
{"version":3,"file":"sort-type-constituents.d.ts","sourceRoot":"","sources":["../../src/rules/sort-type-constituents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AA6GnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,gBAAgB,GAAG,YAAY,CAAC;;AAEvE,wBAiLG"}
{"version":3,"file":"sort-type-constituents.d.ts","sourceRoot":"","sources":["../../src/rules/sort-type-constituents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AA6GnE,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,gBAAgB,GAAG,YAAY,CAAC;;AAEvE,wBA0MG"}

View file

@ -94,7 +94,32 @@ exports.default = (0, util_1.createRule)({
name: 'sort-type-constituents',
meta: {
type: 'suggestion',
deprecated: true,
deprecated: {
deprecatedSince: '7.13.0',
replacedBy: [
{
plugin: {
name: 'eslint-plugin-perfectionist',
url: 'https://perfectionist.dev',
},
rule: {
name: 'perfectionist/sort-intersection-types',
url: 'https://perfectionist.dev/rules/sort-intersection-types',
},
},
{
plugin: {
name: 'eslint-plugin-perfectionist',
url: 'https://perfectionist.dev',
},
rule: {
name: 'perfectionist/sort-union-types',
url: 'https://perfectionist.dev/rules/sort-union-types',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/9253',
},
docs: {
description: 'Enforce constituents of a type union/intersection to be sorted alphabetically',
},

View file

@ -218,26 +218,75 @@ You should be using `strictNullChecks` to ensure complete type-safety in your co
If for some reason you cannot turn on `strictNullChecks`, but still want to use this rule - you can use this option to allow it - but know that the behavior of this rule is _undefined_ with the compiler option turned off. We will not accept bug reports if you are using this option.
## Limitations
This rule is powered by TypeScript types, therefore, if the types do not match match the runtime behavior, the rule may report inaccurately.
This can happen in several commonplace scenarios.
### Possibly-undefined indexed access
By default, TypeScript optimistically assumes that indexed access will always return a value.
This means that cases like the following will be erroneously flagged as unnecessary conditions:
```ts showPlaygroundButton
const array: string[] = [];
const firstElement = array[0];
// false positive
if (firstElement != null) {
// ...
}
const record: Record<string, string> = {};
const someValue = record.someKey;
// false positive
if (someValue != null) {
// ...
}
```
To get pessimistic, but correct, types for these cases, you can use TypeScript's [`noUncheckedIndexedAccess` compiler option](https://www.typescriptlang.org/tsconfig/#noUncheckedIndexedAccess), though this is often unwieldy in real-world usage.
Another workaround is to use `array.at(0)` (which is always possibly-undefined) to indicate array access that may be out-of-bounds.
Otherwise, a disable comment will often make sense for these kinds of cases.
### Values modified within function calls
The following code will be erroneously flagged as unnecessary, even though the condition is modified within the function call.
```ts showPlaygroundButton
let condition = false;
const f = () => {
condition = Math.random() > 0.5;
};
f();
if (condition) {
// ...
}
```
This occurs due to limitations of TypeScript's type narrowing.
See [microsoft/TypeScript#9998](https://github.com/microsoft/TypeScript/issues/9998) for details.
We recommend using a [type assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions) in these cases, like so:
```ts showPlaygroundButton
let condition = false as boolean;
const f = () => {
condition = Math.random() > 0.5;
};
f();
if (condition) {
// ...
}
```
## When Not To Use It
If your project is not accurately typed, such as if it's in the process of being converted to TypeScript or is susceptible to [trade-offs in control flow analysis](https://github.com/Microsoft/TypeScript/issues/9998), it may be difficult to enable this rule for particularly non-type-safe areas of code.
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.
This rule has a known edge case of triggering on conditions that were modified within function calls (as side effects).
It is due to limitations of TypeScript's type narrowing.
See [#9998](https://github.com/microsoft/TypeScript/issues/9998) for details.
We recommend using a [type assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions) in those cases.
```ts
let condition = false as boolean;
const f = () => (condition = true);
f();
if (condition) {
}
```
## Related To
- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - `no-unnecessary-condition` is essentially a stronger version of `no-constant-condition`, but requires type information.

View file

@ -17,6 +17,54 @@ This rule reports when you may consider replacing:
- An `||` operator with `??`
- An `||=` operator with `??=`
- Ternary expressions (`?:`) that are equivalent to `||` or `??` with `??`
- Assignment expressions (`=`) that can be safely replaced by `??=`
## Examples
<Tabs>
<TabItem value="❌ Incorrect">
```ts
declare const a: string | null;
declare const b: string | null;
const c = a || b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFooByTruthiness() {
if (!foo) {
foo = makeFoo();
}
}
function lazyInitializeFooByNullCheck() {
if (foo == null) {
foo = makeFoo();
}
}
```
</TabItem>
<TabItem value="✅ Correct">
```ts
declare const a: string | null;
declare const b: string | null;
const c = a ?? b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFoo() {
foo ??= makeFoo();
}
```
</TabItem>
</Tabs>
:::caution
This rule will not work as expected if [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) is not enabled.
@ -255,3 +303,4 @@ If you are not using TypeScript 3.7 (or greater), then you will not be able to u
- [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html)
- [Nullish Coalescing Operator Proposal](https://github.com/tc39/proposal-nullish-coalescing/)
- [`logical-assignment-operators`](https://eslint.org/docs/latest/rules/logical-assignment-operators)

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.26.1",
"version": "8.28.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -47,12 +47,12 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1"
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/typescript-estree": "8.26.1",
"@typescript-eslint/typescript-estree": "8.28.0",
"glob": "*",
"jest": "29.7.0",
"jest-specific-snapshot": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.26.1",
"version": "8.28.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1 +1 @@
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAwhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAyhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}

View file

@ -1402,6 +1402,7 @@ class Converter {
parameter = this.convertChild(node.name);
result = this.createNode(node, {
type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern,
range: [node.name.getStart(this.ast), node.initializer.end],
decorators: [],
left: parameter,
optional: false,

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.26.1",
"version": "8.28.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -55,8 +55,8 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -20,11 +20,66 @@ export interface RuleMetaDataDocs {
*/
url?: string;
}
export interface ExternalSpecifier {
/**
* Name of the referenced plugin / rule.
*/
name?: string;
/**
* URL pointing to documentation for the plugin / rule.
*/
url?: string;
}
export interface ReplacedByInfo {
/**
* General message presented to the user, e.g. how to replace the rule
*/
message?: string;
/**
* URL to more information about this replacement in general
*/
url?: string;
/**
* Name should be "eslint" if the replacement is an ESLint core rule. Omit
* the property if the replacement is in the same plugin.
*/
plugin?: ExternalSpecifier;
/**
* Name and documentation of the replacement rule
*/
rule?: ExternalSpecifier;
}
export interface DeprecatedInfo {
/**
* General message presented to the user, e.g. for the key rule why the rule
* is deprecated or for info how to replace the rule.
*/
message?: string;
/**
* URL to more information about this deprecation in general.
*/
url?: string;
/**
* An empty array explicitly states that there is no replacement.
*/
replacedBy?: ReplacedByInfo[];
/**
* The package version since when the rule is deprecated (should use full
* semver without a leading "v").
*/
deprecatedSince?: string;
/**
* The estimated version when the rule is removed (probably the next major
* version). null means the rule is "frozen" (will be available but will not
* be changed).
*/
availableUntil?: string | null;
}
export interface RuleMetaData<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []> {
/**
* True if the rule is deprecated, false otherwise
*/
deprecated?: boolean;
deprecated?: boolean | DeprecatedInfo;
/**
* Documentation for the rule
*/
@ -45,6 +100,8 @@ export interface RuleMetaData<MessageIds extends string, PluginDocs = unknown, O
messages: Record<MessageIds, string>;
/**
* The name of the rule this rule was replaced by, if it was deprecated.
*
* @deprecated since eslint 9.21.0, in favor of `RuleMetaData#deprecated.replacedBy`
*/
replacedBy?: readonly string[];
/**

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.26.1",
"version": "8.28.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -65,9 +65,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.26.1",
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/typescript-estree": "8.26.1"
"@typescript-eslint/scope-manager": "8.28.0",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/typescript-estree": "8.28.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.26.1",
"version": "8.28.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -48,7 +48,7 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -9,7 +9,7 @@
<p align="center">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 8 👪" src="https://img.shields.io/badge/all_contributors-8_👪-21bb42.svg" />
<img alt="All Contributors: 10 👪" src="https://img.shields.io/badge/all_contributors-10_👪-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
<a href="https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
@ -67,6 +67,8 @@ Many thanks to [@ajafff](https://github.com/ajafff) for creating the original [`
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/issues?q=author%3ARebeccaStevens" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Documentation">📖</a> <a href="#projectManagement-RebeccaStevens" title="Project Management">📆</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Tests">⚠️</a> <a href="#tool-RebeccaStevens" title="Tools">🔧</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-RebeccaStevens" title="Maintenance">🚧</a> <a href="#ideas-RebeccaStevens" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/ronenamiel"><img src="https://avatars.githubusercontent.com/u/5484230?v=4?s=100" width="100px;" alt="Ronen Amiel"/><br /><sub><b>Ronen Amiel</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=ronami" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.fiskercheung.com/"><img src="https://avatars.githubusercontent.com/u/172584?v=4?s=100" width="100px;" alt="fisker Cheung"/><br /><sub><b>fisker Cheung</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=fisker" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View file

@ -1024,9 +1024,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1046,7 +1047,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
@ -1064,14 +1065,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1085,6 +1088,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9__default.default.ModifierFlags.Readonly) || ts9__default.default.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9__default.default.NodeFlags.Const) || ts9__default.default.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9__default.default.isEnumMember(node) || (ts9__default.default.isPropertyAssignment(node) || ts9__default.default.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1095,12 +1101,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1111,7 +1116,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1145,17 +1150,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2099,6 +2104,7 @@ exports.hasModifiers = hasModifiers;
exports.hasType = hasType;
exports.hasTypeArguments = hasTypeArguments;
exports.includesModifier = includesModifier;
exports.intersectionConstituents = intersectionConstituents;
exports.intersectionTypeParts = intersectionTypeParts;
exports.isAbstractKeyword = isAbstractKeyword;
exports.isAccessExpression = isAccessExpression;
@ -2269,6 +2275,8 @@ exports.isValidPropertyAccess = isValidPropertyAccess;
exports.isVariableLikeDeclaration = isVariableLikeDeclaration;
exports.isVoidKeyword = isVoidKeyword;
exports.symbolHasReadonlyDeclaration = symbolHasReadonlyDeclaration;
exports.typeConstituents = typeConstituents;
exports.typeIsLiteral = typeIsLiteral;
exports.typeParts = typeParts;
exports.unionConstituents = unionConstituents;
exports.unionTypeParts = unionTypeParts;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1018,9 +1018,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1040,7 +1041,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
@ -1058,14 +1059,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1079,6 +1082,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9.ModifierFlags.Readonly) || ts9.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9.NodeFlags.Const) || ts9.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9.isEnumMember(node) || (ts9.isPropertyAssignment(node) || ts9.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1089,12 +1095,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1105,7 +1110,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1139,17 +1144,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2075,4 +2080,4 @@ function collectVariableUsage(sourceFile) {
return new UsageWalker().getUsage(sourceFile);
}
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeIsLiteral, typeParts, unionTypeParts };
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionConstituents, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeConstituents, typeIsLiteral, typeParts, unionConstituents, unionTypeParts };

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.1",
"version": "2.1.0",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -37,7 +37,6 @@
"lint": "eslint . --max-warnings 0",
"lint:docs": "typedoc --validation --treatValidationWarningsAsErrors",
"lint:knip": "knip",
"lint:knip:production": "knip --production",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
@ -72,10 +71,10 @@
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.43.6",
"knip": "^5.46.0",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"markdownlint-cli": "^0.44.0",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.8",
@ -90,12 +89,12 @@
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
"vitest": "^3.0.0"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.15.3",
"packageManager": "pnpm@9.15.9",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.26.1",
"version": "8.28.0",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@ -62,10 +62,10 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.26.1",
"@typescript-eslint/type-utils": "8.26.1",
"@typescript-eslint/utils": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1",
"@typescript-eslint/scope-manager": "8.28.0",
"@typescript-eslint/type-utils": "8.28.0",
"@typescript-eslint/utils": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -76,8 +76,8 @@
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.26.1",
"@typescript-eslint/rule-tester": "8.26.1",
"@typescript-eslint/rule-schema-to-typescript-types": "8.28.0",
"@typescript-eslint/rule-tester": "8.28.0",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.26.1",
"version": "8.28.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -47,12 +47,12 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1"
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/typescript-estree": "8.26.1",
"@typescript-eslint/typescript-estree": "8.28.0",
"glob": "*",
"jest": "29.7.0",
"jest-specific-snapshot": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.26.1",
"version": "8.28.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1 +1 @@
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAwhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAyhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}

View file

@ -1402,6 +1402,7 @@ class Converter {
parameter = this.convertChild(node.name);
result = this.createNode(node, {
type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern,
range: [node.name.getStart(this.ast), node.initializer.end],
decorators: [],
left: parameter,
optional: false,

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.26.1",
"version": "8.28.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -55,8 +55,8 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.26.1",
"version": "8.28.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -48,7 +48,7 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -9,7 +9,7 @@
<p align="center">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 8 👪" src="https://img.shields.io/badge/all_contributors-8_👪-21bb42.svg" />
<img alt="All Contributors: 10 👪" src="https://img.shields.io/badge/all_contributors-10_👪-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
<a href="https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
@ -67,6 +67,8 @@ Many thanks to [@ajafff](https://github.com/ajafff) for creating the original [`
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/issues?q=author%3ARebeccaStevens" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Documentation">📖</a> <a href="#projectManagement-RebeccaStevens" title="Project Management">📆</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Tests">⚠️</a> <a href="#tool-RebeccaStevens" title="Tools">🔧</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-RebeccaStevens" title="Maintenance">🚧</a> <a href="#ideas-RebeccaStevens" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/ronenamiel"><img src="https://avatars.githubusercontent.com/u/5484230?v=4?s=100" width="100px;" alt="Ronen Amiel"/><br /><sub><b>Ronen Amiel</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=ronami" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.fiskercheung.com/"><img src="https://avatars.githubusercontent.com/u/172584?v=4?s=100" width="100px;" alt="fisker Cheung"/><br /><sub><b>fisker Cheung</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=fisker" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View file

@ -1024,9 +1024,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1046,7 +1047,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
@ -1064,14 +1065,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1085,6 +1088,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9__default.default.ModifierFlags.Readonly) || ts9__default.default.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9__default.default.NodeFlags.Const) || ts9__default.default.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9__default.default.isEnumMember(node) || (ts9__default.default.isPropertyAssignment(node) || ts9__default.default.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1095,12 +1101,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1111,7 +1116,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1145,17 +1150,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2099,6 +2104,7 @@ exports.hasModifiers = hasModifiers;
exports.hasType = hasType;
exports.hasTypeArguments = hasTypeArguments;
exports.includesModifier = includesModifier;
exports.intersectionConstituents = intersectionConstituents;
exports.intersectionTypeParts = intersectionTypeParts;
exports.isAbstractKeyword = isAbstractKeyword;
exports.isAccessExpression = isAccessExpression;
@ -2269,6 +2275,8 @@ exports.isValidPropertyAccess = isValidPropertyAccess;
exports.isVariableLikeDeclaration = isVariableLikeDeclaration;
exports.isVoidKeyword = isVoidKeyword;
exports.symbolHasReadonlyDeclaration = symbolHasReadonlyDeclaration;
exports.typeConstituents = typeConstituents;
exports.typeIsLiteral = typeIsLiteral;
exports.typeParts = typeParts;
exports.unionConstituents = unionConstituents;
exports.unionTypeParts = unionTypeParts;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1018,9 +1018,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1040,7 +1041,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
@ -1058,14 +1059,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1079,6 +1082,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9.ModifierFlags.Readonly) || ts9.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9.NodeFlags.Const) || ts9.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9.isEnumMember(node) || (ts9.isPropertyAssignment(node) || ts9.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1089,12 +1095,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1105,7 +1110,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1139,17 +1144,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2075,4 +2080,4 @@ function collectVariableUsage(sourceFile) {
return new UsageWalker().getUsage(sourceFile);
}
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeIsLiteral, typeParts, unionTypeParts };
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionConstituents, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeConstituents, typeIsLiteral, typeParts, unionConstituents, unionTypeParts };

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.1",
"version": "2.1.0",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -37,7 +37,6 @@
"lint": "eslint . --max-warnings 0",
"lint:docs": "typedoc --validation --treatValidationWarningsAsErrors",
"lint:knip": "knip",
"lint:knip:production": "knip --production",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
@ -72,10 +71,10 @@
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.43.6",
"knip": "^5.46.0",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"markdownlint-cli": "^0.44.0",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.8",
@ -90,12 +89,12 @@
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
"vitest": "^3.0.0"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.15.3",
"packageManager": "pnpm@9.15.9",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "8.26.1",
"version": "8.28.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@ -54,10 +54,10 @@
"typescript": ">=4.8.4 <5.9.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "8.26.1",
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/typescript-estree": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1",
"@typescript-eslint/scope-manager": "8.28.0",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/typescript-estree": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0",
"debug": "^4.3.4"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.26.1",
"version": "8.28.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -47,12 +47,12 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1"
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/typescript-estree": "8.26.1",
"@typescript-eslint/typescript-estree": "8.28.0",
"glob": "*",
"jest": "29.7.0",
"jest-specific-snapshot": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.26.1",
"version": "8.28.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1 +1 @@
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAwhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAmCtE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,wBAAwB,GAAG,EAAE,CAAC,sBAAsB,GAC1D,OAAO,CAMT;AAED,MAAM,WAAW,OAAO;IACtB,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,SAAS;;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAEvD;;;;;OAKG;gBACS,GAAG,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAsZ1D,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,oCAAoC;IAe5C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,sBAAsB;IA4C9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;OAKG;IACH,OAAO,CAAC,gDAAgD;IAexD;;;;OAIG;IACH,OAAO,CAAC,kDAAkD;IAmB1D;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,+BAA+B;IAgDvC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,sBAAsB;IAoC9B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAyhFnB,OAAO,CAAC,UAAU;IAclB,cAAc,IAAI,QAAQ,CAAC,OAAO;IAIlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA0FlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAgFlB,UAAU,IAAI,OAAO;IAOrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAYhC"}

View file

@ -1402,6 +1402,7 @@ class Converter {
parameter = this.convertChild(node.name);
result = this.createNode(node, {
type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern,
range: [node.name.getStart(this.ast), node.initializer.end],
decorators: [],
left: parameter,
optional: false,

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.26.1",
"version": "8.28.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -55,8 +55,8 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/visitor-keys": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/visitor-keys": "8.28.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -20,11 +20,66 @@ export interface RuleMetaDataDocs {
*/
url?: string;
}
export interface ExternalSpecifier {
/**
* Name of the referenced plugin / rule.
*/
name?: string;
/**
* URL pointing to documentation for the plugin / rule.
*/
url?: string;
}
export interface ReplacedByInfo {
/**
* General message presented to the user, e.g. how to replace the rule
*/
message?: string;
/**
* URL to more information about this replacement in general
*/
url?: string;
/**
* Name should be "eslint" if the replacement is an ESLint core rule. Omit
* the property if the replacement is in the same plugin.
*/
plugin?: ExternalSpecifier;
/**
* Name and documentation of the replacement rule
*/
rule?: ExternalSpecifier;
}
export interface DeprecatedInfo {
/**
* General message presented to the user, e.g. for the key rule why the rule
* is deprecated or for info how to replace the rule.
*/
message?: string;
/**
* URL to more information about this deprecation in general.
*/
url?: string;
/**
* An empty array explicitly states that there is no replacement.
*/
replacedBy?: ReplacedByInfo[];
/**
* The package version since when the rule is deprecated (should use full
* semver without a leading "v").
*/
deprecatedSince?: string;
/**
* The estimated version when the rule is removed (probably the next major
* version). null means the rule is "frozen" (will be available but will not
* be changed).
*/
availableUntil?: string | null;
}
export interface RuleMetaData<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []> {
/**
* True if the rule is deprecated, false otherwise
*/
deprecated?: boolean;
deprecated?: boolean | DeprecatedInfo;
/**
* Documentation for the rule
*/
@ -45,6 +100,8 @@ export interface RuleMetaData<MessageIds extends string, PluginDocs = unknown, O
messages: Record<MessageIds, string>;
/**
* The name of the rule this rule was replaced by, if it was deprecated.
*
* @deprecated since eslint 9.21.0, in favor of `RuleMetaData#deprecated.replacedBy`
*/
replacedBy?: readonly string[];
/**

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.26.1",
"version": "8.28.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -65,9 +65,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.26.1",
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/typescript-estree": "8.26.1"
"@typescript-eslint/scope-manager": "8.28.0",
"@typescript-eslint/types": "8.28.0",
"@typescript-eslint/typescript-estree": "8.28.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.26.1",
"version": "8.28.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -48,7 +48,7 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.26.1",
"@typescript-eslint/types": "8.28.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -9,7 +9,7 @@
<p align="center">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 8 👪" src="https://img.shields.io/badge/all_contributors-8_👪-21bb42.svg" />
<img alt="All Contributors: 10 👪" src="https://img.shields.io/badge/all_contributors-10_👪-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
<a href="https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
@ -67,6 +67,8 @@ Many thanks to [@ajafff](https://github.com/ajafff) for creating the original [`
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/issues?q=author%3ARebeccaStevens" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Documentation">📖</a> <a href="#projectManagement-RebeccaStevens" title="Project Management">📆</a> <a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=RebeccaStevens" title="Tests">⚠️</a> <a href="#tool-RebeccaStevens" title="Tools">🔧</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-RebeccaStevens" title="Maintenance">🚧</a> <a href="#ideas-RebeccaStevens" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/ronenamiel"><img src="https://avatars.githubusercontent.com/u/5484230?v=4?s=100" width="100px;" alt="Ronen Amiel"/><br /><sub><b>Ronen Amiel</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=ronami" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.fiskercheung.com/"><img src="https://avatars.githubusercontent.com/u/172584?v=4?s=100" width="100px;" alt="fisker Cheung"/><br /><sub><b>fisker Cheung</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/ts-api-utils/commits?author=fisker" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View file

@ -1024,9 +1024,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1046,7 +1047,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9__default.default.IndexKind.String);
if (index?.isReadonly) {
@ -1064,14 +1065,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1085,6 +1088,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9__default.default.ModifierFlags.Readonly) || ts9__default.default.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9__default.default.NodeFlags.Const) || ts9__default.default.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9__default.default.isEnumMember(node) || (ts9__default.default.isPropertyAssignment(node) || ts9__default.default.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1095,12 +1101,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1111,7 +1116,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1145,17 +1150,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9__default.default.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2099,6 +2104,7 @@ exports.hasModifiers = hasModifiers;
exports.hasType = hasType;
exports.hasTypeArguments = hasTypeArguments;
exports.includesModifier = includesModifier;
exports.intersectionConstituents = intersectionConstituents;
exports.intersectionTypeParts = intersectionTypeParts;
exports.isAbstractKeyword = isAbstractKeyword;
exports.isAccessExpression = isAccessExpression;
@ -2269,6 +2275,8 @@ exports.isValidPropertyAccess = isValidPropertyAccess;
exports.isVariableLikeDeclaration = isVariableLikeDeclaration;
exports.isVoidKeyword = isVoidKeyword;
exports.symbolHasReadonlyDeclaration = symbolHasReadonlyDeclaration;
exports.typeConstituents = typeConstituents;
exports.typeIsLiteral = typeIsLiteral;
exports.typeParts = typeParts;
exports.unionConstituents = unionConstituents;
exports.unionTypeParts = unionTypeParts;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1018,9 +1018,10 @@ function isInConstContext(node, typeChecker) {
}
// src/types/utilities.ts
function intersectionTypeParts(type) {
function intersectionConstituents(type) {
return isIntersectionType(type) ? type.types : [type];
}
var intersectionTypeParts = intersectionConstituents;
function isFalsyType(type) {
if (isTypeFlagSet(
type,
@ -1040,7 +1041,7 @@ function isFalsyType(type) {
function isPropertyReadonlyInType(type, name, typeChecker) {
let seenProperty = false;
let seenReadonlySignature = false;
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (getPropertyOfType(subType, name) === undefined) {
const index = (isNumericPropertyName(name) ? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.Number) : undefined) ?? typeChecker.getIndexInfoOfType(subType, ts9.IndexKind.String);
if (index?.isReadonly) {
@ -1058,14 +1059,16 @@ function isPropertyReadonlyInType(type, name, typeChecker) {
return false;
}
function isThenableType(typeChecker, node, type = typeChecker.getTypeAtLocation(node)) {
for (const typePart of unionTypeParts(typeChecker.getApparentType(type))) {
const then = typePart.getProperty("then");
for (const constituent of unionConstituents(
typeChecker.getApparentType(type)
)) {
const then = constituent.getProperty("then");
if (then === undefined) {
continue;
}
const thenType = typeChecker.getTypeOfSymbolAtLocation(then, node);
for (const subTypePart of unionTypeParts(thenType)) {
for (const signature of subTypePart.getCallSignatures()) {
for (const subConstituent of unionConstituents(thenType)) {
for (const signature of subConstituent.getCallSignatures()) {
if (signature.parameters.length !== 0 && isCallback(typeChecker, signature.parameters[0], node)) {
return true;
}
@ -1079,6 +1082,9 @@ function symbolHasReadonlyDeclaration(symbol, typeChecker) {
(node) => isModifierFlagSet(node, ts9.ModifierFlags.Readonly) || ts9.isVariableDeclaration(node) && isNodeFlagSet(node.parent, ts9.NodeFlags.Const) || ts9.isCallExpression(node) && isReadonlyAssignmentDeclaration(node, typeChecker) || ts9.isEnumMember(node) || (ts9.isPropertyAssignment(node) || ts9.isShorthandPropertyAssignment(node)) && isInConstContext(node, typeChecker)
));
}
function typeConstituents(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function typeIsLiteral(type) {
if (isTsVersionAtLeast(5, 0)) {
return type.isLiteral();
@ -1089,12 +1095,11 @@ function typeIsLiteral(type) {
);
}
}
function typeParts(type) {
return isIntersectionType(type) || isUnionType(type) ? type.types : [type];
}
function unionTypeParts(type) {
var typeParts = typeConstituents;
function unionConstituents(type) {
return isUnionType(type) ? type.types : [type];
}
var unionTypeParts = unionConstituents;
function isCallback(typeChecker, param, node) {
let type = typeChecker.getApparentType(
typeChecker.getTypeOfSymbolAtLocation(param, node)
@ -1105,7 +1110,7 @@ function isCallback(typeChecker, param, node) {
return false;
}
}
for (const subType of unionTypeParts(type)) {
for (const subType of unionConstituents(type)) {
if (subType.getCallSignatures().length !== 0) {
return true;
}
@ -1139,17 +1144,17 @@ function isReadonlyPropertyFromMappedType(type, name, typeChecker) {
return modifiersType && isPropertyReadonlyInType(modifiersType, name, typeChecker);
}
function isReadonlyPropertyIntersection(type, name, typeChecker) {
const typeParts2 = isIntersectionType(type) ? type.types : [type];
return typeParts2.some((subType) => {
const prop = getPropertyOfType(subType, name);
const constituents = intersectionConstituents(type);
return constituents.some((constituent) => {
const prop = getPropertyOfType(constituent, name);
if (prop === undefined) {
return false;
}
if (prop.flags & ts9.SymbolFlags.Transient) {
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(subType)) {
return subType.target.readonly;
if (/^(?:[1-9]\d*|0)$/.test(name) && isTupleTypeReference(constituent)) {
return constituent.target.readonly;
}
switch (isReadonlyPropertyFromMappedType(subType, name, typeChecker)) {
switch (isReadonlyPropertyFromMappedType(constituent, name, typeChecker)) {
case false:
return false;
case true:
@ -2075,4 +2080,4 @@ function collectVariableUsage(sourceFile) {
return new UsageWalker().getUsage(sourceFile);
}
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeIsLiteral, typeParts, unionTypeParts };
export { AccessKind, DeclarationDomain, UsageDomain, collectVariableUsage, forEachComment, forEachToken, getAccessKind, getCallSignaturesOfType, getPropertyOfType, getWellKnownSymbolPropertyOfType, hasDecorators, hasExpressionInitializer, hasInitializer, hasJSDoc, hasModifiers, hasType, hasTypeArguments, includesModifier, intersectionConstituents, intersectionTypeParts, isAbstractKeyword, isAccessExpression, isAccessibilityModifier, isAccessorDeclaration, isAccessorKeyword, isAnyKeyword, isArrayBindingElement, isArrayBindingOrAssignmentPattern, isAssertKeyword, isAssertsKeyword, isAssignmentKind, isAssignmentPattern, isAsyncKeyword, isAwaitKeyword, isBigIntKeyword, isBigIntLiteralType, isBindingOrAssignmentElementRestIndicator, isBindingOrAssignmentElementTarget, isBindingOrAssignmentPattern, isBindingPattern, isBlockLike, isBooleanKeyword, isBooleanLiteral, isBooleanLiteralType, isClassLikeDeclaration, isClassMemberModifier, isColonToken, isCompilerOptionEnabled, isConditionalType, isConstAssertionExpression, isConstKeyword, isDeclarationName, isDeclarationWithTypeParameterChildren, isDeclarationWithTypeParameters, isDeclareKeyword, isDefaultKeyword, isDestructuringPattern, isDotToken, isEndOfFileToken, isEntityNameExpression, isEntityNameOrEntityNameExpression, isEnumType, isEqualsGreaterThanToken, isEqualsToken, isEvolvingArrayType, isExclamationToken, isExportKeyword, isFalseKeyword, isFalseLiteral, isFalseLiteralType, isFalsyType, isForInOrOfStatement, isFreshableIntrinsicType, isFreshableType, isFunctionLikeDeclaration, isFunctionScopeBoundary, isImportExpression, isImportKeyword, isInKeyword, isIndexType, isIndexedAccessType, isInstantiableType, isIntersectionType, isIntrinsicAnyType, isIntrinsicBigIntType, isIntrinsicBooleanType, isIntrinsicESSymbolType, isIntrinsicErrorType, isIntrinsicNeverType, isIntrinsicNonPrimitiveType, isIntrinsicNullType, isIntrinsicNumberType, isIntrinsicStringType, isIntrinsicType, isIntrinsicUndefinedType, isIntrinsicUnknownType, isIntrinsicVoidType, isIterationStatement, isJSDocComment, isJSDocNamespaceBody, isJSDocNamespaceDeclaration, isJSDocText, isJSDocTypeReferencingNode, isJsonMinusNumericLiteral, isJsonObjectExpression, isJsxAttributeLike, isJsxAttributeValue, isJsxChild, isJsxTagNameExpression, isJsxTagNamePropertyAccess, isLiteralToken, isLiteralType, isModifierFlagSet, isModuleBody, isModuleName, isModuleReference, isNamedDeclarationWithName, isNamedImportBindings, isNamedImportsOrExports, isNamespaceBody, isNamespaceDeclaration, isNeverKeyword, isNodeFlagSet, isNullKeyword, isNullLiteral, isNumberKeyword, isNumberLiteralType, isNumericOrStringLikeLiteral, isNumericPropertyName, isObjectBindingOrAssignmentElement, isObjectBindingOrAssignmentPattern, isObjectFlagSet, isObjectKeyword, isObjectType, isObjectTypeDeclaration, isOutKeyword, isOverrideKeyword, isParameterPropertyModifier, isPrivateKeyword, isPropertyAccessEntityNameExpression, isPropertyNameLiteral, isPropertyReadonlyInType, isProtectedKeyword, isPseudoLiteralToken, isPublicKeyword, isQuestionDotToken, isQuestionToken, isReadonlyKeyword, isSignatureDeclaration, isStaticKeyword, isStrictCompilerOptionEnabled, isStringKeyword, isStringLiteralType, isStringMappingType, isSubstitutionType, isSuperElementAccessExpression, isSuperExpression, isSuperKeyword, isSuperProperty, isSuperPropertyAccessExpression, isSymbolFlagSet, isSymbolKeyword, isSyntaxList, isTemplateLiteralType, isThenableType, isThisExpression, isThisKeyword, isTransientSymbolLinksFlagSet, isTrueKeyword, isTrueLiteral, isTrueLiteralType, isTupleType, isTupleTypeReference, isTypeFlagSet, isTypeOnlyCompatibleAliasDeclaration, isTypeParameter, isTypeReference, isTypeReferenceType, isTypeVariable, isUndefinedKeyword, isUnionOrIntersectionType, isUnionOrIntersectionTypeNode, isUnionType, isUniqueESSymbolType, isUnknownKeyword, isValidPropertyAccess, isVariableLikeDeclaration, isVoidKeyword, symbolHasReadonlyDeclaration, typeConstituents, typeIsLiteral, typeParts, unionConstituents, unionTypeParts };

View file

@ -1,6 +1,6 @@
{
"name": "ts-api-utils",
"version": "2.0.1",
"version": "2.1.0",
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
"repository": {
"type": "git",
@ -37,7 +37,6 @@
"lint": "eslint . --max-warnings 0",
"lint:docs": "typedoc --validation --treatValidationWarningsAsErrors",
"lint:knip": "knip",
"lint:knip:production": "knip --production",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
@ -72,10 +71,10 @@
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.1.7",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.43.6",
"knip": "^5.46.0",
"lint-staged": "^15.4.3",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"markdownlint-cli": "^0.44.0",
"prettier": "^3.4.2",
"prettier-plugin-curly": "^0.3.1",
"prettier-plugin-packagejson": "^2.5.8",
@ -90,12 +89,12 @@
"typedoc-plugin-mdn-links": "^4.0.10",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"vitest": "^2.1.8"
"vitest": "^3.0.0"
},
"peerDependencies": {
"typescript": ">=4.8.4"
},
"packageManager": "pnpm@9.15.3",
"packageManager": "pnpm@9.15.9",
"engines": {
"node": ">=18.12"
},

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "8.26.1",
"version": "8.28.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -47,8 +47,8 @@
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "8.26.1",
"@typescript-eslint/utils": "8.26.1",
"@typescript-eslint/typescript-estree": "8.28.0",
"@typescript-eslint/utils": "8.28.0",
"debug": "^4.3.4",
"ts-api-utils": "^2.0.1"
},
@ -58,7 +58,7 @@
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "8.26.1",
"@typescript-eslint/parser": "8.28.0",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",