UEA-PRODEM
This commit is contained in:
+1
@@ -148,6 +148,7 @@ declare const _default: {
|
||||
'no-return-await': "off";
|
||||
'@typescript-eslint/return-await': "error";
|
||||
'@typescript-eslint/strict-boolean-expressions': "error";
|
||||
'@typescript-eslint/strict-void-return': "error";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "error";
|
||||
'@typescript-eslint/triple-slash-reference': "error";
|
||||
'@typescript-eslint/unbound-method': "error";
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
@@ -155,6 +155,7 @@ module.exports = {
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': 'error',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'error',
|
||||
'@typescript-eslint/strict-void-return': 'error',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
|
||||
Generated
Vendored
+1
@@ -62,6 +62,7 @@ declare const _default: {
|
||||
'@typescript-eslint/restrict-template-expressions': "off";
|
||||
'@typescript-eslint/return-await': "off";
|
||||
'@typescript-eslint/strict-boolean-expressions': "off";
|
||||
'@typescript-eslint/strict-void-return': "off";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "off";
|
||||
'@typescript-eslint/unbound-method': "off";
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': "off";
|
||||
|
||||
Generated
Vendored
+2
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
parserOptions: { program: null, project: false, projectService: false },
|
||||
rules: {
|
||||
@@ -65,6 +65,7 @@ module.exports = {
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
'@typescript-eslint/strict-void-return': 'off',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'off',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
||||
|
||||
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslintrc/recommended-type-checked-only.js
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
@@ -168,6 +168,7 @@ exports.default = (plugin, parser) => [
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': 'error',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'error',
|
||||
'@typescript-eslint/strict-void-return': 'error',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
|
||||
Generated
Vendored
+2
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.
|
||||
@@ -70,6 +70,7 @@ exports.default = (_plugin, _parser) => ({
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
'@typescript-eslint/strict-void-return': 'off',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'off',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate-configs`
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
+10
-1
@@ -150,6 +150,7 @@ declare const _default: {
|
||||
'no-return-await': "off";
|
||||
'@typescript-eslint/return-await': "error";
|
||||
'@typescript-eslint/strict-boolean-expressions': "error";
|
||||
'@typescript-eslint/strict-void-return': "error";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "error";
|
||||
'@typescript-eslint/triple-slash-reference': "error";
|
||||
'@typescript-eslint/unbound-method': "error";
|
||||
@@ -228,6 +229,7 @@ declare const _default: {
|
||||
'@typescript-eslint/restrict-template-expressions': "off";
|
||||
'@typescript-eslint/return-await': "off";
|
||||
'@typescript-eslint/strict-boolean-expressions': "off";
|
||||
'@typescript-eslint/strict-void-return': "off";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "off";
|
||||
'@typescript-eslint/unbound-method': "off";
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': "off";
|
||||
@@ -989,7 +991,9 @@ declare const _default: {
|
||||
'no-useless-constructor': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noUselessConstructor" | "removeConstructor", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-default-assignment': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
'no-useless-default-assignment': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStrictNullCheck" | "preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [{
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
|
||||
}], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-empty-export': import("@typescript-eslint/utils/ts-eslint").RuleModule<"uselessExport", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
@@ -1096,6 +1100,11 @@ declare const _default: {
|
||||
'strict-boolean-expressions': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/strict-boolean-expressions").MessageId, import("./rules/strict-boolean-expressions").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'strict-void-return': import("@typescript-eslint/utils/ts-eslint").RuleModule<"asyncFunc" | "nonVoidFunc" | "nonVoidReturn", [{
|
||||
allowReturnAny?: boolean;
|
||||
}], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'switch-exhaustiveness-check': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/switch-exhaustiveness-check").MessageIds, import("./rules/switch-exhaustiveness-check").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
|
||||
+10
-1
@@ -172,6 +172,7 @@ declare const _default: {
|
||||
'no-return-await': "off";
|
||||
'@typescript-eslint/return-await': "error";
|
||||
'@typescript-eslint/strict-boolean-expressions': "error";
|
||||
'@typescript-eslint/strict-void-return': "error";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "error";
|
||||
'@typescript-eslint/triple-slash-reference': "error";
|
||||
'@typescript-eslint/unbound-method': "error";
|
||||
@@ -250,6 +251,7 @@ declare const _default: {
|
||||
'@typescript-eslint/restrict-template-expressions': "off";
|
||||
'@typescript-eslint/return-await': "off";
|
||||
'@typescript-eslint/strict-boolean-expressions': "off";
|
||||
'@typescript-eslint/strict-void-return': "off";
|
||||
'@typescript-eslint/switch-exhaustiveness-check': "off";
|
||||
'@typescript-eslint/unbound-method': "off";
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': "off";
|
||||
@@ -1012,7 +1014,9 @@ declare const _default: {
|
||||
'no-useless-constructor': TSESLint.RuleModule<"noUselessConstructor" | "removeConstructor", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-default-assignment': TSESLint.RuleModule<"preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
'no-useless-default-assignment': TSESLint.RuleModule<"noStrictNullCheck" | "preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [{
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
|
||||
}], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-empty-export': TSESLint.RuleModule<"uselessExport", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
@@ -1119,6 +1123,11 @@ declare const _default: {
|
||||
'strict-boolean-expressions': TSESLint.RuleModule<import("./rules/strict-boolean-expressions").MessageId, import("./rules/strict-boolean-expressions").Options, import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'strict-void-return': TSESLint.RuleModule<"asyncFunc" | "nonVoidFunc" | "nonVoidReturn", [{
|
||||
allowReturnAny?: boolean;
|
||||
}], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'switch-exhaustiveness-check': TSESLint.RuleModule<import("./rules/switch-exhaustiveness-check").MessageIds, import("./rules/switch-exhaustiveness-check").Options, import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
|
||||
+5
-13
@@ -165,6 +165,11 @@ exports.default = (0, util_1.createRule)({
|
||||
node.typeArguments?.params[0].type !== utils_1.AST_NODE_TYPES.TSArrayType)) {
|
||||
return;
|
||||
}
|
||||
for (let scope = context.sourceCode.getScope(node); scope.upper; scope = scope.upper) {
|
||||
if (scope.set.has(node.typeName.name)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const isReadonlyWithGenericArrayType = node.typeName.name === 'Readonly' &&
|
||||
node.typeArguments?.params[0].type === utils_1.AST_NODE_TYPES.TSArrayType;
|
||||
const isReadonlyArrayType = node.typeName.name === 'ReadonlyArray' ||
|
||||
@@ -185,19 +190,6 @@ exports.default = (0, util_1.createRule)({
|
||||
? 'errorStringArraySimpleReadonly'
|
||||
: 'errorStringArraySimple';
|
||||
if (!typeParams) {
|
||||
// Create an 'any' array
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: {
|
||||
type: 'any',
|
||||
className: isReadonlyArrayType ? 'ReadonlyArray' : 'Array',
|
||||
readonlyPrefix,
|
||||
},
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node, `${readonlyPrefix}any[]`);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (typeParams.length !== 1 ||
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return execDirectiveRegEx(commentDirectiveRegExSingleLine, comment.value);
|
||||
}
|
||||
const commentLines = comment.value.split('\n');
|
||||
const commentLines = comment.value.split(utils_1.ASTUtils.LINEBREAK_MATCHER);
|
||||
return execDirectiveRegEx(commentDirectiveRegExMultiLine, commentLines[commentLines.length - 1]);
|
||||
}
|
||||
return {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -98,7 +98,7 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return;
|
||||
}
|
||||
const isolatedDeclarations = context.parserOptions.isolatedDeclarations;
|
||||
const isolatedDeclarations = context.languageOptions.parserOptions.isolatedDeclarations;
|
||||
if (!isolatedDeclarations && lhs?.typeArguments && !rhs.typeArguments) {
|
||||
const hasParens = context.sourceCode.getTokenAfter(rhs.callee)?.value === '(';
|
||||
const extraComments = new Set(context.sourceCode.getCommentsInside(lhs.parent));
|
||||
|
||||
Generated
Vendored
+2
-1
@@ -114,7 +114,8 @@ exports.default = (0, util_1.createRule)({
|
||||
.map(p => context.sourceCode.getText(p))
|
||||
.join(', ')}>`;
|
||||
}
|
||||
checkMembers(node.body.body, node, node.id, `type ${node.id.name}${genericTypes} = `, ';', !node.extends.length);
|
||||
checkMembers(node.body.body, node, node.id, `type ${node.id.name}${genericTypes} = `, ';', !node.extends.length &&
|
||||
node.parent.type !== utils_1.AST_NODE_TYPES.ExportDefaultDeclaration);
|
||||
},
|
||||
TSMappedType(node) {
|
||||
const key = node.key;
|
||||
|
||||
Generated
Vendored
+3
-2
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
@@ -86,10 +87,10 @@ exports.default = (0, util_1.createRule)({
|
||||
if (symbol.getDeclarations()?.some(ts.isTypeOnlyImportOrExportDeclaration)) {
|
||||
return true;
|
||||
}
|
||||
if (symbol.flags & ts.SymbolFlags.Value) {
|
||||
if (tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Value)) {
|
||||
return false;
|
||||
}
|
||||
return symbol.flags & ts.SymbolFlags.Alias
|
||||
return tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)
|
||||
? isSymbolTypeBased(checker.getImmediateAliasedSymbol(symbol))
|
||||
: true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ exports.default = (0, util_1.createRule)({
|
||||
.getTypeAtLocation(node.object)
|
||||
.getNonNullableType();
|
||||
const indexInfos = checker.getIndexInfosOfType(objectType);
|
||||
if (indexInfos.some(info => info.keyType.flags & ts.TypeFlags.StringLike)) {
|
||||
if (indexInfos.some(info => tsutils.isTypeFlagSet(info.keyType, ts.TypeFlags.StringLike))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -312,7 +312,9 @@ declare const rules: {
|
||||
'no-useless-constructor': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noUselessConstructor" | "removeConstructor", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-default-assignment': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
'no-useless-default-assignment': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStrictNullCheck" | "preferOptionalSyntax" | "uselessDefaultAssignment" | "uselessUndefined", [{
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
|
||||
}], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'no-useless-empty-export': import("@typescript-eslint/utils/ts-eslint").RuleModule<"uselessExport", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
@@ -419,6 +421,11 @@ declare const rules: {
|
||||
'strict-boolean-expressions': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./strict-boolean-expressions").MessageId, import("./strict-boolean-expressions").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'strict-void-return': import("@typescript-eslint/utils/ts-eslint").RuleModule<"asyncFunc" | "nonVoidFunc" | "nonVoidReturn", [{
|
||||
allowReturnAny?: boolean;
|
||||
}], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
'switch-exhaustiveness-check': import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./switch-exhaustiveness-check").MessageIds, import("./switch-exhaustiveness-check").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
|
||||
+2
@@ -129,6 +129,7 @@ const restrict_template_expressions_1 = __importDefault(require("./restrict-temp
|
||||
const return_await_1 = __importDefault(require("./return-await"));
|
||||
const sort_type_constituents_1 = __importDefault(require("./sort-type-constituents"));
|
||||
const strict_boolean_expressions_1 = __importDefault(require("./strict-boolean-expressions"));
|
||||
const strict_void_return_1 = __importDefault(require("./strict-void-return"));
|
||||
const switch_exhaustiveness_check_1 = __importDefault(require("./switch-exhaustiveness-check"));
|
||||
const triple_slash_reference_1 = __importDefault(require("./triple-slash-reference"));
|
||||
const typedef_1 = __importDefault(require("./typedef"));
|
||||
@@ -263,6 +264,7 @@ const rules = {
|
||||
'return-await': return_await_1.default,
|
||||
'sort-type-constituents': sort_type_constituents_1.default,
|
||||
'strict-boolean-expressions': strict_boolean_expressions_1.default,
|
||||
'strict-void-return': strict_void_return_1.default,
|
||||
'switch-exhaustiveness-check': switch_exhaustiveness_check_1.default,
|
||||
'triple-slash-reference': triple_slash_reference_1.default,
|
||||
typedef: typedef_1.default,
|
||||
|
||||
+1
@@ -457,6 +457,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return [
|
||||
selector,
|
||||
(node) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
handler(node, validator);
|
||||
},
|
||||
];
|
||||
|
||||
+12
-16
@@ -186,8 +186,8 @@ exports.default = (0, util_1.createRule)({
|
||||
return option.checkUnknown ? Usefulness.Sometimes : Usefulness.Always;
|
||||
}
|
||||
// the Boolean type definition missing toString()
|
||||
if (type.flags & ts.TypeFlags.Boolean ||
|
||||
type.flags & ts.TypeFlags.BooleanLiteral) {
|
||||
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.Boolean) ||
|
||||
tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral)) {
|
||||
return Usefulness.Always;
|
||||
}
|
||||
const symbol = type.aliasSymbol ?? type.getSymbol();
|
||||
@@ -247,9 +247,7 @@ exports.default = (0, util_1.createRule)({
|
||||
node.name.expression.expression.text === 'Symbol' &&
|
||||
ts.isIdentifier(node.name.expression.name) &&
|
||||
node.name.expression.name.text === 'toPrimitive' &&
|
||||
checker
|
||||
.getSymbolAtLocation(node.name.expression.expression)
|
||||
?.valueDeclaration?.getSourceFile().hasNoDefaultLib);
|
||||
(0, util_1.isSymbolFromDefaultLibrary)(program, checker.getSymbolAtLocation(node.name.expression.expression)));
|
||||
}
|
||||
function isToStringLikeFromObject(type) {
|
||||
// An explicit [Symbol.toPrimitive] declaration is always user-defined
|
||||
@@ -269,17 +267,15 @@ exports.default = (0, util_1.createRule)({
|
||||
continue;
|
||||
}
|
||||
const declarations = candidate.getDeclarations();
|
||||
// If there are multiple declarations, at least one of them must not be
|
||||
// the default object toString.
|
||||
//
|
||||
// This may only matter for older versions of TS
|
||||
// see https://github.com/typescript-eslint/typescript-eslint/issues/8585
|
||||
if (declarations?.length !== 1) {
|
||||
if (!declarations?.length) {
|
||||
continue;
|
||||
}
|
||||
// Not being the Object interface means this is user-defined.
|
||||
if (!ts.isInterfaceDeclaration(declarations[0].parent) ||
|
||||
declarations[0].parent.name.text !== 'Object') {
|
||||
// If any declaration is not from the Object interface, this is
|
||||
// user-defined (e.g. overloaded toString on a class or module).
|
||||
// see https://github.com/typescript-eslint/typescript-eslint/issues/8585
|
||||
// see https://github.com/typescript-eslint/typescript-eslint/issues/11945
|
||||
if (declarations.some(declaration => !(ts.isInterfaceDeclaration(declaration.parent) &&
|
||||
declaration.parent.name.text === 'Object'))) {
|
||||
return false;
|
||||
}
|
||||
foundFallbackOnObject = true;
|
||||
@@ -293,8 +289,8 @@ exports.default = (0, util_1.createRule)({
|
||||
if ((0, util_1.getTypeName)(checker, leftType) === 'string') {
|
||||
checkExpression(node.right, rightType);
|
||||
}
|
||||
else if ((0, util_1.getTypeName)(checker, rightType) === 'string' &&
|
||||
node.left.type !== utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
else if (node.left.type !== utils_1.AST_NODE_TYPES.PrivateIdentifier &&
|
||||
(0, util_1.getTypeName)(checker, rightType) === 'string') {
|
||||
checkExpression(node.left, leftType);
|
||||
}
|
||||
},
|
||||
|
||||
Generated
Vendored
+9
-11
@@ -97,19 +97,18 @@ exports.default = (0, util_1.createRule)({
|
||||
],
|
||||
create(context, [options]) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
return {
|
||||
'AwaitExpression, CallExpression, TaggedTemplateExpression'(node) {
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
|
||||
if (!tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike)) {
|
||||
// not a void expression
|
||||
return;
|
||||
}
|
||||
const invalidAncestor = findInvalidAncestor(node);
|
||||
if (invalidAncestor == null) {
|
||||
// void expression is in valid position
|
||||
return;
|
||||
}
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
|
||||
if (!tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike)) {
|
||||
// not a void expression
|
||||
return;
|
||||
}
|
||||
const wrapVoidFix = (fixer) => {
|
||||
const nodeText = context.sourceCode.getText(node);
|
||||
const newNodeText = `void ${nodeText}`;
|
||||
@@ -338,15 +337,14 @@ exports.default = (0, util_1.createRule)({
|
||||
// - Otherwise, check if the function is a function-expression or an arrow-function.
|
||||
// - If it is, get its contextual type and bail if we cannot.
|
||||
// - Return based on whether the contextual type includes `void` or not
|
||||
const functionTSNode = services.esTreeNodeToTSNodeMap.get(functionNode);
|
||||
if (functionTSNode.type) {
|
||||
const returnType = checker.getTypeFromTypeNode(functionTSNode.type);
|
||||
if (functionNode.returnType) {
|
||||
const returnType = services.getTypeFromTypeNode(functionNode.returnType.typeAnnotation);
|
||||
return tsutils
|
||||
.unionConstituents(returnType)
|
||||
.some(tsutils.isIntrinsicVoidType);
|
||||
}
|
||||
if (ts.isExpression(functionTSNode)) {
|
||||
const functionType = checker.getContextualType(functionTSNode);
|
||||
if (functionNode.type !== utils_1.AST_NODE_TYPES.FunctionDeclaration) {
|
||||
const functionType = services.getContextualType(functionNode);
|
||||
if (functionType) {
|
||||
return tsutils
|
||||
.unionConstituents(functionType)
|
||||
|
||||
+9
-8
@@ -69,7 +69,7 @@ exports.default = (0, util_1.createRule)({
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const { jsDocParsingMode } = context.parserOptions;
|
||||
const { jsDocParsingMode } = context.languageOptions.parserOptions;
|
||||
const allow = options.allow;
|
||||
if (jsDocParsingMode === 'none' || jsDocParsingMode === 'type-info') {
|
||||
throw new Error(`Cannot be used with jsDocParsingMode: '${jsDocParsingMode}'.`);
|
||||
@@ -124,12 +124,13 @@ exports.default = (0, util_1.createRule)({
|
||||
case utils_1.AST_NODE_TYPES.Property:
|
||||
// foo in "const { foo } = bar" will be processed twice, as parent.key
|
||||
// and parent.value. The second is treated as a declaration.
|
||||
if (parent.shorthand && parent.value === node) {
|
||||
if (parent.value === node) {
|
||||
// const { foo: bar } = baz; -- bar IS a declaration.
|
||||
// const baz = { foo: bar }; -- bar IS NOT a declaration.
|
||||
return parent.parent.type === utils_1.AST_NODE_TYPES.ObjectPattern;
|
||||
}
|
||||
if (parent.value === node) {
|
||||
return false;
|
||||
}
|
||||
// const { foo: bar } = baz; -- foo IS NOT a declaration.
|
||||
// const baz = { foo: bar }; -- foo IS a declaration.
|
||||
return parent.parent.type === utils_1.AST_NODE_TYPES.ObjectExpression;
|
||||
case utils_1.AST_NODE_TYPES.AssignmentPattern:
|
||||
// foo in "const { foo = "" } = bar" will be processed twice, as parent.parent.key
|
||||
@@ -267,8 +268,7 @@ exports.default = (0, util_1.createRule)({
|
||||
false) ?? getJsDocDeprecation(signature));
|
||||
}
|
||||
function getJSXAttributeDeprecation(openingElement, propertyName) {
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(openingElement.name);
|
||||
const contextualType = (0, util_1.nullThrows)(checker.getContextualType(tsNode), 'Expected JSX opening element name to have contextualType');
|
||||
const contextualType = (0, util_1.nullThrows)(services.getContextualType(openingElement.name), 'Expected JSX opening element name to have contextualType');
|
||||
const symbol = contextualType.getProperty(propertyName);
|
||||
return getJsDocDeprecation(symbol);
|
||||
}
|
||||
@@ -331,7 +331,8 @@ exports.default = (0, util_1.createRule)({
|
||||
const objectType = services.getTypeAtLocation(node.object);
|
||||
const propertyName = propertyType.isStringLiteral()
|
||||
? propertyType.value
|
||||
: String(propertyType.value);
|
||||
: // eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
String(propertyType.value);
|
||||
const property = objectType.getProperty(propertyName);
|
||||
const reason = getJsDocDeprecation(property);
|
||||
if (reason == null) {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -46,7 +46,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return initializer.operator === '-' ? -inner : inner;
|
||||
}
|
||||
case isStaticTemplateLiteral(initializer):
|
||||
return initializer.quasis[0].value.cooked;
|
||||
return initializer.quasis[0].value.cooked ?? undefined;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Generated
Vendored
+14
-6
@@ -148,17 +148,25 @@ exports.default = (0, util_1.createRule)({
|
||||
});
|
||||
}
|
||||
function checkDuplicateRecursively(unionOrIntersection, constituentNode, uniqueConstituents, cachedTypeMap, forEachNodeType) {
|
||||
const reportDuplicate = (previous) => {
|
||||
report('duplicate', constituentNode, {
|
||||
type: unionOrIntersection,
|
||||
previous: sourceCode.getText(previous),
|
||||
});
|
||||
};
|
||||
// Check duplicates in the AST before type lookup for better performance.
|
||||
let duplicatedPrevious = uniqueConstituents.find(ele => isSameAstNode(ele, constituentNode));
|
||||
if (duplicatedPrevious) {
|
||||
reportDuplicate(duplicatedPrevious);
|
||||
return;
|
||||
}
|
||||
const type = parserServices.getTypeAtLocation(constituentNode);
|
||||
if (tsutils.isIntrinsicErrorType(type)) {
|
||||
return;
|
||||
}
|
||||
const duplicatedPrevious = uniqueConstituents.find(ele => isSameAstNode(ele, constituentNode)) ??
|
||||
cachedTypeMap.get(type);
|
||||
duplicatedPrevious = cachedTypeMap.get(type);
|
||||
if (duplicatedPrevious) {
|
||||
report('duplicate', constituentNode, {
|
||||
type: unionOrIntersection,
|
||||
previous: sourceCode.getText(duplicatedPrevious),
|
||||
});
|
||||
reportDuplicate(duplicatedPrevious);
|
||||
return;
|
||||
}
|
||||
forEachNodeType?.(type, constituentNode);
|
||||
|
||||
+1
@@ -89,6 +89,7 @@ exports.default = (0, util_1.createRule)({
|
||||
prop.type === utils_1.AST_NODE_TYPES.MethodDefinition ||
|
||||
prop.type === utils_1.AST_NODE_TYPES.AccessorProperty) &&
|
||||
!prop.static) ||
|
||||
prop.type === utils_1.AST_NODE_TYPES.TSIndexSignature ||
|
||||
prop.type === utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition ||
|
||||
prop.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition || // `static abstract` methods and properties are currently not supported. See: https://github.com/microsoft/TypeScript/issues/34516
|
||||
prop.type === utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty) {
|
||||
|
||||
+13
-1
@@ -291,7 +291,10 @@ exports.default = (0, util_1.createRule)({
|
||||
return { isUnhandled: true };
|
||||
}
|
||||
function isPromiseArray(node) {
|
||||
const type = checker.getTypeAtLocation(node);
|
||||
const type = getTypeAtLocation(checker, node);
|
||||
if (type == null) {
|
||||
return false;
|
||||
}
|
||||
for (const ty of tsutils
|
||||
.unionConstituents(type)
|
||||
.map(t => checker.getApparentType(t))) {
|
||||
@@ -363,3 +366,12 @@ function isFunctionParam(checker, param, node) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getTypeAtLocation(checker, node) {
|
||||
try {
|
||||
return checker.getTypeAtLocation(node);
|
||||
}
|
||||
catch {
|
||||
// Workaround for https://github.com/typescript-eslint/typescript-eslint/issues/11947
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-13
@@ -29,11 +29,23 @@ Array.isArray(baseRule.meta.schema)
|
||||
},
|
||||
},
|
||||
});
|
||||
const defaultOptions = [
|
||||
{
|
||||
detectObjects: false,
|
||||
enforceConst: false,
|
||||
ignore: [],
|
||||
ignoreArrayIndexes: false,
|
||||
ignoreEnums: false,
|
||||
ignoreNumericLiteralTypes: false,
|
||||
ignoreReadonlyClassProperties: false,
|
||||
ignoreTypeIndexes: false,
|
||||
},
|
||||
];
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-magic-numbers',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
// defaultOptions, -- base rule does not use defaultOptions
|
||||
defaultOptions,
|
||||
docs: {
|
||||
description: 'Disallow magic numbers',
|
||||
extendsBaseRule: true,
|
||||
@@ -42,18 +54,7 @@ exports.default = (0, util_1.createRule)({
|
||||
messages: baseRule.meta.messages,
|
||||
schema: [schema],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
detectObjects: false,
|
||||
enforceConst: false,
|
||||
ignore: [],
|
||||
ignoreArrayIndexes: false,
|
||||
ignoreEnums: false,
|
||||
ignoreNumericLiteralTypes: false,
|
||||
ignoreReadonlyClassProperties: false,
|
||||
ignoreTypeIndexes: false,
|
||||
},
|
||||
],
|
||||
defaultOptions,
|
||||
create(context, [options]) {
|
||||
const rules = baseRule.create(context);
|
||||
const ignored = new Set((options.ignore ?? []).map(normalizeIgnoreValue));
|
||||
|
||||
Generated
Vendored
+2
-3
@@ -79,7 +79,7 @@ exports.default = (0, util_1.createRule)({
|
||||
};
|
||||
const argType = services.getTypeAtLocation(node.argument);
|
||||
const unionParts = tsutils.unionConstituents(argType);
|
||||
if (unionParts.every(part => part.flags & (ts.TypeFlags.Void | ts.TypeFlags.Undefined))) {
|
||||
if (unionParts.every(part => tsutils.isTypeFlagSet(part, ts.TypeFlags.Void | ts.TypeFlags.Undefined))) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'meaninglessVoidOperator',
|
||||
@@ -88,8 +88,7 @@ exports.default = (0, util_1.createRule)({
|
||||
});
|
||||
}
|
||||
else if (checkNever &&
|
||||
unionParts.every(part => part.flags &
|
||||
(ts.TypeFlags.Void | ts.TypeFlags.Undefined | ts.TypeFlags.Never))) {
|
||||
unionParts.every(part => tsutils.isTypeFlagSet(part, ts.TypeFlags.Void | ts.TypeFlags.Undefined | ts.TypeFlags.Never))) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'meaninglessVoidOperator',
|
||||
|
||||
+8
-2
@@ -139,10 +139,16 @@ exports.default = (0, util_1.createRule)({
|
||||
return {
|
||||
...keywordSelectors,
|
||||
TSClassImplements(node) {
|
||||
checkBannedTypes(node);
|
||||
checkBannedTypes(node.expression);
|
||||
if (node.typeArguments) {
|
||||
checkBannedTypes(node);
|
||||
}
|
||||
},
|
||||
TSInterfaceHeritage(node) {
|
||||
checkBannedTypes(node);
|
||||
checkBannedTypes(node.expression);
|
||||
if (node.typeArguments) {
|
||||
checkBannedTypes(node);
|
||||
}
|
||||
},
|
||||
TSTupleType(node) {
|
||||
if (!node.elementTypes.length) {
|
||||
|
||||
+46
-16
@@ -322,29 +322,59 @@ exports.default = (0, util_1.createRule)({
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks if a variable is inside the initializer of scopeVar.
|
||||
* Finds the uppermost expression node that can evaluate to the given one,
|
||||
* unwrapping through LogicalExpression and non-test ConditionalExpression branches.
|
||||
* @param node The node to unwrap.
|
||||
* @returns The topmost unwrapped node.
|
||||
*/
|
||||
function unwrapExpression(node) {
|
||||
const { parent } = node;
|
||||
if (parent?.type === utils_1.AST_NODE_TYPES.LogicalExpression ||
|
||||
(parent?.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&
|
||||
parent.test !== node)) {
|
||||
return unwrapExpression(parent);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
/**
|
||||
* Checks if a variable is the name of a function or class expression that is
|
||||
* directly assigned (or transparently through `||`/`?:`) as the initializer
|
||||
* of scopeVar.
|
||||
*
|
||||
* To avoid reporting at declarations such as `var a = function a() {};`.
|
||||
* But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`.
|
||||
* Allows `var a = function a() {}` but reports `var a = wrap(function a() {})`.
|
||||
* @param variable The variable to check.
|
||||
* @param scopeVar The scope variable to look for.
|
||||
* @returns Whether or not the variable is inside initializer of scopeVar.
|
||||
* @returns Whether or not the variable is the direct initializer name of scopeVar.
|
||||
*/
|
||||
function isOnInitializer(variable, scopeVar) {
|
||||
const outerScope = scopeVar.scope;
|
||||
const outerDef = scopeVar.defs.at(0);
|
||||
const outer = outerDef?.parent?.range;
|
||||
const innerScope = variable.scope;
|
||||
const innerDef = variable.defs.at(0);
|
||||
const inner = innerDef?.name.range;
|
||||
return !!(outer &&
|
||||
inner &&
|
||||
outer[0] < inner[0] &&
|
||||
inner[1] < outer[1] &&
|
||||
((innerDef.type === scope_manager_1.DefinitionType.FunctionName &&
|
||||
innerDef.node.type === utils_1.AST_NODE_TYPES.FunctionExpression) ||
|
||||
innerDef.node.type === utils_1.AST_NODE_TYPES.ClassExpression) &&
|
||||
outerScope === innerScope.upper);
|
||||
if (!outerDef || !innerDef) {
|
||||
return false;
|
||||
}
|
||||
if (!((innerDef.type === scope_manager_1.DefinitionType.FunctionName &&
|
||||
innerDef.node.type === utils_1.AST_NODE_TYPES.FunctionExpression) ||
|
||||
(innerDef.type === scope_manager_1.DefinitionType.ClassName &&
|
||||
innerDef.node.type === utils_1.AST_NODE_TYPES.ClassExpression))) {
|
||||
return false;
|
||||
}
|
||||
const outerIdentifier = outerDef.name;
|
||||
let initializerNode;
|
||||
if (outerIdentifier.parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator) {
|
||||
initializerNode = outerIdentifier.parent.init;
|
||||
}
|
||||
else if (outerIdentifier.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
||||
initializerNode = outerIdentifier.parent.right;
|
||||
}
|
||||
if (!initializerNode) {
|
||||
return false;
|
||||
}
|
||||
const nodeToCheck = innerDef.node;
|
||||
if (!(initializerNode.range[0] <= nodeToCheck.range[0] &&
|
||||
nodeToCheck.range[1] <= initializerNode.range[1])) {
|
||||
return false;
|
||||
}
|
||||
return initializerNode === unwrapExpression(nodeToCheck);
|
||||
}
|
||||
/**
|
||||
* Get a range of a variable's identifier node.
|
||||
|
||||
Generated
Vendored
+1
-3
@@ -174,9 +174,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return undefined;
|
||||
}
|
||||
function nodeIsUnaryNegation(node) {
|
||||
return (node.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||
node.prefix &&
|
||||
node.operator === '!');
|
||||
return (node.type === utils_1.AST_NODE_TYPES.UnaryExpression && node.operator === '!');
|
||||
}
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
|
||||
Generated
Vendored
+22
-11
@@ -51,7 +51,9 @@ function isAlwaysNullish(type) {
|
||||
* `any` or `unknown` to be nullable.
|
||||
*/
|
||||
function isPossiblyNullish(type) {
|
||||
return tsutils.unionConstituents(type).some(isNullishType);
|
||||
return tsutils
|
||||
.unionConstituents(type)
|
||||
.some(t => isNullishType(t) || (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Void));
|
||||
}
|
||||
function toStaticValue(type) {
|
||||
// type.isLiteral() only covers numbers/bigints and strings, hence the rest of the branches.
|
||||
@@ -396,14 +398,6 @@ exports.default = (0, util_1.createRule)({
|
||||
// The right side will be checked if the LogicalExpression is used in a conditional context
|
||||
checkNode(node.left);
|
||||
}
|
||||
function checkIfWhileLoopIsNecessaryConditional(node) {
|
||||
if (allowConstantLoopConditionsOption === 'only-allowed-literals' &&
|
||||
node.test.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
constantLoopConditionsAllowedLiterals.has(node.test.value)) {
|
||||
return;
|
||||
}
|
||||
checkIfLoopIsNecessaryConditional(node);
|
||||
}
|
||||
/**
|
||||
* Checks that a testable expression of a loop is necessarily conditional, reports otherwise.
|
||||
*/
|
||||
@@ -412,6 +406,11 @@ exports.default = (0, util_1.createRule)({
|
||||
// e.g. `for(;;)`
|
||||
return;
|
||||
}
|
||||
if (allowConstantLoopConditionsOption === 'only-allowed-literals' &&
|
||||
node.test.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
constantLoopConditionsAllowedLiterals.has(node.test.value)) {
|
||||
return;
|
||||
}
|
||||
if (allowConstantLoopConditionsOption === 'always' &&
|
||||
tsutils.isTrueLiteralType((0, util_1.getConstrainedTypeAtLocation)(services, node.test))) {
|
||||
return;
|
||||
@@ -427,7 +426,19 @@ exports.default = (0, util_1.createRule)({
|
||||
const typeGuardAssertedArgument = (0, assertionFunctionUtils_1.findTypeGuardAssertedArgument)(services, node);
|
||||
if (typeGuardAssertedArgument != null) {
|
||||
const typeOfArgument = (0, util_1.getConstrainedTypeAtLocation)(services, typeGuardAssertedArgument.argument);
|
||||
if (typeOfArgument === typeGuardAssertedArgument.type) {
|
||||
if (
|
||||
// Skip `any` — it is assignable to everything, producing
|
||||
// false positives for meaningful runtime type guards.
|
||||
!tsutils.isTypeFlagSet(typeOfArgument, ts.TypeFlags.Any | ts.TypeFlags.Unknown) &&
|
||||
checker.isTypeAssignableTo(typeOfArgument, typeGuardAssertedArgument.type) &&
|
||||
// Only flag if the types are mutually assignable (i.e. equivalent,
|
||||
// like Narrower ↔ Wider with optional props) or the predicate type
|
||||
// is a union that the argument is a strict subtype of. This avoids
|
||||
// false positives with structural subtypes whose extra members are
|
||||
// all optional in the *predicate* type (e.g. custom MappedType
|
||||
// interfaces extending ts.Type).
|
||||
(checker.isTypeAssignableTo(typeGuardAssertedArgument.type, typeOfArgument) ||
|
||||
typeGuardAssertedArgument.type.isUnion())) {
|
||||
context.report({
|
||||
node: typeGuardAssertedArgument.argument,
|
||||
messageId: 'typeGuardAlreadyIsType',
|
||||
@@ -663,7 +674,7 @@ exports.default = (0, util_1.createRule)({
|
||||
checkIfBoolExpressionIsNecessaryConditional(test, parent.discriminant, test, '===');
|
||||
}
|
||||
},
|
||||
WhileStatement: checkIfWhileLoopIsNecessaryConditional,
|
||||
WhileStatement: checkIfLoopIsNecessaryConditional,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Generated
Vendored
+5
@@ -106,6 +106,11 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return {
|
||||
TSTypeParameterInstantiation(node) {
|
||||
// TypeScript does not apply default type parameters in instantiation
|
||||
// expressions, so explicit type args here are always meaningful.
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.TSInstantiationExpression) {
|
||||
return;
|
||||
}
|
||||
const expression = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const typeParameters = getTypeParametersFromNode(node, expression, checker);
|
||||
if (typeParameters) {
|
||||
|
||||
Generated
Vendored
+453
-44
@@ -163,35 +163,374 @@ exports.default = (0, util_1.createRule)({
|
||||
maybeDeclarationNode.kind === 'const') ||
|
||||
(parent.type === utils_1.AST_NODE_TYPES.PropertyDefinition && parent.readonly));
|
||||
}
|
||||
function isTypeUnchanged(uncast, cast) {
|
||||
function isTypeUnchanged(node, expression, uncast, cast) {
|
||||
if (uncast === cast) {
|
||||
return true;
|
||||
}
|
||||
if (node.typeAnnotation.type === utils_1.AST_NODE_TYPES.TSIntersectionType &&
|
||||
containsTypeVariable(cast)) {
|
||||
return false;
|
||||
}
|
||||
if ((0, util_1.isTypeFlagSet)(uncast, ts.TypeFlags.Undefined) &&
|
||||
(0, util_1.isTypeFlagSet)(cast, ts.TypeFlags.Undefined) &&
|
||||
tsutils.isCompilerOptionEnabled(compilerOptions, 'exactOptionalPropertyTypes')) {
|
||||
const uncastParts = tsutils
|
||||
.unionConstituents(uncast)
|
||||
.filter(part => !(0, util_1.isTypeFlagSet)(part, ts.TypeFlags.Undefined));
|
||||
const castParts = tsutils
|
||||
.unionConstituents(cast)
|
||||
.filter(part => !(0, util_1.isTypeFlagSet)(part, ts.TypeFlags.Undefined));
|
||||
if (uncastParts.length !== castParts.length) {
|
||||
return false;
|
||||
}
|
||||
const uncastPartsSet = new Set(uncastParts);
|
||||
return castParts.every(part => uncastPartsSet.has(part));
|
||||
return areUnionPartsEquivalentIgnoringUndefined(uncast, cast);
|
||||
}
|
||||
return false;
|
||||
if (((0, util_1.isTypeFlagSet)(uncast, ts.TypeFlags.NonPrimitive) &&
|
||||
!(0, util_1.isTypeFlagSet)(cast, ts.TypeFlags.NonPrimitive)) ||
|
||||
(hasIndexSignature(uncast) && !hasIndexSignature(cast)) ||
|
||||
containsAny(uncast) ||
|
||||
containsAny(cast) ||
|
||||
(containsTypeVariable(cast) && !containsTypeVariable(uncast))) {
|
||||
return false;
|
||||
}
|
||||
if (isConceptuallyLiteral(expression) &&
|
||||
(expression.type !== utils_1.AST_NODE_TYPES.ObjectExpression ||
|
||||
expression.properties.length === 0 ||
|
||||
cast
|
||||
.getProperties()
|
||||
.some(p => isTypeLiteral(checker.getTypeOfSymbol(p))))) {
|
||||
return false;
|
||||
}
|
||||
if (cast.isIntersection() && !uncast.isIntersection()) {
|
||||
const castParts = cast.types;
|
||||
const otherPart = castParts.find(part => part !== uncast);
|
||||
if (tsutils.isTypeParameter(uncast) &&
|
||||
castParts.length === 2 &&
|
||||
castParts.some(part => part === uncast) &&
|
||||
otherPart != null &&
|
||||
isEmptyObjectType(otherPart) &&
|
||||
!containsTypeVariable(otherPart)) {
|
||||
const constraint = checker.getBaseConstraintOfType(uncast);
|
||||
if (constraint && !(0, util_1.isNullableType)(constraint)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!hasSameProperties(uncast, cast) ||
|
||||
!haveSameTypeArguments(uncast, cast)) {
|
||||
return false;
|
||||
}
|
||||
return areMutuallyAssignable(uncast, cast);
|
||||
}
|
||||
function isTypeLiteral(type) {
|
||||
return type.isLiteral() || tsutils.isBooleanLiteralType(type);
|
||||
}
|
||||
function hasIndexSignature(type) {
|
||||
return tsutils
|
||||
.unionConstituents(type)
|
||||
.some(part => checker.getIndexInfosOfType(part).length > 0);
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
return (type.aliasTypeArguments ??
|
||||
(tsutils.isTypeReference(type) ? checker.getTypeArguments(type) : []));
|
||||
}
|
||||
function typeContains(type, predicate, seen = new Set()) {
|
||||
if (seen.has(type)) {
|
||||
return false;
|
||||
}
|
||||
seen.add(type);
|
||||
if (predicate(type)) {
|
||||
return true;
|
||||
}
|
||||
if (type.isUnionOrIntersection()) {
|
||||
return type.types.some(t => typeContains(t, predicate, seen));
|
||||
}
|
||||
const nestedTypes = [
|
||||
...getTypeArguments(type),
|
||||
...type
|
||||
.getCallSignatures()
|
||||
.flatMap(sig => [
|
||||
sig.getReturnType(),
|
||||
...sig.getParameters().map(p => checker.getTypeOfSymbol(p)),
|
||||
]),
|
||||
];
|
||||
return nestedTypes.some(t => typeContains(t, predicate, seen));
|
||||
}
|
||||
function containsAny(type) {
|
||||
return typeContains(type, t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Any));
|
||||
}
|
||||
function containsTypeVariable(type) {
|
||||
return typeContains(type, t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.TypeVariable | ts.TypeFlags.Index));
|
||||
}
|
||||
function hasPhantomTypeArguments(type) {
|
||||
return isEmptyObjectType(type) && getTypeArguments(type).length > 0;
|
||||
}
|
||||
function hasTypeParams(sig) {
|
||||
return (sig.getTypeParameters()?.length ?? 0) > 0;
|
||||
}
|
||||
function genericsMismatch(uncast, contextual) {
|
||||
return contextual.getProperties().some(prop => {
|
||||
const contextualSigs = checker.getSignaturesOfType(checker.getTypeOfSymbol(prop), ts.SignatureKind.Call);
|
||||
if (!contextualSigs.some(hasTypeParams)) {
|
||||
return false;
|
||||
}
|
||||
const uncastProp = uncast.getProperty(prop.getEscapedName());
|
||||
if (!uncastProp) {
|
||||
return true;
|
||||
}
|
||||
return !checker
|
||||
.getSignaturesOfType(checker.getTypeOfSymbol(uncastProp), ts.SignatureKind.Call)
|
||||
.some(hasTypeParams);
|
||||
});
|
||||
}
|
||||
function hasSameProperties(uncast, cast) {
|
||||
const uncastProps = uncast.getProperties();
|
||||
const castProps = cast.getProperties();
|
||||
if (uncastProps.length !== castProps.length) {
|
||||
return false;
|
||||
}
|
||||
const castPropNames = new Set(castProps.map(p => p.getEscapedName()));
|
||||
return uncastProps.every(prop => {
|
||||
const name = prop.getEscapedName();
|
||||
return (castPropNames.has(name) &&
|
||||
tsutils.isPropertyReadonlyInType(uncast, name, checker) ===
|
||||
tsutils.isPropertyReadonlyInType(cast, name, checker));
|
||||
});
|
||||
}
|
||||
function haveSameTypeArguments(uncast, cast) {
|
||||
const uncastArgs = getTypeArguments(uncast);
|
||||
const castArgs = getTypeArguments(cast);
|
||||
return (uncastArgs.length === castArgs.length &&
|
||||
uncastArgs.every((arg, i) => arg === castArgs[i]));
|
||||
}
|
||||
function areMutuallyAssignable(a, b) {
|
||||
return (checker.isTypeAssignableTo(a, b) && checker.isTypeAssignableTo(b, a));
|
||||
}
|
||||
function areUnionPartsEquivalentIgnoringUndefined(uncast, cast) {
|
||||
const filterUndefined = (part) => !(0, util_1.isTypeFlagSet)(part, ts.TypeFlags.Undefined);
|
||||
const uncastParts = tsutils
|
||||
.unionConstituents(uncast)
|
||||
.filter(filterUndefined);
|
||||
const castParts = tsutils.unionConstituents(cast).filter(filterUndefined);
|
||||
if (uncastParts.length !== castParts.length) {
|
||||
return false;
|
||||
}
|
||||
const uncastPartsSet = new Set(uncastParts);
|
||||
return castParts.every(part => uncastPartsSet.has(part));
|
||||
}
|
||||
function getOriginalExpression(node) {
|
||||
let current = node.expression;
|
||||
while (current.type === utils_1.AST_NODE_TYPES.TSAsExpression ||
|
||||
current.type === utils_1.AST_NODE_TYPES.TSTypeAssertion) {
|
||||
current = current.expression;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
function isDoubleAssertionUnnecessary(node, contextualType) {
|
||||
const innerExpression = node.expression;
|
||||
if (innerExpression.type !== utils_1.AST_NODE_TYPES.TSAsExpression &&
|
||||
innerExpression.type !== utils_1.AST_NODE_TYPES.TSTypeAssertion) {
|
||||
return false;
|
||||
}
|
||||
const originalExpr = getOriginalExpression(node);
|
||||
const originalType = services.getTypeAtLocation(originalExpr);
|
||||
const castType = services.getTypeAtLocation(node);
|
||||
if (isTypeUnchanged(node, innerExpression, originalType, castType) &&
|
||||
!(0, util_1.isTypeFlagSet)(castType, ts.TypeFlags.Any)) {
|
||||
return 'unnecessaryAssertion';
|
||||
}
|
||||
if (contextualType) {
|
||||
const intermediateType = services.getTypeAtLocation(innerExpression);
|
||||
if (((0, util_1.isTypeFlagSet)(intermediateType, ts.TypeFlags.Any) ||
|
||||
(0, util_1.isTypeFlagSet)(intermediateType, ts.TypeFlags.Unknown)) &&
|
||||
checker.isTypeAssignableTo(originalType, contextualType)) {
|
||||
return 'contextuallyUnnecessary';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const CONCEPTUALLY_LITERAL_TYPES = new Set([
|
||||
utils_1.AST_NODE_TYPES.Literal,
|
||||
utils_1.AST_NODE_TYPES.ArrayExpression,
|
||||
utils_1.AST_NODE_TYPES.ObjectExpression,
|
||||
utils_1.AST_NODE_TYPES.TemplateLiteral,
|
||||
utils_1.AST_NODE_TYPES.ClassExpression,
|
||||
utils_1.AST_NODE_TYPES.FunctionExpression,
|
||||
utils_1.AST_NODE_TYPES.ArrowFunctionExpression,
|
||||
utils_1.AST_NODE_TYPES.JSXElement,
|
||||
utils_1.AST_NODE_TYPES.JSXFragment,
|
||||
]);
|
||||
function isConceptuallyLiteral(node) {
|
||||
return CONCEPTUALLY_LITERAL_TYPES.has(node.type);
|
||||
}
|
||||
function isIIFE(expression) {
|
||||
return (expression.type === utils_1.AST_NODE_TYPES.CallExpression &&
|
||||
(expression.callee.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
|
||||
expression.callee.type === utils_1.AST_NODE_TYPES.FunctionExpression));
|
||||
}
|
||||
function isEmptyObjectType(type) {
|
||||
return ((0, util_1.isTypeFlagSet)(type, ts.TypeFlags.NonPrimitive) ||
|
||||
(type.getProperties().length === 0 &&
|
||||
!type.getCallSignatures().length &&
|
||||
!type.getConstructSignatures().length &&
|
||||
!type.getStringIndexType() &&
|
||||
!type.getNumberIndexType()));
|
||||
}
|
||||
function hasGenericCallSignature(type) {
|
||||
return type.getCallSignatures().some(hasTypeParams);
|
||||
}
|
||||
function isArgumentToOverloadedFunction(node) {
|
||||
const { parent } = node;
|
||||
if ((parent.type !== utils_1.AST_NODE_TYPES.CallExpression &&
|
||||
parent.type !== utils_1.AST_NODE_TYPES.NewExpression) ||
|
||||
!parent.arguments.includes(node)) {
|
||||
return false;
|
||||
}
|
||||
const calleeType = checker.getTypeAtLocation(services.esTreeNodeToTSNodeMap.get(parent.callee));
|
||||
const signatures = calleeType.getCallSignatures();
|
||||
if (signatures.length <= 1) {
|
||||
return false;
|
||||
}
|
||||
const argIndex = parent.arguments.indexOf(node);
|
||||
const paramTypes = signatures.map(sig => {
|
||||
const params = sig.getParameters();
|
||||
if (argIndex >= params.length) {
|
||||
return undefined;
|
||||
}
|
||||
const param = params[argIndex];
|
||||
let paramType = checker.getTypeOfSymbol(param);
|
||||
if (param.valueDeclaration &&
|
||||
ts.isParameter(param.valueDeclaration) &&
|
||||
param.valueDeclaration.dotDotDotToken) {
|
||||
const typeArgs = getTypeArguments(paramType);
|
||||
if (typeArgs.length > 0) {
|
||||
paramType = typeArgs[0];
|
||||
}
|
||||
}
|
||||
return paramType;
|
||||
});
|
||||
if (paramTypes.some(type => type == null)) {
|
||||
return true;
|
||||
}
|
||||
const definedParamTypes = paramTypes;
|
||||
const firstParamType = definedParamTypes[0];
|
||||
if (definedParamTypes.every(type => type === firstParamType)) {
|
||||
return false;
|
||||
}
|
||||
const uncastType = services.getTypeAtLocation(node.expression);
|
||||
return !definedParamTypes.every(type => checker.isTypeAssignableTo(uncastType, type));
|
||||
}
|
||||
function isInDestructuringDeclaration(node) {
|
||||
const { parent } = node;
|
||||
return (parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
|
||||
parent.init === node &&
|
||||
(parent.id.type === utils_1.AST_NODE_TYPES.ObjectPattern ||
|
||||
parent.id.type === utils_1.AST_NODE_TYPES.ArrayPattern));
|
||||
}
|
||||
function isPropertyInProblematicContext(node) {
|
||||
const { parent } = node;
|
||||
if (parent.type !== utils_1.AST_NODE_TYPES.Property || parent.value !== node) {
|
||||
return false;
|
||||
}
|
||||
const objectExpr = parent.parent;
|
||||
if (objectExpr.type !== utils_1.AST_NODE_TYPES.ObjectExpression) {
|
||||
return false;
|
||||
}
|
||||
const objectTsNode = services.esTreeNodeToTSNodeMap.get(objectExpr);
|
||||
if (checker.getContextualType(objectTsNode)?.isUnion()) {
|
||||
const nodeTsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const propContextualType = checker.getContextualType(nodeTsNode);
|
||||
if (propContextualType == null) {
|
||||
return true;
|
||||
}
|
||||
const nonNullableContextualType = checker.getNonNullableType(propContextualType);
|
||||
if (nonNullableContextualType.isUnion()) {
|
||||
return true;
|
||||
}
|
||||
const uncastType = services.getTypeAtLocation(node.expression);
|
||||
return !checker.isTypeAssignableTo(uncastType, nonNullableContextualType);
|
||||
}
|
||||
const objectParent = objectExpr.parent;
|
||||
return (objectParent.type === utils_1.AST_NODE_TYPES.TSSatisfiesExpression ||
|
||||
(objectParent.type === utils_1.AST_NODE_TYPES.CallExpression &&
|
||||
objectParent.parent.type === utils_1.AST_NODE_TYPES.TSSatisfiesExpression));
|
||||
}
|
||||
function isAssignmentInNonStatementContext(node) {
|
||||
const { parent } = node;
|
||||
if (parent.type !== utils_1.AST_NODE_TYPES.AssignmentExpression ||
|
||||
parent.right !== node) {
|
||||
return false;
|
||||
}
|
||||
const assignmentParent = parent.parent;
|
||||
return assignmentParent.type !== utils_1.AST_NODE_TYPES.ExpressionStatement;
|
||||
}
|
||||
function isRightHandSideOfLogicalAssignment(node) {
|
||||
const { parent } = node;
|
||||
return (parent.type === utils_1.AST_NODE_TYPES.AssignmentExpression &&
|
||||
parent.right === node &&
|
||||
(parent.operator === '&&=' ||
|
||||
parent.operator === '||=' ||
|
||||
parent.operator === '??='));
|
||||
}
|
||||
function isInGenericContext(node) {
|
||||
let seenFunction = false;
|
||||
for (let current = node.parent; current; current = current.parent) {
|
||||
if (current.type === utils_1.AST_NODE_TYPES.FunctionDeclaration) {
|
||||
return false;
|
||||
}
|
||||
if (current.type === utils_1.AST_NODE_TYPES.FunctionExpression ||
|
||||
current.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression) {
|
||||
if (current.body.type === utils_1.AST_NODE_TYPES.BlockStatement) {
|
||||
return false;
|
||||
}
|
||||
if (seenFunction) {
|
||||
return false;
|
||||
}
|
||||
seenFunction = true;
|
||||
}
|
||||
if (current.type === utils_1.AST_NODE_TYPES.CallExpression ||
|
||||
current.type === utils_1.AST_NODE_TYPES.NewExpression) {
|
||||
if (current.typeArguments != null) {
|
||||
continue;
|
||||
}
|
||||
if (current.type === utils_1.AST_NODE_TYPES.CallExpression &&
|
||||
current.callee.type === utils_1.AST_NODE_TYPES.MemberExpression &&
|
||||
current.arguments.includes(node)) {
|
||||
continue;
|
||||
}
|
||||
const calleeType = checker.getTypeAtLocation(services.esTreeNodeToTSNodeMap.get(current.callee));
|
||||
if (hasGenericCallSignature(calleeType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function hasPhantomTypeArgumentMismatch(node, uncastType, contextualType) {
|
||||
return (isInGenericContext(node) &&
|
||||
(hasPhantomTypeArguments(uncastType) ||
|
||||
hasPhantomTypeArguments(contextualType)) &&
|
||||
!haveSameTypeArguments(uncastType, contextualType));
|
||||
}
|
||||
const SKIP_PARENT_TYPES = new Set([
|
||||
utils_1.AST_NODE_TYPES.TSAsExpression,
|
||||
utils_1.AST_NODE_TYPES.TSTypeAssertion,
|
||||
utils_1.AST_NODE_TYPES.SpreadElement,
|
||||
utils_1.AST_NODE_TYPES.TSSatisfiesExpression,
|
||||
]);
|
||||
function shouldSkipContextualTypeFallback(node, castIsAny) {
|
||||
if (castIsAny) {
|
||||
return (node.parent.type === utils_1.AST_NODE_TYPES.LogicalExpression ||
|
||||
isInGenericContext(node));
|
||||
}
|
||||
if (SKIP_PARENT_TYPES.has(node.parent.type) ||
|
||||
node.expression.type === utils_1.AST_NODE_TYPES.ArrayExpression ||
|
||||
isInDestructuringDeclaration(node) ||
|
||||
isPropertyInProblematicContext(node) ||
|
||||
isAssignmentInNonStatementContext(node) ||
|
||||
isRightHandSideOfLogicalAssignment(node) ||
|
||||
isArgumentToOverloadedFunction(node)) {
|
||||
return true;
|
||||
}
|
||||
if (isInGenericContext(node)) {
|
||||
const originalExpr = getOriginalExpression(node);
|
||||
return (!isConceptuallyLiteral(originalExpr) &&
|
||||
node.parent.type !== utils_1.AST_NODE_TYPES.Property);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getUncastType(node) {
|
||||
// Special handling for IIFE: extract the function's return type
|
||||
if (isIIFE(node.expression)) {
|
||||
@@ -211,6 +550,44 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return services.getTypeAtLocation(node.expression);
|
||||
}
|
||||
function createAssertionFixer(node) {
|
||||
return fixer => {
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TSTypeAssertion) {
|
||||
const openingAngleBracket = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
|
||||
token.value === '<'), util_1.NullThrowsReasons.MissingToken('<', 'type annotation'));
|
||||
const closingAngleBracket = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
|
||||
token.value === '>'), util_1.NullThrowsReasons.MissingToken('>', 'type annotation'));
|
||||
return fixer.removeRange([
|
||||
openingAngleBracket.range[0],
|
||||
closingAngleBracket.range[1],
|
||||
]);
|
||||
}
|
||||
const asToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.expression, token => token.type === utils_1.AST_TOKEN_TYPES.Identifier && token.value === 'as'), util_1.NullThrowsReasons.MissingToken('>', 'type annotation'));
|
||||
const tokenBeforeAs = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(asToken, {
|
||||
includeComments: true,
|
||||
}), util_1.NullThrowsReasons.MissingToken('comment', 'as'));
|
||||
return fixer.removeRange([tokenBeforeAs.range[1], node.range[1]]);
|
||||
};
|
||||
}
|
||||
function reportDoubleAssertionIfUnnecessary(node, contextualType) {
|
||||
const doubleAssertionResult = isDoubleAssertionUnnecessary(node, contextualType);
|
||||
if (doubleAssertionResult) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: doubleAssertionResult,
|
||||
fix(fixer) {
|
||||
const originalExpr = getOriginalExpression(node);
|
||||
let text = context.sourceCode.getText(originalExpr);
|
||||
if (originalExpr.type === utils_1.AST_NODE_TYPES.ObjectExpression &&
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
|
||||
node.parent.body === node) {
|
||||
text = `(${text})`;
|
||||
}
|
||||
return fixer.replaceText(node, text);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
'TSAsExpression, TSTypeAssertion'(node) {
|
||||
if (options.typesToIgnore?.includes(context.sourceCode.getText(node.typeAnnotation))) {
|
||||
@@ -225,7 +602,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return;
|
||||
}
|
||||
const uncastType = getUncastType(node);
|
||||
const typeIsUnchanged = isTypeUnchanged(uncastType, castType);
|
||||
const typeIsUnchanged = isTypeUnchanged(node, node.expression, uncastType, castType);
|
||||
const wouldSameTypeBeInferred = castTypeIsLiteral
|
||||
? isImplicitlyNarrowedLiteralDeclaration(node)
|
||||
: !typeAnnotationIsConstAssertion;
|
||||
@@ -233,32 +610,47 @@ exports.default = (0, util_1.createRule)({
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unnecessaryAssertion',
|
||||
fix(fixer) {
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TSTypeAssertion) {
|
||||
const openingAngleBracket = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
|
||||
token.value === '<'), util_1.NullThrowsReasons.MissingToken('<', 'type annotation'));
|
||||
const closingAngleBracket = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
|
||||
token.value === '>'), util_1.NullThrowsReasons.MissingToken('>', 'type annotation'));
|
||||
// < ( number ) > ( 3 + 5 )
|
||||
// ^---remove---^
|
||||
return fixer.removeRange([
|
||||
openingAngleBracket.range[0],
|
||||
closingAngleBracket.range[1],
|
||||
]);
|
||||
}
|
||||
// `as` is always present in TSAsExpression
|
||||
const asToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.expression, token => token.type === utils_1.AST_TOKEN_TYPES.Identifier &&
|
||||
token.value === 'as'), util_1.NullThrowsReasons.MissingToken('>', 'type annotation'));
|
||||
const tokenBeforeAs = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(asToken, {
|
||||
includeComments: true,
|
||||
}), util_1.NullThrowsReasons.MissingToken('comment', 'as'));
|
||||
// ( 3 + 5 ) as number
|
||||
// ^--remove--^
|
||||
return fixer.removeRange([tokenBeforeAs.range[1], node.range[1]]);
|
||||
},
|
||||
fix: createAssertionFixer(node),
|
||||
});
|
||||
return;
|
||||
}
|
||||
// TODO - add contextually unnecessary check for this
|
||||
const originalNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const castIsAny = (0, util_1.isTypeFlagSet)(castType, ts.TypeFlags.Any) &&
|
||||
!SKIP_PARENT_TYPES.has(node.parent.type);
|
||||
const contextualType = shouldSkipContextualTypeFallback(node, castIsAny)
|
||||
? undefined
|
||||
: checker.getContextualType(originalNode);
|
||||
if (contextualType) {
|
||||
const contextualTypeIsAny = (0, util_1.isTypeFlagSet)(contextualType, ts.TypeFlags.Any);
|
||||
const isCallArgument = (node.parent.type === utils_1.AST_NODE_TYPES.CallExpression ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.NewExpression) &&
|
||||
node.parent.arguments.includes(node);
|
||||
const anyInvolvedInContextualCheck = contextualTypeIsAny
|
||||
? isCallArgument && !containsAny(castType)
|
||||
: !containsAny(contextualType);
|
||||
const isNullishLiteralToUnion = castType.isUnion() &&
|
||||
((node.expression.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
node.expression.value == null) ||
|
||||
(node.expression.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.expression.name === 'undefined'));
|
||||
const isContextuallyUnnecessary = !typeAnnotationIsConstAssertion &&
|
||||
!containsAny(uncastType) &&
|
||||
anyInvolvedInContextualCheck &&
|
||||
!hasPhantomTypeArgumentMismatch(node, uncastType, contextualType) &&
|
||||
(castIsAny || !genericsMismatch(uncastType, contextualType)) &&
|
||||
(contextualTypeIsAny ||
|
||||
checker.isTypeAssignableTo(uncastType, contextualType)) &&
|
||||
!isNullishLiteralToUnion;
|
||||
if (isContextuallyUnnecessary) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'contextuallyUnnecessary',
|
||||
fix: createAssertionFixer(node),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
reportDoubleAssertionIfUnnecessary(node, contextualType);
|
||||
},
|
||||
TSNonNullExpression(node) {
|
||||
const removeExclamationFix = fixer => {
|
||||
@@ -281,8 +673,17 @@ exports.default = (0, util_1.createRule)({
|
||||
return;
|
||||
}
|
||||
const originalNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node.expression);
|
||||
if (!(0, util_1.isNullableType)(type)) {
|
||||
const constrainedType = (0, util_1.getConstrainedTypeAtLocation)(services, node.expression);
|
||||
const actualType = services.getTypeAtLocation(node.expression);
|
||||
// Check both the constrained type and the actual type.
|
||||
// If either is nullable, we should not report the assertion as unnecessary.
|
||||
// This handles cases like generic constraints with `any` where the
|
||||
// constrained type is `any` (nullable) but the actual type might be
|
||||
// a type parameter that TypeScript treats nominally.
|
||||
// See: https://github.com/typescript-eslint/typescript-eslint/issues/11559
|
||||
const constrainedTypeIsNullable = (0, util_1.isNullableType)(constrainedType);
|
||||
const actualTypeIsNullable = (0, util_1.isNullableType)(actualType);
|
||||
if (!constrainedTypeIsNullable && !actualTypeIsNullable) {
|
||||
if (node.expression.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
isPossiblyUsedBeforeAssigned(node.expression)) {
|
||||
return;
|
||||
@@ -296,17 +697,25 @@ exports.default = (0, util_1.createRule)({
|
||||
else {
|
||||
// we know it's a nullable type
|
||||
// so figure out if the variable is used in a place that accepts nullable types
|
||||
// If the constrained type differs from the actual type (e.g., when dealing
|
||||
// with unresolved generic type parameters), we should not report the assertion
|
||||
// as contextually unnecessary. TypeScript may still require the assertion
|
||||
// even if the constraint is nullable (like `any`).
|
||||
// See: https://github.com/typescript-eslint/typescript-eslint/issues/11559
|
||||
if (constrainedType !== actualType) {
|
||||
return;
|
||||
}
|
||||
const contextualType = (0, util_1.getContextualType)(checker, originalNode);
|
||||
if (contextualType) {
|
||||
if ((0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Unknown) &&
|
||||
if ((0, util_1.isTypeFlagSet)(constrainedType, ts.TypeFlags.Unknown) &&
|
||||
!(0, util_1.isTypeFlagSet)(contextualType, ts.TypeFlags.Unknown)) {
|
||||
return;
|
||||
}
|
||||
// in strict mode you can't assign null to undefined, so we have to make sure that
|
||||
// the two types share a nullable type
|
||||
const typeIncludesUndefined = (0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Undefined);
|
||||
const typeIncludesNull = (0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Null);
|
||||
const typeIncludesVoid = (0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Void);
|
||||
const typeIncludesUndefined = (0, util_1.isTypeFlagSet)(constrainedType, ts.TypeFlags.Undefined);
|
||||
const typeIncludesNull = (0, util_1.isTypeFlagSet)(constrainedType, ts.TypeFlags.Null);
|
||||
const typeIncludesVoid = (0, util_1.isTypeFlagSet)(constrainedType, ts.TypeFlags.Void);
|
||||
const contextualTypeIncludesUndefined = (0, util_1.isTypeFlagSet)(contextualType, ts.TypeFlags.Undefined);
|
||||
const contextualTypeIncludesNull = (0, util_1.isTypeFlagSet)(contextualType, ts.TypeFlags.Null);
|
||||
const contextualTypeIncludesVoid = (0, util_1.isTypeFlagSet)(contextualType, ts.TypeFlags.Void);
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -45,7 +45,7 @@ function isEnumMemberType(type) {
|
||||
if (!symbol) {
|
||||
return false;
|
||||
}
|
||||
return (symbol.flags & ts.SymbolFlags.EnumMember) !== 0;
|
||||
return tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.EnumMember);
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-unnecessary-type-conversion',
|
||||
|
||||
+2
-1
@@ -169,7 +169,8 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
else if (receiverProperty.key.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
|
||||
receiverProperty.key.quasis.length === 1) {
|
||||
key = receiverProperty.key.quasis[0].value.cooked;
|
||||
const cooked = (0, util_1.nullThrows)(receiverProperty.key.quasis[0].value.cooked, 'cooked can only be null inside a TaggedTemplateExpression, which is not possible here');
|
||||
key = cooked;
|
||||
}
|
||||
else {
|
||||
// can't figure out the name, so skip it
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export type MessageIds = 'unsafeCall' | 'unsafeCallThis' | 'unsafeNew' | 'unsafeTemplateTag';
|
||||
export type MessageIds = 'errorCall' | 'errorCallThis' | 'errorNew' | 'errorTemplateTag' | 'unsafeCall' | 'unsafeCallThis' | 'unsafeNew' | 'unsafeTemplateTag';
|
||||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
|
||||
+19
-14
@@ -45,13 +45,17 @@ exports.default = (0, util_1.createRule)({
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
messages: {
|
||||
unsafeCall: 'Unsafe call of a(n) {{type}} typed value.',
|
||||
errorCall: 'Unsafe call of a type that could not be resolved.',
|
||||
errorCallThis: 'Unsafe call of a `this` type that could not be resolved.',
|
||||
errorNew: 'Unsafe construction of a type that could not be resolved.',
|
||||
errorTemplateTag: 'Unsafe use of a template tag whose type could not be resolved.',
|
||||
unsafeCall: 'Unsafe call of {{type}} typed value.',
|
||||
unsafeCallThis: [
|
||||
'Unsafe call of a(n) {{type}} typed value. `this` is typed as {{type}}.',
|
||||
'Unsafe call of {{type}} typed value. `this` is typed as {{type}}.',
|
||||
'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.',
|
||||
].join('\n'),
|
||||
unsafeNew: 'Unsafe construction of a(n) {{type}} typed value.',
|
||||
unsafeTemplateTag: 'Unsafe use of a(n) {{type}} typed template tag.',
|
||||
unsafeNew: 'Unsafe construction of {{type}} typed value.',
|
||||
unsafeTemplateTag: 'Unsafe use of {{type}} typed template tag.',
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
@@ -60,7 +64,7 @@ exports.default = (0, util_1.createRule)({
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const compilerOptions = services.program.getCompilerOptions();
|
||||
const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'noImplicitThis');
|
||||
function checkCall(node, reportingNode, messageId) {
|
||||
function checkCall(node, reportingNode, unsafeMessageId, errorMessageId) {
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
|
||||
if ((0, util_1.isTypeAnyType)(type)) {
|
||||
if (!isNoImplicitThis) {
|
||||
@@ -68,15 +72,16 @@ exports.default = (0, util_1.createRule)({
|
||||
const thisExpression = (0, util_1.getThisExpression)(node);
|
||||
if (thisExpression &&
|
||||
(0, util_1.isTypeAnyType)((0, util_1.getConstrainedTypeAtLocation)(services, thisExpression))) {
|
||||
messageId = 'unsafeCallThis';
|
||||
unsafeMessageId = 'unsafeCallThis';
|
||||
errorMessageId = 'errorCallThis';
|
||||
}
|
||||
}
|
||||
const isErrorType = tsutils.isIntrinsicErrorType(type);
|
||||
context.report({
|
||||
node: reportingNode,
|
||||
messageId,
|
||||
messageId: isErrorType ? errorMessageId : unsafeMessageId,
|
||||
data: {
|
||||
type: isErrorType ? '`error` type' : '`any`',
|
||||
type: 'an `any`',
|
||||
},
|
||||
});
|
||||
return;
|
||||
@@ -98,7 +103,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return;
|
||||
}
|
||||
const callSignatures = type.getCallSignatures();
|
||||
if (messageId === 'unsafeNew') {
|
||||
if (unsafeMessageId === 'unsafeNew') {
|
||||
if (callSignatures.some(signature => !tsutils.isIntrinsicVoidType(signature.getReturnType()))) {
|
||||
return;
|
||||
}
|
||||
@@ -108,9 +113,9 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
context.report({
|
||||
node: reportingNode,
|
||||
messageId,
|
||||
messageId: unsafeMessageId,
|
||||
data: {
|
||||
type: '`Function`',
|
||||
type: 'a `Function`',
|
||||
},
|
||||
});
|
||||
return;
|
||||
@@ -118,13 +123,13 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return {
|
||||
'CallExpression > *.callee'(node) {
|
||||
checkCall(node, node, 'unsafeCall');
|
||||
checkCall(node, node, 'unsafeCall', 'errorCall');
|
||||
},
|
||||
NewExpression(node) {
|
||||
checkCall(node.callee, node, 'unsafeNew');
|
||||
checkCall(node.callee, node, 'unsafeNew', 'errorNew');
|
||||
},
|
||||
'TaggedTemplateExpression > *.tag'(node) {
|
||||
checkCall(node, node, 'unsafeTemplateTag');
|
||||
checkCall(node, node, 'unsafeTemplateTag', 'errorTemplateTag');
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -3,7 +3,7 @@ export type Options = [
|
||||
allowOptionalChaining?: boolean;
|
||||
}
|
||||
];
|
||||
export type MessageIds = 'unsafeComputedMemberAccess' | 'unsafeMemberExpression' | 'unsafeThisMemberExpression';
|
||||
export type MessageIds = 'errorComputedMemberAccess' | 'errorMemberExpression' | 'errorThisMemberExpression' | 'unsafeComputedMemberAccess' | 'unsafeMemberExpression' | 'unsafeThisMemberExpression';
|
||||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
|
||||
Generated
Vendored
+24
-13
@@ -42,10 +42,6 @@ var State;
|
||||
State[State["Safe"] = 2] = "Safe";
|
||||
State[State["Chained"] = 3] = "Chained";
|
||||
})(State || (State = {}));
|
||||
function createDataType(type) {
|
||||
const isErrorType = tsutils.isIntrinsicErrorType(type);
|
||||
return isErrorType ? '`error` typed' : '`any`';
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-unsafe-member-access',
|
||||
meta: {
|
||||
@@ -56,8 +52,14 @@ exports.default = (0, util_1.createRule)({
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
messages: {
|
||||
unsafeComputedMemberAccess: 'Computed name {{property}} resolves to an {{type}} value.',
|
||||
unsafeMemberExpression: 'Unsafe member access {{property}} on an {{type}} value.',
|
||||
errorComputedMemberAccess: 'The type of computed name {{property}} cannot be resolved.',
|
||||
errorMemberExpression: 'Unsafe member access {{property}} on a type that cannot be resolved.',
|
||||
errorThisMemberExpression: [
|
||||
'Unsafe member access {{property}}. The type of `this` cannot be resolved.',
|
||||
'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.',
|
||||
].join('\n'),
|
||||
unsafeComputedMemberAccess: 'Computed name {{property}} resolves to an `any` value.',
|
||||
unsafeMemberExpression: 'Unsafe member access {{property}} on an `any` value.',
|
||||
unsafeThisMemberExpression: [
|
||||
'Unsafe member access {{property}} on an `any` value. `this` is typed as `any`.',
|
||||
'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.',
|
||||
@@ -116,20 +118,28 @@ exports.default = (0, util_1.createRule)({
|
||||
stateCache.set(node, state);
|
||||
if (state === State.Unsafe) {
|
||||
const propertyName = context.sourceCode.getText(node.property);
|
||||
let messageId = 'unsafeMemberExpression';
|
||||
let messageId;
|
||||
if (!isNoImplicitThis) {
|
||||
// `this.foo` or `this.foo[bar]`
|
||||
const thisExpression = (0, util_1.getThisExpression)(node);
|
||||
if (thisExpression &&
|
||||
(0, util_1.isTypeAnyType)((0, util_1.getConstrainedTypeAtLocation)(services, thisExpression))) {
|
||||
messageId = 'unsafeThisMemberExpression';
|
||||
if (thisExpression) {
|
||||
const thisType = (0, util_1.getConstrainedTypeAtLocation)(services, thisExpression);
|
||||
if ((0, util_1.isTypeAnyType)(thisType)) {
|
||||
messageId = tsutils.isIntrinsicErrorType(thisType)
|
||||
? 'errorThisMemberExpression'
|
||||
: 'unsafeThisMemberExpression';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!messageId) {
|
||||
messageId = tsutils.isIntrinsicErrorType(type)
|
||||
? 'errorMemberExpression'
|
||||
: 'unsafeMemberExpression';
|
||||
}
|
||||
context.report({
|
||||
node: node.property,
|
||||
messageId,
|
||||
data: {
|
||||
type: createDataType(type),
|
||||
property: node.computed ? `[${propertyName}]` : `.${propertyName}`,
|
||||
},
|
||||
});
|
||||
@@ -159,9 +169,10 @@ exports.default = (0, util_1.createRule)({
|
||||
const propertyName = context.sourceCode.getText(node);
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unsafeComputedMemberAccess',
|
||||
messageId: tsutils.isIntrinsicErrorType(type)
|
||||
? 'errorComputedMemberAccess'
|
||||
: 'unsafeComputedMemberAccess',
|
||||
data: {
|
||||
type: createDataType(type),
|
||||
property: `[${propertyName}]`,
|
||||
},
|
||||
});
|
||||
|
||||
+6
-5
@@ -63,15 +63,16 @@ exports.default = (0, util_1.createRule)({
|
||||
const compilerOptions = services.program.getCompilerOptions();
|
||||
const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'noImplicitThis');
|
||||
function checkReturn(returnNode, reportingNode = returnNode) {
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(returnNode);
|
||||
const type = checker.getTypeAtLocation(tsNode);
|
||||
const anyType = (0, util_1.discriminateAnyType)(type, checker, services.program, tsNode);
|
||||
const functionNode = (0, getParentFunctionNode_1.getParentFunctionNode)(returnNode);
|
||||
/* istanbul ignore if */ if (!functionNode) {
|
||||
return;
|
||||
}
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(returnNode);
|
||||
const type = checker.getTypeAtLocation(tsNode);
|
||||
const anyType = (0, util_1.discriminateAnyType)(type, checker, services.program, tsNode);
|
||||
// function has an explicit return type, so ensure it's a safe return
|
||||
const returnNodeType = (0, util_1.getConstrainedTypeAtLocation)(services, returnNode);
|
||||
const returnNodeType = services.getTypeAtLocation(returnNode);
|
||||
const constrainedReturnNodeType = (0, util_1.getConstrainedTypeAtLocation)(services, returnNode);
|
||||
const functionTSNode = services.esTreeNodeToTSNodeMap.get(functionNode);
|
||||
// function expressions will not have their return type modified based on receiver typing
|
||||
// so we have to use the contextual typing in these cases, i.e.
|
||||
@@ -127,7 +128,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return;
|
||||
}
|
||||
let messageId = 'unsafeReturn';
|
||||
const isErrorType = tsutils.isIntrinsicErrorType(returnNodeType);
|
||||
const isErrorType = tsutils.isIntrinsicErrorType(constrainedReturnNodeType);
|
||||
if (!isNoImplicitThis) {
|
||||
// `return this`
|
||||
const thisExpression = (0, util_1.getThisExpression)(returnNode);
|
||||
|
||||
Generated
Vendored
+8
-1
@@ -108,7 +108,14 @@ exports.default = (0, util_1.createRule)({
|
||||
const expressionWidenedType = isObjectLiteralType(expressionType)
|
||||
? checker.getWidenedType(expressionType)
|
||||
: expressionType;
|
||||
const isAssertionSafe = checker.isTypeAssignableTo(expressionWidenedType, assertedType);
|
||||
let isAssertionSafe;
|
||||
try {
|
||||
isAssertionSafe = checker.isTypeAssignableTo(expressionWidenedType, assertedType);
|
||||
}
|
||||
catch {
|
||||
// workaround for https://github.com/microsoft/TypeScript/issues/62933
|
||||
return;
|
||||
}
|
||||
if (isAssertionSafe) {
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
import { TSESLint } from '@typescript-eslint/utils';
|
||||
export type MessageIds = 'unusedVar' | 'usedIgnoredVar' | 'usedOnlyAsType';
|
||||
export type MessageIds = 'removeUnusedImportDeclaration' | 'removeUnusedVar' | 'unusedVar' | 'usedIgnoredVar' | 'usedOnlyAsType';
|
||||
export type Options = [
|
||||
'all' | 'local' | {
|
||||
args?: 'after-used' | 'all' | 'none';
|
||||
@@ -7,6 +7,9 @@ export type Options = [
|
||||
caughtErrors?: 'all' | 'none';
|
||||
caughtErrorsIgnorePattern?: string;
|
||||
destructuredArrayIgnorePattern?: string;
|
||||
enableAutofixRemoval?: {
|
||||
imports?: boolean;
|
||||
};
|
||||
ignoreClassWithStaticInitBlock?: boolean;
|
||||
ignoreRestSiblings?: boolean;
|
||||
ignoreUsingDeclarations?: boolean;
|
||||
|
||||
+396
-43
@@ -3,7 +3,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const scope_manager_1 = require("@typescript-eslint/scope-manager");
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const referenceContainsTypePredicate_1 = require("../util/referenceContainsTypePredicate");
|
||||
const referenceContainsTypeQuery_1 = require("../util/referenceContainsTypeQuery");
|
||||
// this is a superset of DefinitionType which defines sub-types for better granularity
|
||||
var VariableType;
|
||||
(function (VariableType) {
|
||||
// New sub-types
|
||||
VariableType[VariableType["ArrayDestructure"] = 0] = "ArrayDestructure";
|
||||
// DefinitionType
|
||||
VariableType[VariableType["CatchClause"] = 1] = "CatchClause";
|
||||
VariableType[VariableType["ClassName"] = 2] = "ClassName";
|
||||
VariableType[VariableType["FunctionName"] = 3] = "FunctionName";
|
||||
VariableType[VariableType["ImportBinding"] = 4] = "ImportBinding";
|
||||
VariableType[VariableType["ImplicitGlobalVariable"] = 5] = "ImplicitGlobalVariable";
|
||||
VariableType[VariableType["Parameter"] = 6] = "Parameter";
|
||||
VariableType[VariableType["TSEnumMember"] = 7] = "TSEnumMember";
|
||||
VariableType[VariableType["TSEnumName"] = 8] = "TSEnumName";
|
||||
VariableType[VariableType["TSModuleName"] = 9] = "TSModuleName";
|
||||
VariableType[VariableType["Type"] = 10] = "Type";
|
||||
VariableType[VariableType["Variable"] = 11] = "Variable";
|
||||
})(VariableType || (VariableType = {}));
|
||||
const isCommaToken = {
|
||||
predicate: (token) => token.type === utils_1.AST_TOKEN_TYPES.Punctuator && token.value === ',',
|
||||
tokenChar: ',',
|
||||
};
|
||||
const isLeftCurlyToken = {
|
||||
predicate: (token) => token.type === utils_1.AST_TOKEN_TYPES.Punctuator && token.value === '{',
|
||||
tokenChar: '{',
|
||||
};
|
||||
const isRightCurlyToken = {
|
||||
predicate: (token) => token.type === utils_1.AST_TOKEN_TYPES.Punctuator && token.value === '}',
|
||||
tokenChar: '}',
|
||||
};
|
||||
function assertToken({ predicate, tokenChar }, token) {
|
||||
if (token == null) {
|
||||
throw new Error(`Expected a valid "${tokenChar}" token, but found no token`);
|
||||
}
|
||||
if (!predicate(token)) {
|
||||
throw new Error(`Expected a valid "${tokenChar}" token, but got "${token.value}" instead`);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-unused-vars',
|
||||
meta: {
|
||||
@@ -13,7 +53,11 @@ exports.default = (0, util_1.createRule)({
|
||||
extendsBaseRule: true,
|
||||
recommended: 'recommended',
|
||||
},
|
||||
fixable: 'code',
|
||||
hasSuggestions: true,
|
||||
messages: {
|
||||
removeUnusedImportDeclaration: 'Remove unused import declaration.',
|
||||
removeUnusedVar: 'Remove unused variable "{{varName}}".',
|
||||
unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}.",
|
||||
usedIgnoredVar: "'{{varName}}' is marked as ignored but is used{{additional}}.",
|
||||
usedOnlyAsType: "'{{varName}}' is {{action}} but only used as a type{{additional}}.",
|
||||
@@ -52,6 +96,17 @@ exports.default = (0, util_1.createRule)({
|
||||
type: 'string',
|
||||
description: 'Regular expressions of destructured array variable names to not check for usage.',
|
||||
},
|
||||
enableAutofixRemoval: {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
description: 'Configurable automatic fixes for different types of unused variables.',
|
||||
properties: {
|
||||
imports: {
|
||||
type: 'boolean',
|
||||
description: 'Whether to enable automatic removal of unused imports.',
|
||||
},
|
||||
},
|
||||
},
|
||||
ignoreClassWithStaticInitBlock: {
|
||||
type: 'boolean',
|
||||
description: 'Whether to ignore classes with at least one static initialization block.',
|
||||
@@ -86,10 +141,130 @@ exports.default = (0, util_1.createRule)({
|
||||
defaultOptions: [{}],
|
||||
create(context, [firstOption]) {
|
||||
const MODULE_DECL_CACHE = new Map();
|
||||
const reportedUnusedVariables = new Set();
|
||||
function areAllSpecifiersUnused(decl) {
|
||||
return context.sourceCode.getDeclaredVariables(decl).every(variable => {
|
||||
return reportedUnusedVariables.has(variable);
|
||||
});
|
||||
}
|
||||
const report = (unusedVar, opts) => {
|
||||
reportedUnusedVariables.add(unusedVar);
|
||||
const writeReferences = unusedVar.references.filter(ref => ref.isWrite() &&
|
||||
ref.from.variableScope === unusedVar.scope.variableScope);
|
||||
const id = writeReferences.length
|
||||
? writeReferences[writeReferences.length - 1].identifier
|
||||
: unusedVar.identifiers[0];
|
||||
const { start } = id.loc;
|
||||
const idLength = id.name.length;
|
||||
const loc = {
|
||||
start,
|
||||
end: {
|
||||
column: start.column + idLength,
|
||||
line: start.line,
|
||||
},
|
||||
};
|
||||
const fixer = (() => {
|
||||
const { messageId, fix, useAutofix } = (() => {
|
||||
if (unusedVar.defs.length !== 1) {
|
||||
// If there's multiple definitions then we'd have to clean them all
|
||||
// up! That's complicated and messy so for now let's just ignore it.
|
||||
return {};
|
||||
}
|
||||
const { type, def } = defToVariableType(unusedVar.defs[0]);
|
||||
switch (type) {
|
||||
case VariableType.ArrayDestructure:
|
||||
// TODO(bradzacher) -- this would be really easy to implement and
|
||||
// is side-effect free!
|
||||
return {};
|
||||
case VariableType.CatchClause:
|
||||
// TODO(bradzacher) -- this would be really easy to implement and
|
||||
// is side-effect free!
|
||||
return {};
|
||||
case VariableType.ClassName:
|
||||
// This would be easy to implement -- but classes can have
|
||||
// side-effects in static initializers / static blocks. So it's
|
||||
// dangerous to ever auto-fix remove them.
|
||||
//
|
||||
// Perhaps as an always-suggestion fixer...?
|
||||
return {};
|
||||
case VariableType.FunctionName:
|
||||
// TODO(bradzacher) -- this would be really easy to implement and
|
||||
// is side-effect free!
|
||||
return {};
|
||||
case VariableType.ImportBinding:
|
||||
return {
|
||||
...getImportFixer(def),
|
||||
useAutofix: options.enableAutofixRemoval.imports,
|
||||
};
|
||||
case VariableType.ImplicitGlobalVariable:
|
||||
// We don't report these via this code path, so no fixer is possible
|
||||
return {};
|
||||
case VariableType.Parameter:
|
||||
// This is easy to implement -- but we cannot implement it cos it
|
||||
// changes the signature of the function which in turn might
|
||||
// introduce type errors in consumers.
|
||||
//
|
||||
// Also parameters can have default values which might have
|
||||
// side-effects.
|
||||
//
|
||||
// Perhaps as an always-suggestion fixer...?
|
||||
return {};
|
||||
case VariableType.TSEnumMember:
|
||||
// We don't report unused enum members so no fixer is ever possible
|
||||
return {};
|
||||
case VariableType.TSEnumName:
|
||||
// TODO(bradzacher) -- this would be really easy to implement and
|
||||
// is side-effect free!
|
||||
return {};
|
||||
case VariableType.TSModuleName:
|
||||
// This is easy to implement -- but TS namespaces are eagerly
|
||||
// initialized -- meaning that they might have side-effects in
|
||||
// the body. So it's dangerous to ever auto-fix remove them.
|
||||
//
|
||||
// Perhaps as an always-suggestion fixer...?
|
||||
return {};
|
||||
case VariableType.Type:
|
||||
// TODO(bradzacher) -- this would be really easy to implement and
|
||||
// is side-effect free!
|
||||
return {};
|
||||
case VariableType.Variable:
|
||||
// TODO(bradzacher) -- this would be really easy to implement
|
||||
return {};
|
||||
}
|
||||
})();
|
||||
if (!fix) {
|
||||
return {};
|
||||
}
|
||||
if (useAutofix) {
|
||||
return { fix };
|
||||
}
|
||||
const data = {
|
||||
varName: unusedVar.name,
|
||||
};
|
||||
return {
|
||||
suggest: [
|
||||
{
|
||||
messageId: messageId ?? 'removeUnusedVar',
|
||||
data,
|
||||
fix,
|
||||
},
|
||||
],
|
||||
};
|
||||
})();
|
||||
context.report({
|
||||
...opts,
|
||||
...fixer,
|
||||
loc,
|
||||
node: id,
|
||||
});
|
||||
};
|
||||
const options = (() => {
|
||||
const options = {
|
||||
args: 'after-used',
|
||||
caughtErrors: 'all',
|
||||
enableAutofixRemoval: {
|
||||
imports: false,
|
||||
},
|
||||
ignoreClassWithStaticInitBlock: false,
|
||||
ignoreRestSiblings: false,
|
||||
ignoreUsingDeclarations: false,
|
||||
@@ -126,9 +301,190 @@ exports.default = (0, util_1.createRule)({
|
||||
if (firstOption.destructuredArrayIgnorePattern) {
|
||||
options.destructuredArrayIgnorePattern = new RegExp(firstOption.destructuredArrayIgnorePattern, 'u');
|
||||
}
|
||||
if (firstOption.enableAutofixRemoval) {
|
||||
// eslint-disable-next-line unicorn/no-lonely-if -- will add more cases later
|
||||
if (firstOption.enableAutofixRemoval.imports != null) {
|
||||
options.enableAutofixRemoval.imports =
|
||||
firstOption.enableAutofixRemoval.imports;
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
})();
|
||||
function removeNodeWithTrailingNewline(fixer, node) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const { line: startLine } = node.loc.start;
|
||||
const { line: endLine } = node.loc.end;
|
||||
// Expand range: start of first line to start of next line (or EOF)
|
||||
const lineRangeStart = sourceCode.getIndexFromLoc({
|
||||
column: 0,
|
||||
line: startLine,
|
||||
});
|
||||
const lineRangeEnd = endLine < sourceCode.lines.length
|
||||
? sourceCode.getIndexFromLoc({ column: 0, line: endLine + 1 })
|
||||
: sourceCode.text.length;
|
||||
// If node is the only non-whitespace on its line(s), remove full line(s)
|
||||
if (sourceCode.getText(node) ===
|
||||
sourceCode.text.slice(lineRangeStart, lineRangeEnd).trim()) {
|
||||
return fixer.removeRange([lineRangeStart, lineRangeEnd]);
|
||||
}
|
||||
return fixer.remove(node);
|
||||
}
|
||||
function getImportFixer(def) {
|
||||
switch (def.node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration:
|
||||
// import equals declarations can only have one binding -- so we can
|
||||
// just remove entire import declaration
|
||||
return {
|
||||
messageId: 'removeUnusedImportDeclaration',
|
||||
fix: fixer => removeNodeWithTrailingNewline(fixer, def.node),
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.ImportDefaultSpecifier: {
|
||||
const importDecl = def.node.parent;
|
||||
if (importDecl.specifiers.length === 1 ||
|
||||
areAllSpecifiersUnused(importDecl)) {
|
||||
// all specifiers are unused -- so we can just remove entire import
|
||||
// declaration
|
||||
return {
|
||||
messageId: 'removeUnusedImportDeclaration',
|
||||
fix: fixer => removeNodeWithTrailingNewline(fixer, importDecl),
|
||||
};
|
||||
}
|
||||
// in this branch we know the following things:
|
||||
// 1) there is at least one specifier that is used
|
||||
// 2) the default specifier is unused
|
||||
//
|
||||
// by process of elimination we can deduce that there is at least one
|
||||
// named specifier that is used
|
||||
//
|
||||
// i.e. the code must be import Unused, { Used, ... } from 'module';
|
||||
//
|
||||
// there's one or more unused named specifiers, so we must remove the
|
||||
// default specifier in isolation including the trailing comma.
|
||||
//
|
||||
// import Unused, { Used, ... } from 'module';
|
||||
// ^^^^^^^ remove this
|
||||
//
|
||||
// NOTE: we could also remove the spaces between the comma and the
|
||||
// opening curly brace -- but this does risk removing comments. To be
|
||||
// safe we'll be conservative for now
|
||||
//
|
||||
// TODO(bradzacher) -- consider removing the extra space whilst also
|
||||
// preserving comments.
|
||||
return {
|
||||
messageId: 'removeUnusedVar',
|
||||
fix: fixer => {
|
||||
const comma = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(def.node), util_1.NullThrowsReasons.MissingToken(',', 'import specifier'));
|
||||
assertToken(isCommaToken, comma);
|
||||
return fixer.removeRange([
|
||||
Math.min(def.node.range[0], comma.range[0]),
|
||||
Math.max(def.node.range[1], comma.range[1]),
|
||||
]);
|
||||
},
|
||||
};
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.ImportSpecifier: {
|
||||
// guaranteed to NOT be in an export statement as we're inspecting an
|
||||
// import
|
||||
const importDecl = def.node.parent;
|
||||
if (importDecl.specifiers.length === 1 ||
|
||||
areAllSpecifiersUnused(importDecl)) {
|
||||
// all specifiers are unused -- so we can just remove entire import
|
||||
// declaration
|
||||
return {
|
||||
messageId: 'removeUnusedImportDeclaration',
|
||||
fix: fixer => removeNodeWithTrailingNewline(fixer, importDecl),
|
||||
};
|
||||
}
|
||||
return {
|
||||
messageId: 'removeUnusedVar',
|
||||
fix: fixer => {
|
||||
const usedNamedSpecifiers = context.sourceCode
|
||||
.getDeclaredVariables(importDecl)
|
||||
.map(variable => {
|
||||
if (reportedUnusedVariables.has(variable)) {
|
||||
return null;
|
||||
}
|
||||
const specifier = variable.defs[0].node;
|
||||
if (specifier.type !== utils_1.AST_NODE_TYPES.ImportSpecifier) {
|
||||
return null;
|
||||
}
|
||||
return specifier;
|
||||
})
|
||||
.filter(v => v != null);
|
||||
if (usedNamedSpecifiers.length === 0) {
|
||||
// in this branch we know the following things:
|
||||
// 1) there is at least one specifier that is used
|
||||
// 2) all named specifiers are unused
|
||||
//
|
||||
// by process of elimination we can deduce that there is a
|
||||
// default specifier and it is the only used specifier
|
||||
//
|
||||
// i.e. the code must be import Used, { Unused, ... } from
|
||||
// 'module';
|
||||
//
|
||||
// So we can just remove the entire curly content and the comma
|
||||
// before, eg import Used, { Unused, ... } from 'module';
|
||||
// ^^^^^^^^^^^^^^^^^ remove this
|
||||
const leftCurly = assertToken(isLeftCurlyToken, context.sourceCode.getFirstToken(importDecl, isLeftCurlyToken.predicate));
|
||||
const leftToken = assertToken(isCommaToken, context.sourceCode.getTokenBefore(leftCurly));
|
||||
const rightToken = assertToken(isRightCurlyToken, context.sourceCode.getFirstToken(importDecl, isRightCurlyToken.predicate));
|
||||
return fixer.removeRange([
|
||||
leftToken.range[0],
|
||||
rightToken.range[1],
|
||||
]);
|
||||
}
|
||||
// in this branch we know there is at least one used named
|
||||
// specifier which means we have to remove each unused specifier
|
||||
// in isolation.
|
||||
//
|
||||
// there's 3 possible cases to care about: import { Unused,
|
||||
// Used... } from 'module'; import { ...Used, Unused } from
|
||||
// 'module'; import { ...Used, Unused, } from 'module';
|
||||
//
|
||||
// Note that because of the above usedNamedSpecifiers check we
|
||||
// know that we don't have one of these cases: import { Unused }
|
||||
// from 'module'; import { Unused, Unused... } from 'module';
|
||||
// import { ...Unused, Unused, } from 'module';
|
||||
//
|
||||
// The result is that we know that there _must_ be a comma that
|
||||
// needs cleaning up
|
||||
//
|
||||
// try to remove the leading comma first as it leads to a nicer
|
||||
// fix output in most cases
|
||||
//
|
||||
// leading preferred: import { Used, Unused, Used } from 'module';
|
||||
// ^^^^^^^^ remove import { Used, Used } from 'module';
|
||||
//
|
||||
// trailing preferred: import { Used, Unused, Used } from
|
||||
// 'module'; ^^^^^^^ remove import { Used, Used } from
|
||||
// 'module'; ^^ ugly double space
|
||||
//
|
||||
// But we need to still fallback to the trailing comma for cases
|
||||
// where the unused specifier is the first in the import eg:
|
||||
// import { Unused, Used } from 'module';
|
||||
const maybeComma = context.sourceCode.getTokenBefore(def.node);
|
||||
const comma = maybeComma && isCommaToken.predicate(maybeComma)
|
||||
? maybeComma
|
||||
: assertToken(isCommaToken, context.sourceCode.getTokenAfter(def.node));
|
||||
return fixer.removeRange([
|
||||
Math.min(def.node.range[0], comma.range[0]),
|
||||
Math.max(def.node.range[1], comma.range[1]),
|
||||
]);
|
||||
},
|
||||
};
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier: {
|
||||
// namespace specifiers cannot be used with any other specifier -- so
|
||||
// we can just remove entire import declaration
|
||||
const importDecl = def.node.parent;
|
||||
return {
|
||||
messageId: 'removeUnusedImportDeclaration',
|
||||
fix: fixer => removeNodeWithTrailingNewline(fixer, importDecl),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determines what variable type a def is.
|
||||
* @param def the declaration to check
|
||||
@@ -146,15 +502,31 @@ exports.default = (0, util_1.createRule)({
|
||||
*/
|
||||
if (options.destructuredArrayIgnorePattern &&
|
||||
def.name.parent.type === utils_1.AST_NODE_TYPES.ArrayPattern) {
|
||||
return 'array-destructure';
|
||||
return { type: VariableType.ArrayDestructure, def };
|
||||
}
|
||||
switch (def.type) {
|
||||
case scope_manager_1.DefinitionType.CatchClause:
|
||||
return 'catch-clause';
|
||||
return { type: VariableType.CatchClause, def };
|
||||
case scope_manager_1.DefinitionType.ClassName:
|
||||
return { type: VariableType.ClassName, def };
|
||||
case scope_manager_1.DefinitionType.FunctionName:
|
||||
return { type: VariableType.FunctionName, def };
|
||||
case scope_manager_1.DefinitionType.ImplicitGlobalVariable:
|
||||
return { type: VariableType.ImplicitGlobalVariable, def };
|
||||
case scope_manager_1.DefinitionType.ImportBinding:
|
||||
return { type: VariableType.ImportBinding, def };
|
||||
case scope_manager_1.DefinitionType.Parameter:
|
||||
return 'parameter';
|
||||
default:
|
||||
return 'variable';
|
||||
return { type: VariableType.Parameter, def };
|
||||
case scope_manager_1.DefinitionType.TSEnumName:
|
||||
return { type: VariableType.TSEnumName, def };
|
||||
case scope_manager_1.DefinitionType.TSEnumMember:
|
||||
return { type: VariableType.TSEnumMember, def };
|
||||
case scope_manager_1.DefinitionType.TSModuleName:
|
||||
return { type: VariableType.TSModuleName, def };
|
||||
case scope_manager_1.DefinitionType.Type:
|
||||
return { type: VariableType.Type, def };
|
||||
case scope_manager_1.DefinitionType.Variable:
|
||||
return { type: VariableType.Variable, def };
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -166,22 +538,22 @@ exports.default = (0, util_1.createRule)({
|
||||
*/
|
||||
function getVariableDescription(variableType) {
|
||||
switch (variableType) {
|
||||
case 'array-destructure':
|
||||
case VariableType.ArrayDestructure:
|
||||
return {
|
||||
pattern: options.destructuredArrayIgnorePattern?.toString(),
|
||||
variableDescription: 'elements of array destructuring',
|
||||
};
|
||||
case 'catch-clause':
|
||||
case VariableType.CatchClause:
|
||||
return {
|
||||
pattern: options.caughtErrorsIgnorePattern?.toString(),
|
||||
variableDescription: 'caught errors',
|
||||
};
|
||||
case 'parameter':
|
||||
case VariableType.Parameter:
|
||||
return {
|
||||
pattern: options.argsIgnorePattern?.toString(),
|
||||
variableDescription: 'args',
|
||||
};
|
||||
case 'variable':
|
||||
default:
|
||||
return {
|
||||
pattern: options.varsIgnorePattern?.toString(),
|
||||
variableDescription: 'vars',
|
||||
@@ -198,7 +570,7 @@ exports.default = (0, util_1.createRule)({
|
||||
const def = unusedVar.defs.at(0);
|
||||
let additionalMessageData = '';
|
||||
if (def) {
|
||||
const { pattern, variableDescription } = getVariableDescription(defToVariableType(def));
|
||||
const { pattern, variableDescription } = getVariableDescription(defToVariableType(def).type);
|
||||
if (pattern && variableDescription) {
|
||||
additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;
|
||||
}
|
||||
@@ -219,7 +591,7 @@ exports.default = (0, util_1.createRule)({
|
||||
const def = unusedVar.defs.at(0);
|
||||
let additionalMessageData = '';
|
||||
if (def) {
|
||||
const { pattern, variableDescription } = getVariableDescription(defToVariableType(def));
|
||||
const { pattern, variableDescription } = getVariableDescription(defToVariableType(def).type);
|
||||
if (pattern && variableDescription) {
|
||||
additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;
|
||||
}
|
||||
@@ -318,10 +690,9 @@ exports.default = (0, util_1.createRule)({
|
||||
def.name.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
options.destructuredArrayIgnorePattern?.test(def.name.name)) {
|
||||
if (options.reportUsedIgnorePattern && used) {
|
||||
context.report({
|
||||
node: def.name,
|
||||
report(variable, {
|
||||
messageId: 'usedIgnoredVar',
|
||||
data: getUsedIgnoredMessageData(variable, 'array-destructure'),
|
||||
data: getUsedIgnoredMessageData(variable, VariableType.ArrayDestructure),
|
||||
});
|
||||
}
|
||||
continue;
|
||||
@@ -338,13 +709,11 @@ exports.default = (0, util_1.createRule)({
|
||||
continue;
|
||||
}
|
||||
// skip ignored parameters
|
||||
if (def.name.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
options.caughtErrorsIgnorePattern?.test(def.name.name)) {
|
||||
if (options.caughtErrorsIgnorePattern?.test(def.name.name)) {
|
||||
if (options.reportUsedIgnorePattern && used) {
|
||||
context.report({
|
||||
node: def.name,
|
||||
report(variable, {
|
||||
messageId: 'usedIgnoredVar',
|
||||
data: getUsedIgnoredMessageData(variable, 'catch-clause'),
|
||||
data: getUsedIgnoredMessageData(variable, VariableType.CatchClause),
|
||||
});
|
||||
}
|
||||
continue;
|
||||
@@ -359,10 +728,9 @@ exports.default = (0, util_1.createRule)({
|
||||
if (def.name.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
options.argsIgnorePattern?.test(def.name.name)) {
|
||||
if (options.reportUsedIgnorePattern && used) {
|
||||
context.report({
|
||||
node: def.name,
|
||||
report(variable, {
|
||||
messageId: 'usedIgnoredVar',
|
||||
data: getUsedIgnoredMessageData(variable, 'parameter'),
|
||||
data: getUsedIgnoredMessageData(variable, VariableType.Parameter),
|
||||
});
|
||||
}
|
||||
continue;
|
||||
@@ -382,10 +750,9 @@ exports.default = (0, util_1.createRule)({
|
||||
/* enum members are always marked as 'used' by `collectVariables`, but in reality they may be used or
|
||||
unused. either way, don't complain about their naming. */
|
||||
def.type !== utils_1.TSESLint.Scope.DefinitionType.TSEnumMember) {
|
||||
context.report({
|
||||
node: def.name,
|
||||
report(variable, {
|
||||
messageId: 'usedIgnoredVar',
|
||||
data: getUsedIgnoredMessageData(variable, 'variable'),
|
||||
data: getUsedIgnoredMessageData(variable, VariableType.Variable),
|
||||
});
|
||||
}
|
||||
continue;
|
||||
@@ -454,29 +821,15 @@ exports.default = (0, util_1.createRule)({
|
||||
for (const unusedVar of unusedVars) {
|
||||
// Report the first declaration.
|
||||
if (unusedVar.defs.length > 0) {
|
||||
const usedOnlyAsType = unusedVar.references.some(ref => (0, referenceContainsTypeQuery_1.referenceContainsTypeQuery)(ref.identifier));
|
||||
const usedOnlyAsType = unusedVar.references.some(ref => (0, referenceContainsTypeQuery_1.referenceContainsTypeQuery)(ref.identifier) ||
|
||||
(0, referenceContainsTypePredicate_1.referenceContainsTypePredicate)(ref.identifier));
|
||||
const messageId = usedOnlyAsType ? 'usedOnlyAsType' : 'unusedVar';
|
||||
const isImportUsedOnlyAsType = usedOnlyAsType &&
|
||||
unusedVar.defs.some(def => def.type === scope_manager_1.DefinitionType.ImportBinding);
|
||||
if (isImportUsedOnlyAsType) {
|
||||
continue;
|
||||
}
|
||||
const writeReferences = unusedVar.references.filter(ref => ref.isWrite() &&
|
||||
ref.from.variableScope === unusedVar.scope.variableScope);
|
||||
const id = writeReferences.length
|
||||
? writeReferences[writeReferences.length - 1].identifier
|
||||
: unusedVar.identifiers[0];
|
||||
const messageId = usedOnlyAsType ? 'usedOnlyAsType' : 'unusedVar';
|
||||
const { start } = id.loc;
|
||||
const idLength = id.name.length;
|
||||
const loc = {
|
||||
start,
|
||||
end: {
|
||||
column: start.column + idLength,
|
||||
line: start.line,
|
||||
},
|
||||
};
|
||||
context.report({
|
||||
loc,
|
||||
report(unusedVar, {
|
||||
messageId,
|
||||
data: unusedVar.references.some(ref => ref.isWrite())
|
||||
? getAssignedMessageData(unusedVar)
|
||||
|
||||
Generated
Vendored
+7
-2
@@ -1,6 +1,11 @@
|
||||
import type { TSESLint } from '@typescript-eslint/utils';
|
||||
type MessageId = 'preferOptionalSyntax' | 'uselessDefaultAssignment' | 'uselessUndefined';
|
||||
declare const _default: TSESLint.RuleModule<MessageId, [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
type MessageId = 'noStrictNullCheck' | 'preferOptionalSyntax' | 'uselessDefaultAssignment' | 'uselessUndefined';
|
||||
type Options = [
|
||||
{
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
|
||||
}
|
||||
];
|
||||
declare const _default: TSESLint.RuleModule<MessageId, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
|
||||
Generated
Vendored
+69
-9
@@ -48,16 +48,44 @@ exports.default = (0, util_1.createRule)({
|
||||
},
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
|
||||
preferOptionalSyntax: 'Using `= undefined` to make a parameter optional adds unnecessary runtime logic. Use the `?` optional syntax instead.',
|
||||
uselessDefaultAssignment: 'Default value is useless because the {{ type }} is not optional.',
|
||||
uselessUndefined: 'Default value is useless because it is undefined. Optional {{ type }}s are already undefined by default.',
|
||||
},
|
||||
schema: [],
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: {
|
||||
type: 'boolean',
|
||||
description: 'Unless this is set to `true`, the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
defaultOptions: [
|
||||
{
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
||||
},
|
||||
],
|
||||
create(context, [{ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing }]) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
const compilerOptions = services.program.getCompilerOptions();
|
||||
const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'strictNullChecks');
|
||||
if (!isStrictNullChecks &&
|
||||
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing !== true) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: { column: 0, line: 0 },
|
||||
end: { column: 0, line: 0 },
|
||||
},
|
||||
messageId: 'noStrictNullCheck',
|
||||
});
|
||||
}
|
||||
function canBeUndefined(type) {
|
||||
if ((0, util_1.isTypeAnyType)(type) || (0, util_1.isTypeUnknownType)(type)) {
|
||||
return true;
|
||||
@@ -98,6 +126,8 @@ exports.default = (0, util_1.createRule)({
|
||||
const paramIndex = parent.params.indexOf(node);
|
||||
if (paramIndex !== -1) {
|
||||
const tsFunc = services.esTreeNodeToTSNodeMap.get(parent);
|
||||
// tsFunc is already a FunctionLike subtype; defensive runtime check
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (ts.isFunctionLike(tsFunc)) {
|
||||
const contextualType = checker.getContextualType(tsFunc);
|
||||
if (!contextualType) {
|
||||
@@ -111,9 +141,15 @@ exports.default = (0, util_1.createRule)({
|
||||
const params = signatures[0].getParameters();
|
||||
if (paramIndex < params.length) {
|
||||
const paramSymbol = params[paramIndex];
|
||||
if ((paramSymbol.flags & ts.SymbolFlags.Optional) === 0) {
|
||||
if (paramSymbol.valueDeclaration &&
|
||||
ts.isParameter(paramSymbol.valueDeclaration) &&
|
||||
paramSymbol.valueDeclaration.dotDotDotToken != null) {
|
||||
return;
|
||||
}
|
||||
if (!tsutils.isSymbolFlagSet(paramSymbol, ts.SymbolFlags.Optional)) {
|
||||
const paramType = checker.getTypeOfSymbol(paramSymbol);
|
||||
if (!canBeUndefined(paramType)) {
|
||||
if (!tsutils.isTypeParameter(paramType) &&
|
||||
!canBeUndefined(paramType)) {
|
||||
reportUselessDefaultAssignment(node, 'parameter');
|
||||
}
|
||||
}
|
||||
@@ -164,9 +200,17 @@ exports.default = (0, util_1.createRule)({
|
||||
if (!symbol) {
|
||||
return null;
|
||||
}
|
||||
if (symbol.flags & ts.SymbolFlags.Optional &&
|
||||
hasConditionalInitializer(objectPattern)) {
|
||||
return null;
|
||||
if (tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Optional)) {
|
||||
const parent = objectPattern.parent;
|
||||
if (parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
|
||||
parent.init &&
|
||||
hasConditionalInitializer(objectPattern)) {
|
||||
const propertyName = getPropertyName(node.key);
|
||||
if (!propertyName ||
|
||||
!hasPropertyInAllBranches(parent.init, propertyName)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return checker.getTypeOfSymbol(symbol);
|
||||
}
|
||||
@@ -188,10 +232,16 @@ exports.default = (0, util_1.createRule)({
|
||||
return checker.getTypeAtLocation(tsNode);
|
||||
}
|
||||
if ((0, util_1.isFunction)(parent)) {
|
||||
const paramIndex = parent.params.indexOf(pattern);
|
||||
let paramIndex = parent.params.indexOf(pattern);
|
||||
const tsFunc = services.esTreeNodeToTSNodeMap.get(parent);
|
||||
const signature = (0, util_1.nullThrows)(checker.getSignatureFromDeclaration(tsFunc), util_1.NullThrowsReasons.MissingToken('signature', 'function'));
|
||||
const params = signature.getParameters();
|
||||
if (signature.thisParameter) {
|
||||
paramIndex--;
|
||||
}
|
||||
if (paramIndex < 0 || paramIndex >= params.length) {
|
||||
return null;
|
||||
}
|
||||
return checker.getTypeOfSymbol(params[paramIndex]);
|
||||
}
|
||||
if (parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
||||
@@ -216,6 +266,8 @@ exports.default = (0, util_1.createRule)({
|
||||
return key.name;
|
||||
case utils_1.AST_NODE_TYPES.Literal:
|
||||
return String(key.value);
|
||||
case utils_1.AST_NODE_TYPES.TemplateLiteral:
|
||||
return key.expressions.length ? null : key.quasis[0].value.cooked;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -254,6 +306,14 @@ exports.default = (0, util_1.createRule)({
|
||||
const end = node.range[1];
|
||||
return fixer.removeRange([start, end]);
|
||||
}
|
||||
function hasPropertyInAllBranches(expression, propertyName) {
|
||||
return ((expression.type === utils_1.AST_NODE_TYPES.ObjectExpression &&
|
||||
expression.properties.some(prop => prop.type === utils_1.AST_NODE_TYPES.Property &&
|
||||
getPropertyName(prop.key) === propertyName)) ||
|
||||
(expression.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&
|
||||
hasPropertyInAllBranches(expression.consequent, propertyName) &&
|
||||
hasPropertyInAllBranches(expression.alternate, propertyName)));
|
||||
}
|
||||
return {
|
||||
AssignmentPattern: checkAssignmentPattern,
|
||||
};
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -63,7 +63,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return tsutils.unionConstituents(type);
|
||||
};
|
||||
const couldBeNullish = (type) => {
|
||||
if (type.flags & ts.TypeFlags.TypeParameter) {
|
||||
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.TypeParameter)) {
|
||||
const constraint = type.getConstraint();
|
||||
return constraint == null || couldBeNullish(constraint);
|
||||
}
|
||||
@@ -75,10 +75,10 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
||||
return tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined);
|
||||
};
|
||||
const sameTypeWithoutNullish = (assertedTypes, originalTypes) => {
|
||||
const nonNullishOriginalTypes = originalTypes.filter(type => (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) === 0);
|
||||
const nonNullishOriginalTypes = originalTypes.filter(type => !tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined));
|
||||
if (nonNullishOriginalTypes.length === originalTypes.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts_api_utils_1 = require("ts-api-utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
@@ -133,7 +134,7 @@ exports.default = (0, util_1.createRule)({
|
||||
if ((0, util_1.typeMatchesSomeSpecifier)(type, allow, services.program)) {
|
||||
return;
|
||||
}
|
||||
if (type.flags & ts.TypeFlags.Undefined) {
|
||||
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.Undefined)) {
|
||||
context.report({ node, messageId: 'undef' });
|
||||
return;
|
||||
}
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -216,10 +216,6 @@ exports.default = (0, util_1.createRule)({
|
||||
* @param testNode The node being tested (i.e. `a`)
|
||||
*/
|
||||
function isTruthinessCheckEligibleForPreferNullish({ node, testNode, }) {
|
||||
const testType = parserServices.getTypeAtLocation(testNode);
|
||||
if (!isTypeEligibleForPreferNullish(testType)) {
|
||||
return false;
|
||||
}
|
||||
if (ignoreConditionalTests === true && isConditionalTest(node)) {
|
||||
return false;
|
||||
}
|
||||
@@ -229,6 +225,10 @@ exports.default = (0, util_1.createRule)({
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.CallExpression)) {
|
||||
return false;
|
||||
}
|
||||
const testType = parserServices.getTypeAtLocation(testNode);
|
||||
if (!isTypeEligibleForPreferNullish(testType)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function checkAndFixWithPreferNullishOverOr(node, description, equals) {
|
||||
|
||||
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain-utils/analyzeChain.js
Generated
Vendored
+44
-1
@@ -378,7 +378,50 @@ function getReportDescriptor(sourceCode, parserServices, node, operator, options
|
||||
newCode = `!${newCode}`;
|
||||
}
|
||||
const reportRange = getReportRange(chain, node.range, sourceCode);
|
||||
const fix = fixer => fixer.replaceTextRange(reportRange, newCode);
|
||||
const fix = fixer => {
|
||||
let unclosedParens = 0;
|
||||
const tokensInRange = sourceCode.getTokens(node, {
|
||||
filter: token => token.range[0] >= reportRange[0] && token.range[1] <= reportRange[1],
|
||||
});
|
||||
for (const token of tokensInRange) {
|
||||
if ((0, util_1.isOpeningParenToken)(token)) {
|
||||
unclosedParens++;
|
||||
}
|
||||
else if ((0, util_1.isClosingParenToken)(token)) {
|
||||
unclosedParens--;
|
||||
}
|
||||
}
|
||||
if (unclosedParens > 0 && reportRange[1] < node.range[1]) {
|
||||
const openParensOutsideRange = [];
|
||||
const unmatchedCloseParens = [];
|
||||
const tokensOutRange = sourceCode.getTokens(node, {
|
||||
filter: token => token.range[1] > reportRange[1],
|
||||
});
|
||||
for (const token of tokensOutRange) {
|
||||
if ((0, util_1.isOpeningParenToken)(token)) {
|
||||
openParensOutsideRange.push(token.range[0]);
|
||||
}
|
||||
if ((0, util_1.isClosingParenToken)(token)) {
|
||||
if (openParensOutsideRange.length > 0) {
|
||||
openParensOutsideRange.pop();
|
||||
}
|
||||
else {
|
||||
unmatchedCloseParens.push(token.range[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
let leftCode = sourceCode.getText(node);
|
||||
unmatchedCloseParens.reverse();
|
||||
for (const unmatchedParenIndex of unmatchedCloseParens) {
|
||||
leftCode =
|
||||
leftCode.slice(0, unmatchedParenIndex) +
|
||||
leftCode.slice(unmatchedParenIndex + 1);
|
||||
}
|
||||
leftCode = leftCode.slice(reportRange[1]);
|
||||
return fixer.replaceTextRange(node.range, newCode + leftCode);
|
||||
}
|
||||
return fixer.replaceTextRange(reportRange, newCode);
|
||||
};
|
||||
return {
|
||||
loc: {
|
||||
end: sourceCode.getLocFromIndex(reportRange[1]),
|
||||
|
||||
Generated
Vendored
+6
-5
@@ -87,6 +87,7 @@ const NULLISH_FLAGS = ts.TypeFlags.Null | ts.TypeFlags.Undefined;
|
||||
function isValidFalseBooleanCheckType(node, disallowFalseyLiteral, parserServices, options) {
|
||||
const type = parserServices.getTypeAtLocation(node);
|
||||
const types = (0, ts_api_utils_1.unionConstituents)(type);
|
||||
const primitiveAndObjectParts = types.flatMap(type => (0, ts_api_utils_1.intersectionConstituents)(type));
|
||||
if (disallowFalseyLiteral &&
|
||||
/*
|
||||
```
|
||||
@@ -98,10 +99,10 @@ function isValidFalseBooleanCheckType(node, disallowFalseyLiteral, parserService
|
||||
We don't want to consider these two cases because the boolean expression
|
||||
narrows out the non-nullish falsy cases - so converting the chain to `x?.a`
|
||||
would introduce a build error
|
||||
*/ (types.some(t => (0, ts_api_utils_1.isBooleanLiteralType)(t) && t.intrinsicName === 'false') ||
|
||||
types.some(t => (0, ts_api_utils_1.isStringLiteralType)(t) && t.value === '') ||
|
||||
types.some(t => (0, ts_api_utils_1.isNumberLiteralType)(t) && t.value === 0) ||
|
||||
types.some(t => (0, ts_api_utils_1.isBigIntLiteralType)(t) && t.value.base10Value === '0'))) {
|
||||
*/ (primitiveAndObjectParts.some(t => (0, ts_api_utils_1.isBooleanLiteralType)(t) && t.intrinsicName === 'false') ||
|
||||
primitiveAndObjectParts.some(t => (0, ts_api_utils_1.isStringLiteralType)(t) && t.value === '') ||
|
||||
primitiveAndObjectParts.some(t => (0, ts_api_utils_1.isNumberLiteralType)(t) && t.value === 0) ||
|
||||
primitiveAndObjectParts.some(t => (0, ts_api_utils_1.isBigIntLiteralType)(t) && t.value.base10Value === '0'))) {
|
||||
return false;
|
||||
}
|
||||
let allowedFlags = NULLISH_FLAGS | ts.TypeFlags.Object;
|
||||
@@ -123,7 +124,7 @@ function isValidFalseBooleanCheckType(node, disallowFalseyLiteral, parserService
|
||||
if (options.checkBigInt === true) {
|
||||
allowedFlags |= ts.TypeFlags.BigIntLike;
|
||||
}
|
||||
return types.every(t => (0, util_1.isTypeFlagSet)(t, allowedFlags));
|
||||
return primitiveAndObjectParts.every(t => (0, util_1.isTypeFlagSet)(t, allowedFlags));
|
||||
}
|
||||
function gatherLogicalOperands(node, parserServices, sourceCode, options) {
|
||||
const result = [];
|
||||
|
||||
Generated
Vendored
+2
@@ -1,6 +1,8 @@
|
||||
import type { TypeOrValueSpecifier } from '../util';
|
||||
export type MessageIds = 'rejectAnError';
|
||||
export type Options = [
|
||||
{
|
||||
allow?: TypeOrValueSpecifier[];
|
||||
allowEmptyReject?: boolean;
|
||||
allowThrowingAny?: boolean;
|
||||
allowThrowingUnknown?: boolean;
|
||||
|
||||
Generated
Vendored
+8
@@ -20,6 +20,10 @@ exports.default = (0, util_1.createRule)({
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
allow: {
|
||||
...util_1.typeOrValueSpecifiersSchema,
|
||||
description: 'Type specifiers that can be used as Promise rejection reasons.',
|
||||
},
|
||||
allowEmptyReject: {
|
||||
type: 'boolean',
|
||||
description: 'Whether to allow calls to `Promise.reject()` with no arguments.',
|
||||
@@ -38,6 +42,7 @@ exports.default = (0, util_1.createRule)({
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allow: [],
|
||||
allowEmptyReject: false,
|
||||
allowThrowingAny: false,
|
||||
allowThrowingUnknown: false,
|
||||
@@ -49,6 +54,9 @@ exports.default = (0, util_1.createRule)({
|
||||
const argument = callExpression.arguments.at(0);
|
||||
if (argument) {
|
||||
const type = services.getTypeAtLocation(argument);
|
||||
if ((0, util_1.typeMatchesSomeSpecifier)(type, options.allow, services.program)) {
|
||||
return;
|
||||
}
|
||||
if (options.allowThrowingAny && (0, util_1.isTypeAnyType)(type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Generated
Vendored
+10
-1
@@ -48,6 +48,15 @@ exports.default = (0, util_1.createRule)({
|
||||
],
|
||||
create(context, [{ allow, checkParameterProperties, ignoreInferredTypes, treatMethodsAsReadonly, },]) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
function getParameterType(actualParam) {
|
||||
if (actualParam.typeAnnotation?.typeAnnotation) {
|
||||
// Get type from annotation node to preserve aliasSymbol
|
||||
const checker = services.program.getTypeChecker();
|
||||
const tsTypeNode = services.esTreeNodeToTSNodeMap.get(actualParam.typeAnnotation.typeAnnotation);
|
||||
return checker.getTypeFromTypeNode(tsTypeNode);
|
||||
}
|
||||
return services.getTypeAtLocation(actualParam);
|
||||
}
|
||||
return {
|
||||
[[
|
||||
utils_1.AST_NODE_TYPES.ArrowFunctionExpression,
|
||||
@@ -71,7 +80,7 @@ exports.default = (0, util_1.createRule)({
|
||||
if (ignoreInferredTypes && actualParam.typeAnnotation == null) {
|
||||
continue;
|
||||
}
|
||||
const type = services.getTypeAtLocation(actualParam);
|
||||
const type = getParameterType(actualParam);
|
||||
const isReadOnly = (0, util_1.isTypeReadonly)(services.program, type, {
|
||||
allow,
|
||||
treatMethodsAsReadonly: !!treatMethodsAsReadonly,
|
||||
|
||||
+57
-10
@@ -222,7 +222,11 @@ exports.default = (0, util_1.createRule)({
|
||||
name: context.sourceCode.getText(nameNode),
|
||||
},
|
||||
*fix(fixer) {
|
||||
yield fixer.insertTextBefore(nameNode, 'readonly ');
|
||||
const readonlyInsertionTarget = esNode.type === utils_1.AST_NODE_TYPES.PropertyDefinition &&
|
||||
esNode.computed
|
||||
? (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(nameNode), 'Expected to find a token before computed property name')
|
||||
: nameNode;
|
||||
yield fixer.insertTextBefore(readonlyInsertionTarget, 'readonly ');
|
||||
if (typeAnnotation) {
|
||||
yield fixer.insertTextAfter(nameNode, `: ${typeAnnotation}`);
|
||||
}
|
||||
@@ -239,9 +243,25 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
},
|
||||
MemberExpression(node) {
|
||||
if (classScopeStack.length !== 0 && !node.computed) {
|
||||
if (classScopeStack.length === 0) {
|
||||
return;
|
||||
}
|
||||
const classScope = classScopeStack[classScopeStack.length - 1];
|
||||
if (!node.computed) {
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
handlePropertyAccessExpression(tsNode, tsNode.parent, classScopeStack[classScopeStack.length - 1]);
|
||||
handlePropertyAccessExpression(tsNode, tsNode.parent, classScope);
|
||||
}
|
||||
else {
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
if (ts.isElementAccessExpression(tsNode) &&
|
||||
ts.isBinaryExpression(tsNode.parent) &&
|
||||
tsNode.parent.left === tsNode &&
|
||||
tsutils.isAssignmentKind(tsNode.parent.operatorToken.kind)) {
|
||||
const memberName = (0, util_1.getStaticMemberAccessValue)(node, context);
|
||||
if (typeof memberName === 'string') {
|
||||
classScope.addVariableModificationByName(tsNode.expression, memberName);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -285,8 +305,7 @@ class ClassScope {
|
||||
addDeclaredVariable(node) {
|
||||
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
||||
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
|
||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Accessor | ts.ModifierFlags.Readonly) ||
|
||||
ts.isComputedPropertyName(node.name)) {
|
||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Accessor | ts.ModifierFlags.Readonly)) {
|
||||
return;
|
||||
}
|
||||
if (this.onlyInlineLambdas &&
|
||||
@@ -294,25 +313,32 @@ class ClassScope {
|
||||
!ts.isArrowFunction(node.initializer)) {
|
||||
return;
|
||||
}
|
||||
const memberName = getMemberName(node.name);
|
||||
if (memberName == null) {
|
||||
return;
|
||||
}
|
||||
(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Static)
|
||||
? this.privateModifiableStatics
|
||||
: this.privateModifiableMembers).set(node.name.getText(), node);
|
||||
: this.privateModifiableMembers).set(memberName, node);
|
||||
}
|
||||
addVariableModification(node) {
|
||||
const modifierType = this.checker.getTypeAtLocation(node.expression);
|
||||
this.addVariableModificationByName(node.expression, node.name.text);
|
||||
}
|
||||
addVariableModificationByName(expression, memberName) {
|
||||
const modifierType = this.checker.getTypeAtLocation(expression);
|
||||
const relationOfModifierTypeToClass = this.getTypeToClassRelation(modifierType);
|
||||
if (relationOfModifierTypeToClass === TypeToClassRelation.Instance &&
|
||||
this.constructorScopeDepth === DIRECTLY_INSIDE_CONSTRUCTOR) {
|
||||
this.memberVariableWithConstructorModifications.add(node.name.text);
|
||||
this.memberVariableWithConstructorModifications.add(memberName);
|
||||
return;
|
||||
}
|
||||
if (relationOfModifierTypeToClass === TypeToClassRelation.Instance ||
|
||||
relationOfModifierTypeToClass === TypeToClassRelation.ClassAndInstance) {
|
||||
this.memberVariableModifications.add(node.name.text);
|
||||
this.memberVariableModifications.add(memberName);
|
||||
}
|
||||
if (relationOfModifierTypeToClass === TypeToClassRelation.Class ||
|
||||
relationOfModifierTypeToClass === TypeToClassRelation.ClassAndInstance) {
|
||||
this.staticVariableModifications.add(node.name.text);
|
||||
this.staticVariableModifications.add(memberName);
|
||||
}
|
||||
}
|
||||
enterConstructor(node) {
|
||||
@@ -390,3 +416,24 @@ class ClassScope {
|
||||
return this.memberVariableWithConstructorModifications.has(name);
|
||||
}
|
||||
}
|
||||
function getMemberName(name) {
|
||||
if (ts.isIdentifier(name) ||
|
||||
ts.isPrivateIdentifier(name) ||
|
||||
ts.isStringLiteral(name) ||
|
||||
ts.isNoSubstitutionTemplateLiteral(name) ||
|
||||
ts.isNumericLiteral(name)) {
|
||||
return name.text;
|
||||
}
|
||||
if (ts.isComputedPropertyName(name)) {
|
||||
const expression = name.expression;
|
||||
if (ts.isNumericLiteral(expression)) {
|
||||
return expression.text;
|
||||
}
|
||||
if (ts.isPropertyAccessExpression(expression) &&
|
||||
ts.isIdentifier(expression.expression) &&
|
||||
expression.expression.text === 'Symbol') {
|
||||
return expression.getText();
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+7
-3
@@ -100,9 +100,13 @@ exports.default = (0, util_1.createRule)({
|
||||
node.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.callee.name === 'RegExp') {
|
||||
const flags = node.arguments.at(1);
|
||||
return !(flags?.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
typeof flags.value === 'string' &&
|
||||
flags.value.includes('g'));
|
||||
if (!flags) {
|
||||
return true;
|
||||
}
|
||||
const flagsValue = (0, util_1.getStaticValue)(flags, globalScope);
|
||||
return (!!flagsValue &&
|
||||
(typeof flagsValue.value !== 'string' ||
|
||||
!flagsValue.value.includes('g')));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -40,7 +40,7 @@ exports.default = (0, util_1.createRule)({
|
||||
return comment.value;
|
||||
}
|
||||
// For multiline comments - we look at only the last line.
|
||||
const commentlines = comment.value.split('\n');
|
||||
const commentlines = comment.value.split(utils_1.ASTUtils.LINEBREAK_MATCHER);
|
||||
return commentlines[commentlines.length - 1];
|
||||
}
|
||||
function isValidTsIgnorePresent(comment) {
|
||||
|
||||
+2
-2
@@ -234,13 +234,13 @@ exports.default = (0, util_1.createRule)({
|
||||
/** Given type parameters, returns a function to test whether a type is one of those parameters. */
|
||||
function getIsTypeParameter(typeParameters) {
|
||||
if (typeParameters == null) {
|
||||
return (() => false);
|
||||
return () => false;
|
||||
}
|
||||
const set = new Set();
|
||||
for (const t of typeParameters.params) {
|
||||
set.add(t.name.name);
|
||||
}
|
||||
return (typeName => set.has(typeName));
|
||||
return typeName => set.has(typeName);
|
||||
}
|
||||
/** True if any of the outer type parameters are used in a signature. */
|
||||
function signatureUsesTypeParameter(sig, isTypeParameter) {
|
||||
|
||||
Generated
Vendored
+2
-4
@@ -57,8 +57,7 @@ function findTruthinessAssertedArgument(services, node) {
|
||||
return undefined;
|
||||
}
|
||||
const checker = services.program.getTypeChecker();
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const signature = checker.getResolvedSignature(tsNode);
|
||||
const signature = services.getResolvedSignature(node);
|
||||
if (signature == null) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -92,8 +91,7 @@ function findTypeGuardAssertedArgument(services, node) {
|
||||
return undefined;
|
||||
}
|
||||
const checker = services.program.getTypeChecker();
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const callSignature = checker.getResolvedSignature(tsNode);
|
||||
const callSignature = services.getResolvedSignature(node);
|
||||
if (callSignature == null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Generated
Vendored
+47
@@ -318,6 +318,20 @@ class ThisScope extends scope_manager_1.Visitor {
|
||||
/////////////////////
|
||||
// Visit selectors //
|
||||
/////////////////////
|
||||
AssignmentExpression(node) {
|
||||
this.visitChildren(node);
|
||||
if (node.right.type === utils_1.AST_NODE_TYPES.ThisExpression &&
|
||||
node.left.type === utils_1.AST_NODE_TYPES.ObjectPattern) {
|
||||
this.handleThisDestructuring(node.left);
|
||||
}
|
||||
}
|
||||
AssignmentPattern(node) {
|
||||
this.visitChildren(node);
|
||||
if (node.right.type === utils_1.AST_NODE_TYPES.ThisExpression &&
|
||||
node.left.type === utils_1.AST_NODE_TYPES.ObjectPattern) {
|
||||
this.handleThisDestructuring(node.left);
|
||||
}
|
||||
}
|
||||
ClassDeclaration(node) {
|
||||
this.visitClass(node);
|
||||
}
|
||||
@@ -391,6 +405,39 @@ class ThisScope extends scope_manager_1.Visitor {
|
||||
StaticBlock(node) {
|
||||
this.visitIntermediate(node);
|
||||
}
|
||||
VariableDeclarator(node) {
|
||||
this.visitChildren(node);
|
||||
if (node.init?.type === utils_1.AST_NODE_TYPES.ThisExpression &&
|
||||
node.id.type === utils_1.AST_NODE_TYPES.ObjectPattern) {
|
||||
this.handleThisDestructuring(node.id);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handles destructuring from `this` in ObjectPattern.
|
||||
* Example: const { property } = this;
|
||||
*/
|
||||
handleThisDestructuring(pattern) {
|
||||
if (this.thisContext == null) {
|
||||
return;
|
||||
}
|
||||
for (const prop of pattern.properties) {
|
||||
if (prop.type !== utils_1.AST_NODE_TYPES.Property) {
|
||||
continue;
|
||||
}
|
||||
if (prop.key.type !== utils_1.AST_NODE_TYPES.Identifier || prop.computed) {
|
||||
continue;
|
||||
}
|
||||
const memberKey = (0, types_1.publicKey)(prop.key.name);
|
||||
const members = this.isStaticThisContext
|
||||
? this.thisContext.members.static
|
||||
: this.thisContext.members.instance;
|
||||
const member = members.get(memberKey);
|
||||
if (member == null) {
|
||||
continue;
|
||||
}
|
||||
countReference(prop.key, member);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Any other scope that is not a class scope
|
||||
|
||||
Generated
Vendored
+4
-1
@@ -4,6 +4,7 @@ exports.collectVariables = collectVariables;
|
||||
const scope_manager_1 = require("@typescript-eslint/scope-manager");
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const isTypeImport_1 = require("./isTypeImport");
|
||||
const referenceContainsTypePredicate_1 = require("./referenceContainsTypePredicate");
|
||||
const referenceContainsTypeQuery_1 = require("./referenceContainsTypeQuery");
|
||||
/**
|
||||
* This class leverages an AST visitor to mark variables as used via the
|
||||
@@ -578,7 +579,9 @@ function isUsedVariable(variable) {
|
||||
rhsNode = getRhsNode(ref, rhsNode);
|
||||
return (ref.isRead() &&
|
||||
!forItself &&
|
||||
!(!isImportedAsType && (0, referenceContainsTypeQuery_1.referenceContainsTypeQuery)(ref.identifier)) &&
|
||||
!(!isImportedAsType &&
|
||||
((0, referenceContainsTypeQuery_1.referenceContainsTypeQuery)(ref.identifier) ||
|
||||
(0, referenceContainsTypePredicate_1.referenceContainsTypePredicate)(ref.identifier))) &&
|
||||
!(isFunctionDefinition && isSelfReference(ref, functionNodes)) &&
|
||||
!(isTypeDecl && isInsideOneOf(ref, typeDeclNodes)) &&
|
||||
!(isModuleDecl && isSelfReference(ref, moduleDeclNodes)) &&
|
||||
|
||||
+2
@@ -3,6 +3,7 @@ export * from './astUtils';
|
||||
export * from './baseTypeUtils';
|
||||
export * from './collectUnusedVariables';
|
||||
export * from './createRule';
|
||||
export * from './getBaseTypesOfClassMember';
|
||||
export * from './getFixOrSuggest';
|
||||
export * from './getFunctionHeadLoc';
|
||||
export * from './getOperatorPrecedence';
|
||||
@@ -29,6 +30,7 @@ export * from './getValueOfLiteralType';
|
||||
export * from './isHigherPrecedenceThanAwait';
|
||||
export * from './skipChainExpression';
|
||||
export * from './truthinessUtils';
|
||||
export * from './walkStatements';
|
||||
export * from '@typescript-eslint/type-utils';
|
||||
export declare const applyDefault: typeof ESLintUtils.applyDefault, deepMerge: typeof ESLintUtils.deepMerge, getParserServices: typeof ESLintUtils.getParserServices, isObjectNotArray: typeof ESLintUtils.isObjectNotArray, nullThrows: typeof ESLintUtils.nullThrows, NullThrowsReasons: {
|
||||
readonly MissingParent: "Expected node to have a parent.";
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ __exportStar(require("./astUtils"), exports);
|
||||
__exportStar(require("./baseTypeUtils"), exports);
|
||||
__exportStar(require("./collectUnusedVariables"), exports);
|
||||
__exportStar(require("./createRule"), exports);
|
||||
__exportStar(require("./getBaseTypesOfClassMember"), exports);
|
||||
__exportStar(require("./getFixOrSuggest"), exports);
|
||||
__exportStar(require("./getFunctionHeadLoc"), exports);
|
||||
__exportStar(require("./getOperatorPrecedence"), exports);
|
||||
@@ -46,6 +47,7 @@ __exportStar(require("./getValueOfLiteralType"), exports);
|
||||
__exportStar(require("./isHigherPrecedenceThanAwait"), exports);
|
||||
__exportStar(require("./skipChainExpression"), exports);
|
||||
__exportStar(require("./truthinessUtils"), exports);
|
||||
__exportStar(require("./walkStatements"), exports);
|
||||
// this is done for convenience - saves migrating all of the old rules
|
||||
__exportStar(require("@typescript-eslint/type-utils"), exports);
|
||||
exports.applyDefault = utils_1.ESLintUtils.applyDefault, exports.deepMerge = utils_1.ESLintUtils.deepMerge, exports.getParserServices = utils_1.ESLintUtils.getParserServices, exports.isObjectNotArray = utils_1.ESLintUtils.isObjectNotArray, exports.nullThrows = utils_1.ESLintUtils.nullThrows, exports.NullThrowsReasons = utils_1.ESLintUtils.NullThrowsReasons;
|
||||
|
||||
+38
-33
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@typescript-eslint/eslint-plugin",
|
||||
"version": "8.52.0",
|
||||
"version": "8.61.0",
|
||||
"description": "TypeScript plugin for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
"!*.tsbuildinfo",
|
||||
"!**/*.tsbuildinfo",
|
||||
"index.d.ts",
|
||||
"raw-plugin.d.ts",
|
||||
"rules.d.ts",
|
||||
@@ -47,52 +47,45 @@
|
||||
"eslint-plugin",
|
||||
"typescript"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "yarn run -BT nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "yarn run -T format",
|
||||
"generate-breaking-changes": "yarn run -BT nx generate-breaking-changes",
|
||||
"generate-configs": "yarn run -BT nx generate-configs repo",
|
||||
"lint": "yarn run -BT nx lint",
|
||||
"test": "yarn run -BT nx test",
|
||||
"typecheck": "yarn run -BT nx typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
"@typescript-eslint/scope-manager": "8.52.0",
|
||||
"@typescript-eslint/type-utils": "8.52.0",
|
||||
"@typescript-eslint/utils": "8.52.0",
|
||||
"@typescript-eslint/visitor-keys": "8.52.0",
|
||||
"ignore": "^7.0.5",
|
||||
"natural-compare": "^1.4.0",
|
||||
"ts-api-utils": "^2.4.0"
|
||||
"ts-api-utils": "^2.5.0",
|
||||
"@typescript-eslint/scope-manager": "8.61.0",
|
||||
"@typescript-eslint/utils": "8.61.0",
|
||||
"@typescript-eslint/type-utils": "8.61.0",
|
||||
"@typescript-eslint/visitor-keys": "8.61.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"@types/natural-compare": "*",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "8.52.0",
|
||||
"@typescript-eslint/rule-tester": "8.52.0",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"@types/natural-compare": "^1.4.3",
|
||||
"@types/react": "^18.3.21",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"ajv": "^6.12.6",
|
||||
"eslint": "*",
|
||||
"json-schema": "*",
|
||||
"eslint": "^10.0.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"markdown-table": "^3.0.4",
|
||||
"marked": "^15.0.12",
|
||||
"mdast-util-from-markdown": "^2.0.2",
|
||||
"mdast-util-mdx": "^3.0.0",
|
||||
"micromark-extension-mdxjs": "^3.0.0",
|
||||
"prettier": "3.7.4",
|
||||
"rimraf": "*",
|
||||
"prettier": "3.8.0",
|
||||
"rimraf": "^5.0.10",
|
||||
"title-case": "^4.3.2",
|
||||
"tsx": "*",
|
||||
"typescript": "*",
|
||||
"tsx": "^4.7.2",
|
||||
"typescript": ">=4.8.4 <6.1.0",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vitest": "^3.2.4"
|
||||
"vitest": "^4.0.18",
|
||||
"@typescript-eslint/rule-tester": "8.61.0",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "8.61.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^8.52.0",
|
||||
"eslint": "^8.57.0 || ^9.0.0",
|
||||
"typescript": ">=4.8.4 <6.0.0"
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"typescript": ">=4.8.4 <6.1.0",
|
||||
"@typescript-eslint/parser": "^8.61.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -115,7 +108,19 @@
|
||||
},
|
||||
"lint": {
|
||||
"command": "eslint"
|
||||
}
|
||||
},
|
||||
"typecheck:tsgo": {}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm -w exec nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "pnpm -w run format",
|
||||
"generate-breaking-changes": "tsx tools/generate-breaking-changes.mts",
|
||||
"generate-configs": "pnpm -w run generate-configs",
|
||||
"lint": "pnpm -w exec nx lint",
|
||||
"test": "pnpm -w exec nx test",
|
||||
"typecheck": "pnpm -w exec nx typecheck",
|
||||
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo"
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-2
@@ -24,8 +24,11 @@ function getLib(compilerOptions) {
|
||||
.map(lib => LIB_FILENAME_REGEX.exec(lib.toLowerCase())?.[1])
|
||||
.filter((lib) => !!lib);
|
||||
}
|
||||
const target = compilerOptions.target ?? typescript_1.ScriptTarget.ES5;
|
||||
// https://github.com/microsoft/TypeScript/blob/ae582a22ee1bb052e19b7c1bc4cac60509b574e0/src/compiler/utilitiesPublic.ts#L13-L36
|
||||
const defaultTarget = typescript_estree_1.typescriptVersionIsAtLeast['6.0']
|
||||
? typescript_1.ScriptTarget.LatestStandard
|
||||
: typescript_1.ScriptTarget.ES5; // eslint-disable-line @typescript-eslint/no-deprecated -- Deprecated in TS 6 but we support TS < 6
|
||||
const target = compilerOptions.target ?? defaultTarget;
|
||||
// https://github.com/microsoft/TypeScript/blob/35ff23d4b0cc715691323ebe54f523c16fe6e3a5/src/compiler/utilitiesPublic.ts#L312-L346
|
||||
switch (target) {
|
||||
case typescript_1.ScriptTarget.ES2015:
|
||||
return ['es6'];
|
||||
@@ -47,6 +50,8 @@ function getLib(compilerOptions) {
|
||||
return ['es2023.full'];
|
||||
case typescript_1.ScriptTarget.ES2024:
|
||||
return ['es2024.full'];
|
||||
case typescript_1.ScriptTarget.ES2025:
|
||||
return ['es2025.full'];
|
||||
case typescript_1.ScriptTarget.ESNext:
|
||||
return ['esnext.full'];
|
||||
default:
|
||||
|
||||
+28
-25
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@typescript-eslint/parser",
|
||||
"version": "8.52.0",
|
||||
"version": "8.61.0",
|
||||
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
||||
"files": [
|
||||
"dist",
|
||||
"!*.tsbuildinfo",
|
||||
"!**/*.tsbuildinfo",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
@@ -38,32 +38,25 @@
|
||||
"syntax",
|
||||
"eslint"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "yarn run -BT nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "yarn run -T format",
|
||||
"lint": "yarn run -BT nx lint",
|
||||
"test": "yarn run -BT nx test",
|
||||
"typecheck": "yarn run -BT nx typecheck"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0 || ^9.0.0",
|
||||
"typescript": ">=4.8.4 <6.0.0"
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.52.0",
|
||||
"@typescript-eslint/types": "8.52.0",
|
||||
"@typescript-eslint/typescript-estree": "8.52.0",
|
||||
"@typescript-eslint/visitor-keys": "8.52.0",
|
||||
"debug": "^4.4.3"
|
||||
"debug": "^4.4.3",
|
||||
"@typescript-eslint/scope-manager": "8.61.0",
|
||||
"@typescript-eslint/types": "8.61.0",
|
||||
"@typescript-eslint/typescript-estree": "8.61.0",
|
||||
"@typescript-eslint/visitor-keys": "8.61.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"eslint": "*",
|
||||
"glob": "*",
|
||||
"rimraf": "*",
|
||||
"typescript": "*",
|
||||
"vitest": "^3.2.4"
|
||||
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"eslint": "^10.0.0",
|
||||
"glob": "^11.1.0",
|
||||
"rimraf": "^5.0.10",
|
||||
"typescript": ">=4.8.4 <6.1.0",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -77,7 +70,17 @@
|
||||
"targets": {
|
||||
"lint": {
|
||||
"command": "eslint"
|
||||
}
|
||||
},
|
||||
"typecheck:tsgo": {}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm exec nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "pnpm -w run format",
|
||||
"lint": "pnpm -w exec nx lint",
|
||||
"test": "pnpm -w exec nx test",
|
||||
"typecheck": "pnpm -w exec nx typecheck",
|
||||
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo"
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -41,6 +41,12 @@ export interface CreateProjectServiceSettings {
|
||||
* Root directory for the tsconfig.json file, if not the current directory.
|
||||
*/
|
||||
tsconfigRootDir?: string;
|
||||
/**
|
||||
* Custom project service host.
|
||||
*
|
||||
* @default `ts.sys` with stub watchers
|
||||
*/
|
||||
host?: Partial<ts.server.ServerHost>;
|
||||
}
|
||||
/**
|
||||
* Creates a new Project Service instance, as well as metadata on its creation.
|
||||
@@ -55,5 +61,5 @@ export interface CreateProjectServiceSettings {
|
||||
* service.openClientFile('index.ts');
|
||||
* ```
|
||||
*/
|
||||
export declare function createProjectService({ jsDocParsingMode, options: optionsRaw, tsconfigRootDir, }?: CreateProjectServiceSettings): ProjectServiceAndMetadata;
|
||||
export declare function createProjectService({ host, jsDocParsingMode, options: optionsRaw, tsconfigRootDir, }?: CreateProjectServiceSettings): ProjectServiceAndMetadata;
|
||||
export { type ProjectServiceOptions } from '@typescript-eslint/types';
|
||||
|
||||
+2
-1
@@ -31,7 +31,7 @@ const createStubFileWatcher = () => ({
|
||||
* service.openClientFile('index.ts');
|
||||
* ```
|
||||
*/
|
||||
function createProjectService({ jsDocParsingMode, options: optionsRaw = {}, tsconfigRootDir, } = {}) {
|
||||
function createProjectService({ host, jsDocParsingMode, options: optionsRaw = {}, tsconfigRootDir, } = {}) {
|
||||
const options = {
|
||||
defaultProject: 'tsconfig.json',
|
||||
...optionsRaw,
|
||||
@@ -62,6 +62,7 @@ function createProjectService({ jsDocParsingMode, options: optionsRaw = {}, tsco
|
||||
module: undefined,
|
||||
}),
|
||||
}),
|
||||
...host,
|
||||
};
|
||||
const logger = {
|
||||
close: doNothing,
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -8,7 +8,7 @@ function getParsedConfigFileFromTSServer(tsserver, defaultProject, throwOnFailur
|
||||
}
|
||||
catch (error) {
|
||||
if (throwOnFailure) {
|
||||
throw new Error(`Could not read Project Service default project '${defaultProject}': ${error.message}`);
|
||||
throw new Error(`Could not read Project Service default project '${defaultProject}': ${error.message}`, { cause: error });
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
||||
+29
-21
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@typescript-eslint/project-service",
|
||||
"version": "8.52.0",
|
||||
"version": "8.61.0",
|
||||
"description": "Standalone TypeScript project service wrapper for linting.",
|
||||
"files": [
|
||||
"dist",
|
||||
"!*.tsbuildinfo",
|
||||
"!**/*.tsbuildinfo",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
@@ -36,28 +36,20 @@
|
||||
"typescript",
|
||||
"estree"
|
||||
],
|
||||
"scripts": {
|
||||
"//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.",
|
||||
"build": "yarn run -BT nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "yarn run -T format",
|
||||
"lint": "yarn run -BT nx lint",
|
||||
"test": "yarn run -BT nx test",
|
||||
"typecheck": "yarn run -BT nx typecheck"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=4.8.4 <6.0.0"
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/tsconfig-utils": "^8.52.0",
|
||||
"@typescript-eslint/types": "^8.52.0",
|
||||
"debug": "^4.4.3"
|
||||
"debug": "^4.4.3",
|
||||
"@typescript-eslint/tsconfig-utils": "^8.61.0",
|
||||
"@typescript-eslint/types": "^8.61.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"rimraf": "*",
|
||||
"typescript": "*",
|
||||
"vitest": "^3.2.4"
|
||||
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"rimraf": "^5.0.10",
|
||||
"typescript": ">=4.8.4 <6.1.0",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -70,6 +62,22 @@
|
||||
"name": "project-service",
|
||||
"includedScripts": [
|
||||
"clean"
|
||||
]
|
||||
],
|
||||
"targets": {
|
||||
"lint": {
|
||||
"command": "eslint"
|
||||
},
|
||||
"typecheck:tsgo": {}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.",
|
||||
"build": "pnpm exec nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "pnpm -w run format",
|
||||
"lint": "pnpm -w exec nx lint",
|
||||
"test": "pnpm -w exec nx test",
|
||||
"typecheck": "pnpm -w exec nx typecheck",
|
||||
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo"
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -48,6 +48,12 @@ export declare class ScopeManager {
|
||||
* If `inner` is `true` then this returns the innermost scope.
|
||||
*/
|
||||
acquire(node: TSESTree.Node, inner?: boolean): Scope | null;
|
||||
/**
|
||||
* Adds dynamically created globals to the global scope and resolve their references.
|
||||
* This method is called by ESLint.
|
||||
* @param names Names of the globals to create
|
||||
*/
|
||||
addGlobals(names: string[]): void;
|
||||
nestBlockScope(node: BlockScope['block']): BlockScope;
|
||||
nestCatchScope(node: CatchScope['block']): CatchScope;
|
||||
nestClassFieldInitializerScope(node: ClassFieldInitializerScope['block']): ClassFieldInitializerScope;
|
||||
|
||||
+8
@@ -98,6 +98,14 @@ class ScopeManager {
|
||||
}
|
||||
return scopes.find(predicate) ?? null;
|
||||
}
|
||||
/**
|
||||
* Adds dynamically created globals to the global scope and resolve their references.
|
||||
* This method is called by ESLint.
|
||||
* @param names Names of the globals to create
|
||||
*/
|
||||
addGlobals(names) {
|
||||
this.globalScope?.addVariables(names);
|
||||
}
|
||||
nestBlockScope(node) {
|
||||
(0, assert_1.assert)(this.currentScope);
|
||||
return this.nestScope(new scope_1.BlockScope(this, this.currentScope, node));
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
import type { TSESTree } from '@typescript-eslint/types';
|
||||
import { DefinitionBase } from './DefinitionBase';
|
||||
import { DefinitionType } from './DefinitionType';
|
||||
export declare class CatchClauseDefinition extends DefinitionBase<DefinitionType.CatchClause, TSESTree.CatchClause, null, TSESTree.BindingName> {
|
||||
export declare class CatchClauseDefinition extends DefinitionBase<DefinitionType.CatchClause, TSESTree.CatchClause, null, TSESTree.Identifier> {
|
||||
readonly isTypeDefinition = false;
|
||||
readonly isVariableDefinition = true;
|
||||
constructor(name: TSESTree.BindingName, node: CatchClauseDefinition['node']);
|
||||
constructor(name: TSESTree.Identifier, node: CatchClauseDefinition['node']);
|
||||
}
|
||||
|
||||
+1
-7
@@ -5,13 +5,7 @@
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dom_asynciterable = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.dom_asynciterable = {
|
||||
libs: [],
|
||||
variables: [
|
||||
['FileSystemDirectoryHandleAsyncIterator', base_config_1.TYPE],
|
||||
['FileSystemDirectoryHandle', base_config_1.TYPE],
|
||||
['ReadableStreamAsyncIterator', base_config_1.TYPE],
|
||||
['ReadableStream', base_config_1.TYPE],
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
|
||||
+1
-78
@@ -5,84 +5,7 @@
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dom_iterable = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.dom_iterable = {
|
||||
libs: [],
|
||||
variables: [
|
||||
['AudioParam', base_config_1.TYPE],
|
||||
['AudioParamMap', base_config_1.TYPE],
|
||||
['BaseAudioContext', base_config_1.TYPE],
|
||||
['CSSKeyframesRule', base_config_1.TYPE],
|
||||
['CSSNumericArray', base_config_1.TYPE],
|
||||
['CSSRuleList', base_config_1.TYPE],
|
||||
['CSSStyleDeclaration', base_config_1.TYPE],
|
||||
['CSSTransformValue', base_config_1.TYPE],
|
||||
['CSSUnparsedValue', base_config_1.TYPE],
|
||||
['Cache', base_config_1.TYPE],
|
||||
['CanvasPath', base_config_1.TYPE],
|
||||
['CanvasPathDrawingStyles', base_config_1.TYPE],
|
||||
['CookieStoreManager', base_config_1.TYPE],
|
||||
['CustomStateSet', base_config_1.TYPE],
|
||||
['DOMRectList', base_config_1.TYPE],
|
||||
['DOMStringList', base_config_1.TYPE],
|
||||
['DOMTokenList', base_config_1.TYPE],
|
||||
['DataTransferItemList', base_config_1.TYPE],
|
||||
['EventCounts', base_config_1.TYPE],
|
||||
['FileList', base_config_1.TYPE],
|
||||
['FontFaceSet', base_config_1.TYPE],
|
||||
['FormDataIterator', base_config_1.TYPE],
|
||||
['FormData', base_config_1.TYPE],
|
||||
['HTMLAllCollection', base_config_1.TYPE],
|
||||
['HTMLCollectionBase', base_config_1.TYPE],
|
||||
['HTMLCollectionOf', base_config_1.TYPE],
|
||||
['HTMLFormElement', base_config_1.TYPE],
|
||||
['HTMLSelectElement', base_config_1.TYPE],
|
||||
['HeadersIterator', base_config_1.TYPE],
|
||||
['Headers', base_config_1.TYPE],
|
||||
['Highlight', base_config_1.TYPE],
|
||||
['HighlightRegistry', base_config_1.TYPE],
|
||||
['IDBDatabase', base_config_1.TYPE],
|
||||
['IDBObjectStore', base_config_1.TYPE],
|
||||
['ImageTrackList', base_config_1.TYPE],
|
||||
['MIDIInputMap', base_config_1.TYPE],
|
||||
['MIDIOutput', base_config_1.TYPE],
|
||||
['MIDIOutputMap', base_config_1.TYPE],
|
||||
['MediaKeyStatusMapIterator', base_config_1.TYPE],
|
||||
['MediaKeyStatusMap', base_config_1.TYPE],
|
||||
['MediaList', base_config_1.TYPE],
|
||||
['MessageEvent', base_config_1.TYPE],
|
||||
['MimeTypeArray', base_config_1.TYPE],
|
||||
['NamedNodeMap', base_config_1.TYPE],
|
||||
['Navigator', base_config_1.TYPE],
|
||||
['NodeList', base_config_1.TYPE],
|
||||
['NodeListOf', base_config_1.TYPE],
|
||||
['Plugin', base_config_1.TYPE],
|
||||
['PluginArray', base_config_1.TYPE],
|
||||
['RTCRtpTransceiver', base_config_1.TYPE],
|
||||
['RTCStatsReport', base_config_1.TYPE],
|
||||
['SVGLengthList', base_config_1.TYPE],
|
||||
['SVGNumberList', base_config_1.TYPE],
|
||||
['SVGPointList', base_config_1.TYPE],
|
||||
['SVGStringList', base_config_1.TYPE],
|
||||
['SVGTransformList', base_config_1.TYPE],
|
||||
['SourceBufferList', base_config_1.TYPE],
|
||||
['SpeechRecognitionResult', base_config_1.TYPE],
|
||||
['SpeechRecognitionResultList', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnlyIterator', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnly', base_config_1.TYPE],
|
||||
['StyleSheetList', base_config_1.TYPE],
|
||||
['SubtleCrypto', base_config_1.TYPE],
|
||||
['TextTrackCueList', base_config_1.TYPE],
|
||||
['TextTrackList', base_config_1.TYPE],
|
||||
['TouchList', base_config_1.TYPE],
|
||||
['URLSearchParamsIterator', base_config_1.TYPE],
|
||||
['URLSearchParams', base_config_1.TYPE],
|
||||
['ViewTransitionTypeSet', base_config_1.TYPE],
|
||||
['WEBGL_draw_buffers', base_config_1.TYPE],
|
||||
['WEBGL_multi_draw', base_config_1.TYPE],
|
||||
['WebGL2RenderingContextBase', base_config_1.TYPE],
|
||||
['WebGL2RenderingContextOverloads', base_config_1.TYPE],
|
||||
['WebGLRenderingContextBase', base_config_1.TYPE],
|
||||
['WebGLRenderingContextOverloads', base_config_1.TYPE],
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
|
||||
+266
-10
@@ -6,9 +6,12 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dom = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2015_1 = require("./es2015");
|
||||
const es2018_asynciterable_1 = require("./es2018.asynciterable");
|
||||
exports.dom = {
|
||||
libs: [],
|
||||
libs: [es2015_1.es2015, es2018_asynciterable_1.es2018_asynciterable],
|
||||
variables: [
|
||||
['AacEncoderConfig', base_config_1.TYPE],
|
||||
['AddEventListenerOptions', base_config_1.TYPE],
|
||||
['AddressErrors', base_config_1.TYPE],
|
||||
['AesCbcParams', base_config_1.TYPE],
|
||||
@@ -18,6 +21,7 @@ exports.dom = {
|
||||
['AesKeyAlgorithm', base_config_1.TYPE],
|
||||
['AesKeyGenParams', base_config_1.TYPE],
|
||||
['Algorithm', base_config_1.TYPE],
|
||||
['AllAcceptedCredentialsOptions', base_config_1.TYPE],
|
||||
['AnalyserOptions', base_config_1.TYPE],
|
||||
['AnimationEventInit', base_config_1.TYPE],
|
||||
['AnimationPlaybackEventInit', base_config_1.TYPE],
|
||||
@@ -41,14 +45,20 @@ exports.dom = {
|
||||
['AuthenticationExtensionsClientInputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsClientInputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsClientOutputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsClientOutputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsLargeBlobInputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsLargeBlobInputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsLargeBlobOutputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsLargeBlobOutputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFInputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFInputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFOutputs', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFOutputsJSON', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFValues', base_config_1.TYPE],
|
||||
['AuthenticationExtensionsPRFValuesJSON', base_config_1.TYPE],
|
||||
['AuthenticationResponseJSON', base_config_1.TYPE],
|
||||
['AuthenticatorAssertionResponseJSON', base_config_1.TYPE],
|
||||
['AuthenticatorAttestationResponseJSON', base_config_1.TYPE],
|
||||
['AuthenticatorSelectionCriteria', base_config_1.TYPE],
|
||||
['AvcEncoderConfig', base_config_1.TYPE],
|
||||
['BiquadFilterOptions', base_config_1.TYPE],
|
||||
@@ -67,10 +77,12 @@ exports.dom = {
|
||||
['ClipboardEventInit', base_config_1.TYPE],
|
||||
['ClipboardItemOptions', base_config_1.TYPE],
|
||||
['CloseEventInit', base_config_1.TYPE],
|
||||
['CommandEventInit', base_config_1.TYPE],
|
||||
['CompositionEventInit', base_config_1.TYPE],
|
||||
['ComputedEffectTiming', base_config_1.TYPE],
|
||||
['ComputedKeyframe', base_config_1.TYPE],
|
||||
['ConstantSourceOptions', base_config_1.TYPE],
|
||||
['ConstrainBooleanOrDOMStringParameters', base_config_1.TYPE],
|
||||
['ConstrainBooleanParameters', base_config_1.TYPE],
|
||||
['ConstrainDOMStringParameters', base_config_1.TYPE],
|
||||
['ConstrainDoubleRange', base_config_1.TYPE],
|
||||
@@ -86,6 +98,7 @@ exports.dom = {
|
||||
['CredentialPropertiesOutput', base_config_1.TYPE],
|
||||
['CredentialRequestOptions', base_config_1.TYPE],
|
||||
['CryptoKeyPair', base_config_1.TYPE],
|
||||
['CurrentUserDetailsOptions', base_config_1.TYPE],
|
||||
['CustomEventInit', base_config_1.TYPE],
|
||||
['DOMMatrix2DInit', base_config_1.TYPE],
|
||||
['DOMMatrixInit', base_config_1.TYPE],
|
||||
@@ -131,6 +144,67 @@ exports.dom = {
|
||||
['FontFaceSetLoadEventInit', base_config_1.TYPE],
|
||||
['FormDataEventInit', base_config_1.TYPE],
|
||||
['FullscreenOptions', base_config_1.TYPE],
|
||||
['GPUBindGroupDescriptor', base_config_1.TYPE],
|
||||
['GPUBindGroupEntry', base_config_1.TYPE],
|
||||
['GPUBindGroupLayoutDescriptor', base_config_1.TYPE],
|
||||
['GPUBindGroupLayoutEntry', base_config_1.TYPE],
|
||||
['GPUBlendComponent', base_config_1.TYPE],
|
||||
['GPUBlendState', base_config_1.TYPE],
|
||||
['GPUBufferBinding', base_config_1.TYPE],
|
||||
['GPUBufferBindingLayout', base_config_1.TYPE],
|
||||
['GPUBufferDescriptor', base_config_1.TYPE],
|
||||
['GPUCanvasConfiguration', base_config_1.TYPE],
|
||||
['GPUCanvasToneMapping', base_config_1.TYPE],
|
||||
['GPUColorDict', base_config_1.TYPE],
|
||||
['GPUColorTargetState', base_config_1.TYPE],
|
||||
['GPUCommandBufferDescriptor', base_config_1.TYPE],
|
||||
['GPUCommandEncoderDescriptor', base_config_1.TYPE],
|
||||
['GPUComputePassDescriptor', base_config_1.TYPE],
|
||||
['GPUComputePassTimestampWrites', base_config_1.TYPE],
|
||||
['GPUComputePipelineDescriptor', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageDestInfo', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageSourceInfo', base_config_1.TYPE],
|
||||
['GPUDepthStencilState', base_config_1.TYPE],
|
||||
['GPUDeviceDescriptor', base_config_1.TYPE],
|
||||
['GPUExtent3DDict', base_config_1.TYPE],
|
||||
['GPUExternalTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUExternalTextureDescriptor', base_config_1.TYPE],
|
||||
['GPUFragmentState', base_config_1.TYPE],
|
||||
['GPUMultisampleState', base_config_1.TYPE],
|
||||
['GPUObjectDescriptorBase', base_config_1.TYPE],
|
||||
['GPUOrigin2DDict', base_config_1.TYPE],
|
||||
['GPUOrigin3DDict', base_config_1.TYPE],
|
||||
['GPUPipelineDescriptorBase', base_config_1.TYPE],
|
||||
['GPUPipelineErrorInit', base_config_1.TYPE],
|
||||
['GPUPipelineLayoutDescriptor', base_config_1.TYPE],
|
||||
['GPUPrimitiveState', base_config_1.TYPE],
|
||||
['GPUProgrammableStage', base_config_1.TYPE],
|
||||
['GPUQuerySetDescriptor', base_config_1.TYPE],
|
||||
['GPUQueueDescriptor', base_config_1.TYPE],
|
||||
['GPURenderBundleDescriptor', base_config_1.TYPE],
|
||||
['GPURenderBundleEncoderDescriptor', base_config_1.TYPE],
|
||||
['GPURenderPassColorAttachment', base_config_1.TYPE],
|
||||
['GPURenderPassDepthStencilAttachment', base_config_1.TYPE],
|
||||
['GPURenderPassDescriptor', base_config_1.TYPE],
|
||||
['GPURenderPassLayout', base_config_1.TYPE],
|
||||
['GPURenderPassTimestampWrites', base_config_1.TYPE],
|
||||
['GPURenderPipelineDescriptor', base_config_1.TYPE],
|
||||
['GPURequestAdapterOptions', base_config_1.TYPE],
|
||||
['GPUSamplerBindingLayout', base_config_1.TYPE],
|
||||
['GPUSamplerDescriptor', base_config_1.TYPE],
|
||||
['GPUShaderModuleDescriptor', base_config_1.TYPE],
|
||||
['GPUStencilFaceState', base_config_1.TYPE],
|
||||
['GPUStorageTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUTexelCopyBufferInfo', base_config_1.TYPE],
|
||||
['GPUTexelCopyBufferLayout', base_config_1.TYPE],
|
||||
['GPUTexelCopyTextureInfo', base_config_1.TYPE],
|
||||
['GPUTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUTextureDescriptor', base_config_1.TYPE],
|
||||
['GPUTextureViewDescriptor', base_config_1.TYPE],
|
||||
['GPUUncapturedErrorEventInit', base_config_1.TYPE],
|
||||
['GPUVertexAttribute', base_config_1.TYPE],
|
||||
['GPUVertexBufferLayout', base_config_1.TYPE],
|
||||
['GPUVertexState', base_config_1.TYPE],
|
||||
['GainOptions', base_config_1.TYPE],
|
||||
['GamepadEffectParameters', base_config_1.TYPE],
|
||||
['GamepadEventInit', base_config_1.TYPE],
|
||||
@@ -206,7 +280,15 @@ exports.dom = {
|
||||
['MouseEventInit', base_config_1.TYPE],
|
||||
['MultiCacheQueryOptions', base_config_1.TYPE],
|
||||
['MutationObserverInit', base_config_1.TYPE],
|
||||
['NavigateEventInit', base_config_1.TYPE],
|
||||
['NavigationCurrentEntryChangeEventInit', base_config_1.TYPE],
|
||||
['NavigationInterceptOptions', base_config_1.TYPE],
|
||||
['NavigationNavigateOptions', base_config_1.TYPE],
|
||||
['NavigationOptions', base_config_1.TYPE],
|
||||
['NavigationPreloadState', base_config_1.TYPE],
|
||||
['NavigationReloadOptions', base_config_1.TYPE],
|
||||
['NavigationResult', base_config_1.TYPE],
|
||||
['NavigationUpdateCurrentEntryOptions', base_config_1.TYPE],
|
||||
['NotificationOptions', base_config_1.TYPE],
|
||||
['OfflineAudioCompletionEventInit', base_config_1.TYPE],
|
||||
['OfflineAudioContextOptions', base_config_1.TYPE],
|
||||
@@ -309,12 +391,16 @@ exports.dom = {
|
||||
['RTCStats', base_config_1.TYPE],
|
||||
['RTCTrackEventInit', base_config_1.TYPE],
|
||||
['RTCTransportStats', base_config_1.TYPE],
|
||||
['ReadableStreamBYOBReaderReadOptions', base_config_1.TYPE],
|
||||
['ReadableStreamGetReaderOptions', base_config_1.TYPE],
|
||||
['ReadableStreamIteratorOptions', base_config_1.TYPE],
|
||||
['ReadableStreamReadDoneResult', base_config_1.TYPE],
|
||||
['ReadableStreamReadValueResult', base_config_1.TYPE],
|
||||
['ReadableWritablePair', base_config_1.TYPE],
|
||||
['RegistrationOptions', base_config_1.TYPE],
|
||||
['RegistrationResponseJSON', base_config_1.TYPE],
|
||||
['Report', base_config_1.TYPE],
|
||||
['ReportBody', base_config_1.TYPE],
|
||||
['ReportingObserverOptions', base_config_1.TYPE],
|
||||
['RequestInit', base_config_1.TYPE],
|
||||
['ResizeObserverOptions', base_config_1.TYPE],
|
||||
@@ -328,12 +414,21 @@ exports.dom = {
|
||||
['RsaOtherPrimesInfo', base_config_1.TYPE],
|
||||
['RsaPssParams', base_config_1.TYPE],
|
||||
['SVGBoundingBoxOptions', base_config_1.TYPE],
|
||||
['SanitizerAttributeNamespace', base_config_1.TYPE],
|
||||
['SanitizerConfig', base_config_1.TYPE],
|
||||
['SanitizerElementNamespace', base_config_1.TYPE],
|
||||
['SanitizerElementNamespaceWithAttributes', base_config_1.TYPE],
|
||||
['SchedulerPostTaskOptions', base_config_1.TYPE],
|
||||
['ScrollIntoViewOptions', base_config_1.TYPE],
|
||||
['ScrollOptions', base_config_1.TYPE],
|
||||
['ScrollTimelineOptions', base_config_1.TYPE],
|
||||
['ScrollToOptions', base_config_1.TYPE],
|
||||
['SecurityPolicyViolationEventInit', base_config_1.TYPE],
|
||||
['ShadowRootInit', base_config_1.TYPE],
|
||||
['ShareData', base_config_1.TYPE],
|
||||
['ShowPopoverOptions', base_config_1.TYPE],
|
||||
['SpeechRecognitionErrorEventInit', base_config_1.TYPE],
|
||||
['SpeechRecognitionEventInit', base_config_1.TYPE],
|
||||
['SpeechSynthesisErrorEventInit', base_config_1.TYPE],
|
||||
['SpeechSynthesisEventInit', base_config_1.TYPE],
|
||||
['StartViewTransitionOptions', base_config_1.TYPE],
|
||||
@@ -344,10 +439,16 @@ exports.dom = {
|
||||
['StreamPipeOptions', base_config_1.TYPE],
|
||||
['StructuredSerializeOptions', base_config_1.TYPE],
|
||||
['SubmitEventInit', base_config_1.TYPE],
|
||||
['SvcOutputMetadata', base_config_1.TYPE],
|
||||
['TaskControllerInit', base_config_1.TYPE],
|
||||
['TaskPriorityChangeEventInit', base_config_1.TYPE],
|
||||
['TaskSignalAnyInit', base_config_1.TYPE],
|
||||
['TextDecodeOptions', base_config_1.TYPE],
|
||||
['TextDecoderOptions', base_config_1.TYPE],
|
||||
['TextEncoderEncodeIntoResult', base_config_1.TYPE],
|
||||
['TimelineRangeOffset', base_config_1.TYPE],
|
||||
['ToggleEventInit', base_config_1.TYPE],
|
||||
['TogglePopoverOptions', base_config_1.TYPE],
|
||||
['TouchEventInit', base_config_1.TYPE],
|
||||
['TouchInit', base_config_1.TYPE],
|
||||
['TrackEventInit', base_config_1.TYPE],
|
||||
@@ -355,10 +456,15 @@ exports.dom = {
|
||||
['TransitionEventInit', base_config_1.TYPE],
|
||||
['UIEventInit', base_config_1.TYPE],
|
||||
['ULongRange', base_config_1.TYPE],
|
||||
['URLPatternComponentResult', base_config_1.TYPE],
|
||||
['URLPatternInit', base_config_1.TYPE],
|
||||
['URLPatternOptions', base_config_1.TYPE],
|
||||
['URLPatternResult', base_config_1.TYPE],
|
||||
['UnderlyingByteSource', base_config_1.TYPE],
|
||||
['UnderlyingDefaultSource', base_config_1.TYPE],
|
||||
['UnderlyingSink', base_config_1.TYPE],
|
||||
['UnderlyingSource', base_config_1.TYPE],
|
||||
['UnknownCredentialOptions', base_config_1.TYPE],
|
||||
['ValidityStateFlags', base_config_1.TYPE],
|
||||
['VideoColorSpaceInit', base_config_1.TYPE],
|
||||
['VideoConfiguration', base_config_1.TYPE],
|
||||
@@ -374,6 +480,7 @@ exports.dom = {
|
||||
['VideoFrameCallbackMetadata', base_config_1.TYPE],
|
||||
['VideoFrameCopyToOptions', base_config_1.TYPE],
|
||||
['VideoFrameInit', base_config_1.TYPE],
|
||||
['ViewTimelineOptions', base_config_1.TYPE],
|
||||
['WaveShaperOptions', base_config_1.TYPE],
|
||||
['WebGLContextAttributes', base_config_1.TYPE],
|
||||
['WebGLContextEventInit', base_config_1.TYPE],
|
||||
@@ -442,7 +549,6 @@ exports.dom = {
|
||||
['BroadcastChannel', base_config_1.TYPE_VALUE],
|
||||
['ByteLengthQueuingStrategy', base_config_1.TYPE_VALUE],
|
||||
['CDATASection', base_config_1.TYPE_VALUE],
|
||||
['CSPViolationReportBody', base_config_1.TYPE_VALUE],
|
||||
['CSSAnimation', base_config_1.TYPE_VALUE],
|
||||
['CSSConditionRule', base_config_1.TYPE_VALUE],
|
||||
['CSSContainerRule', base_config_1.TYPE_VALUE],
|
||||
@@ -472,8 +578,11 @@ exports.dom = {
|
||||
['CSSNestedDeclarations', base_config_1.TYPE_VALUE],
|
||||
['CSSNumericArray', base_config_1.TYPE_VALUE],
|
||||
['CSSNumericValue', base_config_1.TYPE_VALUE],
|
||||
['CSSPageDescriptors', base_config_1.TYPE_VALUE],
|
||||
['CSSPageRule', base_config_1.TYPE_VALUE],
|
||||
['CSSPerspective', base_config_1.TYPE_VALUE],
|
||||
['CSSPositionTryDescriptors', base_config_1.TYPE_VALUE],
|
||||
['CSSPositionTryRule', base_config_1.TYPE_VALUE],
|
||||
['CSSPropertyRule', base_config_1.TYPE_VALUE],
|
||||
['CSSRotate', base_config_1.TYPE_VALUE],
|
||||
['CSSRule', base_config_1.TYPE_VALUE],
|
||||
@@ -484,7 +593,9 @@ exports.dom = {
|
||||
['CSSSkewX', base_config_1.TYPE_VALUE],
|
||||
['CSSSkewY', base_config_1.TYPE_VALUE],
|
||||
['CSSStartingStyleRule', base_config_1.TYPE_VALUE],
|
||||
['CSSStyleDeclarationBase', base_config_1.TYPE],
|
||||
['CSSStyleDeclaration', base_config_1.TYPE_VALUE],
|
||||
['CSSStyleProperties', base_config_1.TYPE_VALUE],
|
||||
['CSSStyleRule', base_config_1.TYPE_VALUE],
|
||||
['CSSStyleSheet', base_config_1.TYPE_VALUE],
|
||||
['CSSStyleValue', base_config_1.TYPE_VALUE],
|
||||
@@ -530,6 +641,7 @@ exports.dom = {
|
||||
['ClipboardEvent', base_config_1.TYPE_VALUE],
|
||||
['ClipboardItem', base_config_1.TYPE_VALUE],
|
||||
['CloseEvent', base_config_1.TYPE_VALUE],
|
||||
['CommandEvent', base_config_1.TYPE_VALUE],
|
||||
['Comment', base_config_1.TYPE_VALUE],
|
||||
['CompositionEvent', base_config_1.TYPE_VALUE],
|
||||
['CompressionStream', base_config_1.TYPE_VALUE],
|
||||
@@ -575,6 +687,7 @@ exports.dom = {
|
||||
['DeviceMotionEventAcceleration', base_config_1.TYPE],
|
||||
['DeviceMotionEventRotationRate', base_config_1.TYPE],
|
||||
['DeviceOrientationEvent', base_config_1.TYPE_VALUE],
|
||||
['DigitalCredential', base_config_1.TYPE_VALUE],
|
||||
['DocumentEventMap', base_config_1.TYPE],
|
||||
['Document', base_config_1.TYPE_VALUE],
|
||||
['DocumentFragment', base_config_1.TYPE_VALUE],
|
||||
@@ -632,7 +745,47 @@ exports.dom = {
|
||||
['FormData', base_config_1.TYPE_VALUE],
|
||||
['FormDataEvent', base_config_1.TYPE_VALUE],
|
||||
['FragmentDirective', base_config_1.TYPE_VALUE],
|
||||
['GPUError', base_config_1.TYPE],
|
||||
['GPU', base_config_1.TYPE_VALUE],
|
||||
['GPUAdapter', base_config_1.TYPE_VALUE],
|
||||
['GPUAdapterInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUBindGroup', base_config_1.TYPE_VALUE],
|
||||
['GPUBindGroupLayout', base_config_1.TYPE_VALUE],
|
||||
['GPUBindingCommandsMixin', base_config_1.TYPE],
|
||||
['GPUBuffer', base_config_1.TYPE_VALUE],
|
||||
['GPUCanvasContext', base_config_1.TYPE_VALUE],
|
||||
['GPUCommandBuffer', base_config_1.TYPE_VALUE],
|
||||
['GPUCommandEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPUCompilationInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUCompilationMessage', base_config_1.TYPE_VALUE],
|
||||
['GPUComputePassEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPUComputePipeline', base_config_1.TYPE_VALUE],
|
||||
['GPUDebugCommandsMixin', base_config_1.TYPE],
|
||||
['GPUDeviceEventMap', base_config_1.TYPE],
|
||||
['GPUDevice', base_config_1.TYPE_VALUE],
|
||||
['GPUDeviceLostInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUError', base_config_1.TYPE_VALUE],
|
||||
['GPUExternalTexture', base_config_1.TYPE_VALUE],
|
||||
['GPUInternalError', base_config_1.TYPE_VALUE],
|
||||
['GPUObjectBase', base_config_1.TYPE],
|
||||
['GPUOutOfMemoryError', base_config_1.TYPE_VALUE],
|
||||
['GPUPipelineBase', base_config_1.TYPE],
|
||||
['GPUPipelineError', base_config_1.TYPE_VALUE],
|
||||
['GPUPipelineLayout', base_config_1.TYPE_VALUE],
|
||||
['GPUQuerySet', base_config_1.TYPE_VALUE],
|
||||
['GPUQueue', base_config_1.TYPE_VALUE],
|
||||
['GPURenderBundle', base_config_1.TYPE_VALUE],
|
||||
['GPURenderBundleEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPURenderCommandsMixin', base_config_1.TYPE],
|
||||
['GPURenderPassEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPURenderPipeline', base_config_1.TYPE_VALUE],
|
||||
['GPUSampler', base_config_1.TYPE_VALUE],
|
||||
['GPUShaderModule', base_config_1.TYPE_VALUE],
|
||||
['GPUSupportedFeatures', base_config_1.TYPE_VALUE],
|
||||
['GPUSupportedLimits', base_config_1.TYPE_VALUE],
|
||||
['GPUTexture', base_config_1.TYPE_VALUE],
|
||||
['GPUTextureView', base_config_1.TYPE_VALUE],
|
||||
['GPUUncapturedErrorEvent', base_config_1.TYPE_VALUE],
|
||||
['GPUValidationError', base_config_1.TYPE_VALUE],
|
||||
['GainNode', base_config_1.TYPE_VALUE],
|
||||
['Gamepad', base_config_1.TYPE_VALUE],
|
||||
['GamepadButton', base_config_1.TYPE_VALUE],
|
||||
@@ -830,16 +983,24 @@ exports.dom = {
|
||||
['MutationObserver', base_config_1.TYPE_VALUE],
|
||||
['MutationRecord', base_config_1.TYPE_VALUE],
|
||||
['NamedNodeMap', base_config_1.TYPE_VALUE],
|
||||
['NavigateEvent', base_config_1.TYPE_VALUE],
|
||||
['NavigationEventMap', base_config_1.TYPE],
|
||||
['Navigation', base_config_1.TYPE_VALUE],
|
||||
['NavigationActivation', base_config_1.TYPE_VALUE],
|
||||
['NavigationCurrentEntryChangeEvent', base_config_1.TYPE_VALUE],
|
||||
['NavigationDestination', base_config_1.TYPE_VALUE],
|
||||
['NavigationHistoryEntryEventMap', base_config_1.TYPE],
|
||||
['NavigationHistoryEntry', base_config_1.TYPE_VALUE],
|
||||
['NavigationPrecommitController', base_config_1.TYPE_VALUE],
|
||||
['NavigationPreloadManager', base_config_1.TYPE_VALUE],
|
||||
['NavigationTransition', base_config_1.TYPE_VALUE],
|
||||
['Navigator', base_config_1.TYPE_VALUE],
|
||||
['NavigatorAutomationInformation', base_config_1.TYPE],
|
||||
['NavigatorBadge', base_config_1.TYPE],
|
||||
['NavigatorConcurrentHardware', base_config_1.TYPE],
|
||||
['NavigatorContentUtils', base_config_1.TYPE],
|
||||
['NavigatorCookies', base_config_1.TYPE],
|
||||
['NavigatorGPU', base_config_1.TYPE],
|
||||
['NavigatorID', base_config_1.TYPE],
|
||||
['NavigatorLanguage', base_config_1.TYPE],
|
||||
['NavigatorLocks', base_config_1.TYPE],
|
||||
@@ -876,6 +1037,7 @@ exports.dom = {
|
||||
['PageRevealEvent', base_config_1.TYPE_VALUE],
|
||||
['PageSwapEvent', base_config_1.TYPE_VALUE],
|
||||
['PageTransitionEvent', base_config_1.TYPE_VALUE],
|
||||
['PaintTimingMixin', base_config_1.TYPE],
|
||||
['PannerNode', base_config_1.TYPE_VALUE],
|
||||
['ParentNode', base_config_1.TYPE],
|
||||
['Path2D', base_config_1.TYPE_VALUE],
|
||||
@@ -911,12 +1073,13 @@ exports.dom = {
|
||||
['PluginArray', base_config_1.TYPE_VALUE],
|
||||
['PointerEvent', base_config_1.TYPE_VALUE],
|
||||
['PopStateEvent', base_config_1.TYPE_VALUE],
|
||||
['PopoverInvokerElement', base_config_1.TYPE],
|
||||
['PopoverTargetAttributes', base_config_1.TYPE],
|
||||
['ProcessingInstruction', base_config_1.TYPE_VALUE],
|
||||
['ProgressEvent', base_config_1.TYPE_VALUE],
|
||||
['PromiseRejectionEvent', base_config_1.TYPE_VALUE],
|
||||
['PublicKeyCredential', base_config_1.TYPE_VALUE],
|
||||
['PushManager', base_config_1.TYPE_VALUE],
|
||||
['PushManagerAttribute', base_config_1.TYPE],
|
||||
['PushSubscription', base_config_1.TYPE_VALUE],
|
||||
['PushSubscriptionOptions', base_config_1.TYPE_VALUE],
|
||||
['RTCCertificate', base_config_1.TYPE_VALUE],
|
||||
@@ -960,8 +1123,6 @@ exports.dom = {
|
||||
['ReadableStreamGenericReader', base_config_1.TYPE],
|
||||
['RemotePlaybackEventMap', base_config_1.TYPE],
|
||||
['RemotePlayback', base_config_1.TYPE_VALUE],
|
||||
['Report', base_config_1.TYPE_VALUE],
|
||||
['ReportBody', base_config_1.TYPE_VALUE],
|
||||
['ReportingObserver', base_config_1.TYPE_VALUE],
|
||||
['Request', base_config_1.TYPE_VALUE],
|
||||
['ResizeObserver', base_config_1.TYPE_VALUE],
|
||||
@@ -1069,11 +1230,14 @@ exports.dom = {
|
||||
['SVGUnitTypes', base_config_1.TYPE_VALUE],
|
||||
['SVGUseElement', base_config_1.TYPE_VALUE],
|
||||
['SVGViewElement', base_config_1.TYPE_VALUE],
|
||||
['Sanitizer', base_config_1.TYPE_VALUE],
|
||||
['Scheduler', base_config_1.TYPE_VALUE],
|
||||
['Screen', base_config_1.TYPE_VALUE],
|
||||
['ScreenOrientationEventMap', base_config_1.TYPE],
|
||||
['ScreenOrientation', base_config_1.TYPE_VALUE],
|
||||
['ScriptProcessorNodeEventMap', base_config_1.TYPE],
|
||||
['ScriptProcessorNode', base_config_1.TYPE_VALUE],
|
||||
['ScrollTimeline', base_config_1.TYPE_VALUE],
|
||||
['SecurityPolicyViolationEvent', base_config_1.TYPE_VALUE],
|
||||
['Selection', base_config_1.TYPE_VALUE],
|
||||
['ServiceWorkerEventMap', base_config_1.TYPE],
|
||||
@@ -1091,6 +1255,8 @@ exports.dom = {
|
||||
['SourceBufferListEventMap', base_config_1.TYPE],
|
||||
['SourceBufferList', base_config_1.TYPE_VALUE],
|
||||
['SpeechRecognitionAlternative', base_config_1.TYPE_VALUE],
|
||||
['SpeechRecognitionErrorEvent', base_config_1.TYPE_VALUE],
|
||||
['SpeechRecognitionEvent', base_config_1.TYPE_VALUE],
|
||||
['SpeechRecognitionResult', base_config_1.TYPE_VALUE],
|
||||
['SpeechRecognitionResultList', base_config_1.TYPE_VALUE],
|
||||
['SpeechSynthesisEventMap', base_config_1.TYPE],
|
||||
@@ -1105,13 +1271,16 @@ exports.dom = {
|
||||
['Storage', base_config_1.TYPE_VALUE],
|
||||
['StorageEvent', base_config_1.TYPE_VALUE],
|
||||
['StorageManager', base_config_1.TYPE_VALUE],
|
||||
['StyleMedia', base_config_1.TYPE],
|
||||
['StylePropertyMap', base_config_1.TYPE_VALUE],
|
||||
['StylePropertyMapReadOnly', base_config_1.TYPE_VALUE],
|
||||
['StyleSheet', base_config_1.TYPE_VALUE],
|
||||
['StyleSheetList', base_config_1.TYPE_VALUE],
|
||||
['SubmitEvent', base_config_1.TYPE_VALUE],
|
||||
['SubtleCrypto', base_config_1.TYPE_VALUE],
|
||||
['TaskController', base_config_1.TYPE_VALUE],
|
||||
['TaskPriorityChangeEvent', base_config_1.TYPE_VALUE],
|
||||
['TaskSignalEventMap', base_config_1.TYPE],
|
||||
['TaskSignal', base_config_1.TYPE_VALUE],
|
||||
['Text', base_config_1.TYPE_VALUE],
|
||||
['TextDecoder', base_config_1.TYPE_VALUE],
|
||||
['TextDecoderCommon', base_config_1.TYPE],
|
||||
@@ -1141,6 +1310,7 @@ exports.dom = {
|
||||
['UIEvent', base_config_1.TYPE_VALUE],
|
||||
['URL', base_config_1.TYPE_VALUE],
|
||||
['webkitURL', base_config_1.TYPE_VALUE],
|
||||
['URLPattern', base_config_1.TYPE_VALUE],
|
||||
['URLSearchParams', base_config_1.TYPE_VALUE],
|
||||
['UserActivation', base_config_1.TYPE_VALUE],
|
||||
['VTTCue', base_config_1.TYPE_VALUE],
|
||||
@@ -1153,6 +1323,7 @@ exports.dom = {
|
||||
['VideoEncoder', base_config_1.TYPE_VALUE],
|
||||
['VideoFrame', base_config_1.TYPE_VALUE],
|
||||
['VideoPlaybackQuality', base_config_1.TYPE_VALUE],
|
||||
['ViewTimeline', base_config_1.TYPE_VALUE],
|
||||
['ViewTransition', base_config_1.TYPE_VALUE],
|
||||
['ViewTransitionTypeSet', base_config_1.TYPE_VALUE],
|
||||
['VisualViewportEventMap', base_config_1.TYPE],
|
||||
@@ -1170,6 +1341,7 @@ exports.dom = {
|
||||
['WEBGL_draw_buffers', base_config_1.TYPE],
|
||||
['WEBGL_lose_context', base_config_1.TYPE],
|
||||
['WEBGL_multi_draw', base_config_1.TYPE],
|
||||
['WGSLLanguageFeatures', base_config_1.TYPE_VALUE],
|
||||
['WakeLock', base_config_1.TYPE_VALUE],
|
||||
['WakeLockSentinelEventMap', base_config_1.TYPE],
|
||||
['WakeLockSentinel', base_config_1.TYPE_VALUE],
|
||||
@@ -1249,6 +1421,8 @@ exports.dom = {
|
||||
['LockGrantedCallback', base_config_1.TYPE],
|
||||
['MediaSessionActionHandler', base_config_1.TYPE],
|
||||
['MutationCallback', base_config_1.TYPE],
|
||||
['NavigationInterceptHandler', base_config_1.TYPE],
|
||||
['NavigationPrecommitHandler', base_config_1.TYPE],
|
||||
['NotificationPermissionCallback', base_config_1.TYPE],
|
||||
['OnBeforeUnloadEventHandlerNonNull', base_config_1.TYPE],
|
||||
['OnErrorEventHandlerNonNull', base_config_1.TYPE],
|
||||
@@ -1261,6 +1435,7 @@ exports.dom = {
|
||||
['RemotePlaybackAvailabilityCallback', base_config_1.TYPE],
|
||||
['ReportingObserverCallback', base_config_1.TYPE],
|
||||
['ResizeObserverCallback', base_config_1.TYPE],
|
||||
['SchedulerPostTaskCallback', base_config_1.TYPE],
|
||||
['TransformerFlushCallback', base_config_1.TYPE],
|
||||
['TransformerStartCallback', base_config_1.TYPE],
|
||||
['TransformerTransformCallback', base_config_1.TYPE],
|
||||
@@ -1300,6 +1475,7 @@ exports.dom = {
|
||||
['ClipboardItemData', base_config_1.TYPE],
|
||||
['ClipboardItems', base_config_1.TYPE],
|
||||
['ConstrainBoolean', base_config_1.TYPE],
|
||||
['ConstrainBooleanOrDOMString', base_config_1.TYPE],
|
||||
['ConstrainDOMString', base_config_1.TYPE],
|
||||
['ConstrainDouble', base_config_1.TYPE],
|
||||
['ConstrainULong', base_config_1.TYPE],
|
||||
@@ -1322,6 +1498,31 @@ exports.dom = {
|
||||
['GLsizeiptr', base_config_1.TYPE],
|
||||
['GLuint', base_config_1.TYPE],
|
||||
['GLuint64', base_config_1.TYPE],
|
||||
['GPUBindingResource', base_config_1.TYPE],
|
||||
['GPUBufferDynamicOffset', base_config_1.TYPE],
|
||||
['GPUBufferUsageFlags', base_config_1.TYPE],
|
||||
['GPUColor', base_config_1.TYPE],
|
||||
['GPUColorWriteFlags', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageSource', base_config_1.TYPE],
|
||||
['GPUDepthBias', base_config_1.TYPE],
|
||||
['GPUExtent3D', base_config_1.TYPE],
|
||||
['GPUFlagsConstant', base_config_1.TYPE],
|
||||
['GPUIndex32', base_config_1.TYPE],
|
||||
['GPUIntegerCoordinate', base_config_1.TYPE],
|
||||
['GPUIntegerCoordinateOut', base_config_1.TYPE],
|
||||
['GPUMapModeFlags', base_config_1.TYPE],
|
||||
['GPUOrigin2D', base_config_1.TYPE],
|
||||
['GPUOrigin3D', base_config_1.TYPE],
|
||||
['GPUPipelineConstantValue', base_config_1.TYPE],
|
||||
['GPUSampleMask', base_config_1.TYPE],
|
||||
['GPUShaderStageFlags', base_config_1.TYPE],
|
||||
['GPUSignedOffset32', base_config_1.TYPE],
|
||||
['GPUSize32', base_config_1.TYPE],
|
||||
['GPUSize32Out', base_config_1.TYPE],
|
||||
['GPUSize64', base_config_1.TYPE],
|
||||
['GPUSize64Out', base_config_1.TYPE],
|
||||
['GPUStencilValue', base_config_1.TYPE],
|
||||
['GPUTextureUsageFlags', base_config_1.TYPE],
|
||||
['HTMLOrSVGImageElement', base_config_1.TYPE],
|
||||
['HTMLOrSVGScriptElement', base_config_1.TYPE],
|
||||
['HashAlgorithmIdentifier', base_config_1.TYPE],
|
||||
@@ -1343,21 +1544,27 @@ exports.dom = {
|
||||
['OptionalPrefixToken', base_config_1.TYPE],
|
||||
['PerformanceEntryList', base_config_1.TYPE],
|
||||
['PublicKeyCredentialClientCapabilities', base_config_1.TYPE],
|
||||
['PublicKeyCredentialJSON', base_config_1.TYPE],
|
||||
['RTCRtpTransform', base_config_1.TYPE],
|
||||
['RTCRtpReceiverTransform', base_config_1.TYPE],
|
||||
['RTCRtpSenderTransform', base_config_1.TYPE],
|
||||
['ReadableStreamController', base_config_1.TYPE],
|
||||
['ReadableStreamReadResult', base_config_1.TYPE],
|
||||
['ReadableStreamReader', base_config_1.TYPE],
|
||||
['RenderingContext', base_config_1.TYPE],
|
||||
['ReportList', base_config_1.TYPE],
|
||||
['RequestInfo', base_config_1.TYPE],
|
||||
['SanitizerAttribute', base_config_1.TYPE],
|
||||
['SanitizerElement', base_config_1.TYPE],
|
||||
['SanitizerElementWithAttributes', base_config_1.TYPE],
|
||||
['SelectionDirection', base_config_1.TYPE],
|
||||
['TexImageSource', base_config_1.TYPE],
|
||||
['TimerHandler', base_config_1.TYPE],
|
||||
['Transferable', base_config_1.TYPE],
|
||||
['URLPatternInput', base_config_1.TYPE],
|
||||
['Uint32List', base_config_1.TYPE],
|
||||
['VibratePattern', base_config_1.TYPE],
|
||||
['WindowProxy', base_config_1.TYPE],
|
||||
['XMLHttpRequestBodyInit', base_config_1.TYPE],
|
||||
['AacBitstreamFormat', base_config_1.TYPE],
|
||||
['AlignSetting', base_config_1.TYPE],
|
||||
['AlphaOption', base_config_1.TYPE],
|
||||
['AnimationPlayState', base_config_1.TYPE],
|
||||
@@ -1422,6 +1629,40 @@ exports.dom = {
|
||||
['FontFaceLoadStatus', base_config_1.TYPE],
|
||||
['FontFaceSetLoadStatus', base_config_1.TYPE],
|
||||
['FullscreenNavigationUI', base_config_1.TYPE],
|
||||
['GPUAddressMode', base_config_1.TYPE],
|
||||
['GPUAutoLayoutMode', base_config_1.TYPE],
|
||||
['GPUBlendFactor', base_config_1.TYPE],
|
||||
['GPUBlendOperation', base_config_1.TYPE],
|
||||
['GPUBufferBindingType', base_config_1.TYPE],
|
||||
['GPUBufferMapState', base_config_1.TYPE],
|
||||
['GPUCanvasAlphaMode', base_config_1.TYPE],
|
||||
['GPUCanvasToneMappingMode', base_config_1.TYPE],
|
||||
['GPUCompareFunction', base_config_1.TYPE],
|
||||
['GPUCompilationMessageType', base_config_1.TYPE],
|
||||
['GPUCullMode', base_config_1.TYPE],
|
||||
['GPUDeviceLostReason', base_config_1.TYPE],
|
||||
['GPUErrorFilter', base_config_1.TYPE],
|
||||
['GPUFeatureName', base_config_1.TYPE],
|
||||
['GPUFilterMode', base_config_1.TYPE],
|
||||
['GPUFrontFace', base_config_1.TYPE],
|
||||
['GPUIndexFormat', base_config_1.TYPE],
|
||||
['GPULoadOp', base_config_1.TYPE],
|
||||
['GPUMipmapFilterMode', base_config_1.TYPE],
|
||||
['GPUPipelineErrorReason', base_config_1.TYPE],
|
||||
['GPUPowerPreference', base_config_1.TYPE],
|
||||
['GPUPrimitiveTopology', base_config_1.TYPE],
|
||||
['GPUQueryType', base_config_1.TYPE],
|
||||
['GPUSamplerBindingType', base_config_1.TYPE],
|
||||
['GPUStencilOperation', base_config_1.TYPE],
|
||||
['GPUStorageTextureAccess', base_config_1.TYPE],
|
||||
['GPUStoreOp', base_config_1.TYPE],
|
||||
['GPUTextureAspect', base_config_1.TYPE],
|
||||
['GPUTextureDimension', base_config_1.TYPE],
|
||||
['GPUTextureFormat', base_config_1.TYPE],
|
||||
['GPUTextureSampleType', base_config_1.TYPE],
|
||||
['GPUTextureViewDimension', base_config_1.TYPE],
|
||||
['GPUVertexFormat', base_config_1.TYPE],
|
||||
['GPUVertexStepMode', base_config_1.TYPE],
|
||||
['GamepadHapticEffectType', base_config_1.TYPE],
|
||||
['GamepadHapticsResult', base_config_1.TYPE],
|
||||
['GamepadMappingType', base_config_1.TYPE],
|
||||
@@ -1433,6 +1674,7 @@ exports.dom = {
|
||||
['IDBRequestReadyState', base_config_1.TYPE],
|
||||
['IDBTransactionDurability', base_config_1.TYPE],
|
||||
['IDBTransactionMode', base_config_1.TYPE],
|
||||
['ImageDataPixelFormat', base_config_1.TYPE],
|
||||
['ImageOrientation', base_config_1.TYPE],
|
||||
['ImageSmoothingQuality', base_config_1.TYPE],
|
||||
['InsertPosition', base_config_1.TYPE],
|
||||
@@ -1458,12 +1700,16 @@ exports.dom = {
|
||||
['MediaSessionAction', base_config_1.TYPE],
|
||||
['MediaSessionPlaybackState', base_config_1.TYPE],
|
||||
['MediaStreamTrackState', base_config_1.TYPE],
|
||||
['NavigationFocusReset', base_config_1.TYPE],
|
||||
['NavigationHistoryBehavior', base_config_1.TYPE],
|
||||
['NavigationScrollBehavior', base_config_1.TYPE],
|
||||
['NavigationTimingType', base_config_1.TYPE],
|
||||
['NavigationType', base_config_1.TYPE],
|
||||
['NotificationDirection', base_config_1.TYPE],
|
||||
['NotificationPermission', base_config_1.TYPE],
|
||||
['OffscreenRenderingContextId', base_config_1.TYPE],
|
||||
['OpusBitstreamFormat', base_config_1.TYPE],
|
||||
['OrientationLockType', base_config_1.TYPE],
|
||||
['OrientationType', base_config_1.TYPE],
|
||||
['OscillatorType', base_config_1.TYPE],
|
||||
['OverSampleType', base_config_1.TYPE],
|
||||
@@ -1484,7 +1730,6 @@ exports.dom = {
|
||||
['RTCDegradationPreference', base_config_1.TYPE],
|
||||
['RTCDtlsRole', base_config_1.TYPE],
|
||||
['RTCDtlsTransportState', base_config_1.TYPE],
|
||||
['RTCEncodedVideoFrameType', base_config_1.TYPE],
|
||||
['RTCErrorDetailType', base_config_1.TYPE],
|
||||
['RTCIceCandidateType', base_config_1.TYPE],
|
||||
['RTCIceComponent', base_config_1.TYPE],
|
||||
@@ -1523,6 +1768,8 @@ exports.dom = {
|
||||
['ResizeObserverBoxOptions', base_config_1.TYPE],
|
||||
['ResizeQuality', base_config_1.TYPE],
|
||||
['ResponseType', base_config_1.TYPE],
|
||||
['SanitizerPresets', base_config_1.TYPE],
|
||||
['ScrollAxis', base_config_1.TYPE],
|
||||
['ScrollBehavior', base_config_1.TYPE],
|
||||
['ScrollLogicalPosition', base_config_1.TYPE],
|
||||
['ScrollRestoration', base_config_1.TYPE],
|
||||
@@ -1533,7 +1780,9 @@ exports.dom = {
|
||||
['ServiceWorkerUpdateViaCache', base_config_1.TYPE],
|
||||
['ShadowRootMode', base_config_1.TYPE],
|
||||
['SlotAssignmentMode', base_config_1.TYPE],
|
||||
['SpeechRecognitionErrorCode', base_config_1.TYPE],
|
||||
['SpeechSynthesisErrorCode', base_config_1.TYPE],
|
||||
['TaskPriority', base_config_1.TYPE],
|
||||
['TextTrackKind', base_config_1.TYPE],
|
||||
['TextTrackMode', base_config_1.TYPE],
|
||||
['TouchType', base_config_1.TYPE],
|
||||
@@ -1552,5 +1801,12 @@ exports.dom = {
|
||||
['WorkerType', base_config_1.TYPE],
|
||||
['WriteCommandType', base_config_1.TYPE],
|
||||
['XMLHttpRequestResponseType', base_config_1.TYPE],
|
||||
['FormDataIterator', base_config_1.TYPE],
|
||||
['HeadersIterator', base_config_1.TYPE],
|
||||
['MediaKeyStatusMapIterator', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnlyIterator', base_config_1.TYPE],
|
||||
['URLSearchParamsIterator', base_config_1.TYPE],
|
||||
['FileSystemDirectoryHandleAsyncIterator', base_config_1.TYPE],
|
||||
['ReadableStreamAsyncIterator', base_config_1.TYPE],
|
||||
],
|
||||
};
|
||||
|
||||
+4
-5
@@ -6,12 +6,11 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.esnext_collection = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2024_collection_1 = require("./es2024.collection");
|
||||
const es2025_collection_1 = require("./es2025.collection");
|
||||
exports.esnext_collection = {
|
||||
libs: [es2024_collection_1.es2024_collection],
|
||||
libs: [es2025_collection_1.es2025_collection],
|
||||
variables: [
|
||||
['ReadonlySetLike', base_config_1.TYPE],
|
||||
['Set', base_config_1.TYPE],
|
||||
['ReadonlySet', base_config_1.TYPE],
|
||||
['Map', base_config_1.TYPE],
|
||||
['WeakMap', base_config_1.TYPE],
|
||||
],
|
||||
};
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.esnext_intl = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const esnext_temporal_1 = require("./esnext.temporal");
|
||||
exports.esnext_intl = {
|
||||
libs: [],
|
||||
libs: [esnext_temporal_1.esnext_temporal],
|
||||
variables: [['Intl', base_config_1.TYPE_VALUE]],
|
||||
};
|
||||
|
||||
+9
-9
@@ -5,30 +5,30 @@
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.esnext = void 0;
|
||||
const es2024_1 = require("./es2024");
|
||||
const es2025_1 = require("./es2025");
|
||||
const esnext_array_1 = require("./esnext.array");
|
||||
const esnext_collection_1 = require("./esnext.collection");
|
||||
const esnext_date_1 = require("./esnext.date");
|
||||
const esnext_decorators_1 = require("./esnext.decorators");
|
||||
const esnext_disposable_1 = require("./esnext.disposable");
|
||||
const esnext_error_1 = require("./esnext.error");
|
||||
const esnext_float16_1 = require("./esnext.float16");
|
||||
const esnext_intl_1 = require("./esnext.intl");
|
||||
const esnext_iterator_1 = require("./esnext.iterator");
|
||||
const esnext_promise_1 = require("./esnext.promise");
|
||||
const esnext_sharedmemory_1 = require("./esnext.sharedmemory");
|
||||
const esnext_temporal_1 = require("./esnext.temporal");
|
||||
const esnext_typedarrays_1 = require("./esnext.typedarrays");
|
||||
exports.esnext = {
|
||||
libs: [
|
||||
es2024_1.es2024,
|
||||
es2025_1.es2025,
|
||||
esnext_intl_1.esnext_intl,
|
||||
esnext_collection_1.esnext_collection,
|
||||
esnext_decorators_1.esnext_decorators,
|
||||
esnext_disposable_1.esnext_disposable,
|
||||
esnext_collection_1.esnext_collection,
|
||||
esnext_array_1.esnext_array,
|
||||
esnext_iterator_1.esnext_iterator,
|
||||
esnext_promise_1.esnext_promise,
|
||||
esnext_float16_1.esnext_float16,
|
||||
esnext_error_1.esnext_error,
|
||||
esnext_sharedmemory_1.esnext_sharedmemory,
|
||||
esnext_typedarrays_1.esnext_typedarrays,
|
||||
esnext_temporal_1.esnext_temporal,
|
||||
esnext_date_1.esnext_date,
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
|
||||
+31
-9
@@ -88,11 +88,20 @@ const es2024_promise_1 = require("./es2024.promise");
|
||||
const es2024_regexp_1 = require("./es2024.regexp");
|
||||
const es2024_sharedmemory_1 = require("./es2024.sharedmemory");
|
||||
const es2024_string_1 = require("./es2024.string");
|
||||
const es2025_1 = require("./es2025");
|
||||
const es2025_collection_1 = require("./es2025.collection");
|
||||
const es2025_float16_1 = require("./es2025.float16");
|
||||
const es2025_full_1 = require("./es2025.full");
|
||||
const es2025_intl_1 = require("./es2025.intl");
|
||||
const es2025_iterator_1 = require("./es2025.iterator");
|
||||
const es2025_promise_1 = require("./es2025.promise");
|
||||
const es2025_regexp_1 = require("./es2025.regexp");
|
||||
const esnext_1 = require("./esnext");
|
||||
const esnext_array_1 = require("./esnext.array");
|
||||
const esnext_asynciterable_1 = require("./esnext.asynciterable");
|
||||
const esnext_bigint_1 = require("./esnext.bigint");
|
||||
const esnext_collection_1 = require("./esnext.collection");
|
||||
const esnext_date_1 = require("./esnext.date");
|
||||
const esnext_decorators_1 = require("./esnext.decorators");
|
||||
const esnext_disposable_1 = require("./esnext.disposable");
|
||||
const esnext_error_1 = require("./esnext.error");
|
||||
@@ -106,6 +115,8 @@ const esnext_regexp_1 = require("./esnext.regexp");
|
||||
const esnext_sharedmemory_1 = require("./esnext.sharedmemory");
|
||||
const esnext_string_1 = require("./esnext.string");
|
||||
const esnext_symbol_1 = require("./esnext.symbol");
|
||||
const esnext_temporal_1 = require("./esnext.temporal");
|
||||
const esnext_typedarrays_1 = require("./esnext.typedarrays");
|
||||
const esnext_weakref_1 = require("./esnext.weakref");
|
||||
const lib_1 = require("./lib");
|
||||
const scripthost_1 = require("./scripthost");
|
||||
@@ -127,6 +138,7 @@ exports.lib = new Map([
|
||||
['es2022', es2022_1.es2022],
|
||||
['es2023', es2023_1.es2023],
|
||||
['es2024', es2024_1.es2024],
|
||||
['es2025', es2025_1.es2025],
|
||||
['esnext', esnext_1.esnext],
|
||||
['dom', dom_1.dom],
|
||||
['dom.iterable', dom_iterable_1.dom_iterable],
|
||||
@@ -192,23 +204,32 @@ exports.lib = new Map([
|
||||
['es2024.regexp', es2024_regexp_1.es2024_regexp],
|
||||
['es2024.sharedmemory', es2024_sharedmemory_1.es2024_sharedmemory],
|
||||
['es2024.string', es2024_string_1.es2024_string],
|
||||
['esnext.array', esnext_array_1.esnext_array],
|
||||
['esnext.collection', esnext_collection_1.esnext_collection],
|
||||
['esnext.symbol', esnext_symbol_1.esnext_symbol],
|
||||
['es2025.collection', es2025_collection_1.es2025_collection],
|
||||
['es2025.float16', es2025_float16_1.es2025_float16],
|
||||
['es2025.intl', es2025_intl_1.es2025_intl],
|
||||
['es2025.iterator', es2025_iterator_1.es2025_iterator],
|
||||
['es2025.promise', es2025_promise_1.es2025_promise],
|
||||
['es2025.regexp', es2025_regexp_1.es2025_regexp],
|
||||
['esnext.asynciterable', esnext_asynciterable_1.esnext_asynciterable],
|
||||
['esnext.intl', esnext_intl_1.esnext_intl],
|
||||
['esnext.disposable', esnext_disposable_1.esnext_disposable],
|
||||
['esnext.symbol', esnext_symbol_1.esnext_symbol],
|
||||
['esnext.bigint', esnext_bigint_1.esnext_bigint],
|
||||
['esnext.string', esnext_string_1.esnext_string],
|
||||
['esnext.promise', esnext_promise_1.esnext_promise],
|
||||
['esnext.weakref', esnext_weakref_1.esnext_weakref],
|
||||
['esnext.decorators', esnext_decorators_1.esnext_decorators],
|
||||
['esnext.object', esnext_object_1.esnext_object],
|
||||
['esnext.regexp', esnext_regexp_1.esnext_regexp],
|
||||
['esnext.iterator', esnext_iterator_1.esnext_iterator],
|
||||
['esnext.string', esnext_string_1.esnext_string],
|
||||
['esnext.float16', esnext_float16_1.esnext_float16],
|
||||
['esnext.iterator', esnext_iterator_1.esnext_iterator],
|
||||
['esnext.promise', esnext_promise_1.esnext_promise],
|
||||
['esnext.array', esnext_array_1.esnext_array],
|
||||
['esnext.collection', esnext_collection_1.esnext_collection],
|
||||
['esnext.date', esnext_date_1.esnext_date],
|
||||
['esnext.decorators', esnext_decorators_1.esnext_decorators],
|
||||
['esnext.disposable', esnext_disposable_1.esnext_disposable],
|
||||
['esnext.error', esnext_error_1.esnext_error],
|
||||
['esnext.intl', esnext_intl_1.esnext_intl],
|
||||
['esnext.sharedmemory', esnext_sharedmemory_1.esnext_sharedmemory],
|
||||
['esnext.temporal', esnext_temporal_1.esnext_temporal],
|
||||
['esnext.typedarrays', esnext_typedarrays_1.esnext_typedarrays],
|
||||
['decorators', decorators_1.decorators],
|
||||
['decorators.legacy', decorators_legacy_1.decorators_legacy],
|
||||
['es2016.full', es2016_full_1.es2016_full],
|
||||
@@ -220,6 +241,7 @@ exports.lib = new Map([
|
||||
['es2022.full', es2022_full_1.es2022_full],
|
||||
['es2023.full', es2023_full_1.es2023_full],
|
||||
['es2024.full', es2024_full_1.es2024_full],
|
||||
['es2025.full', es2025_full_1.es2025_full],
|
||||
['esnext.full', esnext_full_1.esnext_full],
|
||||
['lib', lib_1.lib],
|
||||
]);
|
||||
|
||||
Generated
Vendored
+1
-7
@@ -5,13 +5,7 @@
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.webworker_asynciterable = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.webworker_asynciterable = {
|
||||
libs: [],
|
||||
variables: [
|
||||
['FileSystemDirectoryHandleAsyncIterator', base_config_1.TYPE],
|
||||
['FileSystemDirectoryHandle', base_config_1.TYPE],
|
||||
['ReadableStreamAsyncIterator', base_config_1.TYPE],
|
||||
['ReadableStream', base_config_1.TYPE],
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
|
||||
+1
-32
@@ -5,38 +5,7 @@
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.webworker_iterable = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.webworker_iterable = {
|
||||
libs: [],
|
||||
variables: [
|
||||
['CSSNumericArray', base_config_1.TYPE],
|
||||
['CSSTransformValue', base_config_1.TYPE],
|
||||
['CSSUnparsedValue', base_config_1.TYPE],
|
||||
['Cache', base_config_1.TYPE],
|
||||
['CanvasPath', base_config_1.TYPE],
|
||||
['CanvasPathDrawingStyles', base_config_1.TYPE],
|
||||
['CookieStoreManager', base_config_1.TYPE],
|
||||
['DOMStringList', base_config_1.TYPE],
|
||||
['FileList', base_config_1.TYPE],
|
||||
['FontFaceSet', base_config_1.TYPE],
|
||||
['FormDataIterator', base_config_1.TYPE],
|
||||
['FormData', base_config_1.TYPE],
|
||||
['HeadersIterator', base_config_1.TYPE],
|
||||
['Headers', base_config_1.TYPE],
|
||||
['IDBDatabase', base_config_1.TYPE],
|
||||
['IDBObjectStore', base_config_1.TYPE],
|
||||
['ImageTrackList', base_config_1.TYPE],
|
||||
['MessageEvent', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnlyIterator', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnly', base_config_1.TYPE],
|
||||
['SubtleCrypto', base_config_1.TYPE],
|
||||
['URLSearchParamsIterator', base_config_1.TYPE],
|
||||
['URLSearchParams', base_config_1.TYPE],
|
||||
['WEBGL_draw_buffers', base_config_1.TYPE],
|
||||
['WEBGL_multi_draw', base_config_1.TYPE],
|
||||
['WebGL2RenderingContextBase', base_config_1.TYPE],
|
||||
['WebGL2RenderingContextOverloads', base_config_1.TYPE],
|
||||
['WebGLRenderingContextBase', base_config_1.TYPE],
|
||||
['WebGLRenderingContextOverloads', base_config_1.TYPE],
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
|
||||
+197
-5
@@ -6,9 +6,12 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.webworker = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2015_1 = require("./es2015");
|
||||
const es2018_asynciterable_1 = require("./es2018.asynciterable");
|
||||
exports.webworker = {
|
||||
libs: [],
|
||||
libs: [es2015_1.es2015, es2018_asynciterable_1.es2018_asynciterable],
|
||||
variables: [
|
||||
['AacEncoderConfig', base_config_1.TYPE],
|
||||
['AddEventListenerOptions', base_config_1.TYPE],
|
||||
['AesCbcParams', base_config_1.TYPE],
|
||||
['AesCtrParams', base_config_1.TYPE],
|
||||
@@ -68,6 +71,67 @@ exports.webworker = {
|
||||
['FileSystemRemoveOptions', base_config_1.TYPE],
|
||||
['FontFaceDescriptors', base_config_1.TYPE],
|
||||
['FontFaceSetLoadEventInit', base_config_1.TYPE],
|
||||
['GPUBindGroupDescriptor', base_config_1.TYPE],
|
||||
['GPUBindGroupEntry', base_config_1.TYPE],
|
||||
['GPUBindGroupLayoutDescriptor', base_config_1.TYPE],
|
||||
['GPUBindGroupLayoutEntry', base_config_1.TYPE],
|
||||
['GPUBlendComponent', base_config_1.TYPE],
|
||||
['GPUBlendState', base_config_1.TYPE],
|
||||
['GPUBufferBinding', base_config_1.TYPE],
|
||||
['GPUBufferBindingLayout', base_config_1.TYPE],
|
||||
['GPUBufferDescriptor', base_config_1.TYPE],
|
||||
['GPUCanvasConfiguration', base_config_1.TYPE],
|
||||
['GPUCanvasToneMapping', base_config_1.TYPE],
|
||||
['GPUColorDict', base_config_1.TYPE],
|
||||
['GPUColorTargetState', base_config_1.TYPE],
|
||||
['GPUCommandBufferDescriptor', base_config_1.TYPE],
|
||||
['GPUCommandEncoderDescriptor', base_config_1.TYPE],
|
||||
['GPUComputePassDescriptor', base_config_1.TYPE],
|
||||
['GPUComputePassTimestampWrites', base_config_1.TYPE],
|
||||
['GPUComputePipelineDescriptor', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageDestInfo', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageSourceInfo', base_config_1.TYPE],
|
||||
['GPUDepthStencilState', base_config_1.TYPE],
|
||||
['GPUDeviceDescriptor', base_config_1.TYPE],
|
||||
['GPUExtent3DDict', base_config_1.TYPE],
|
||||
['GPUExternalTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUExternalTextureDescriptor', base_config_1.TYPE],
|
||||
['GPUFragmentState', base_config_1.TYPE],
|
||||
['GPUMultisampleState', base_config_1.TYPE],
|
||||
['GPUObjectDescriptorBase', base_config_1.TYPE],
|
||||
['GPUOrigin2DDict', base_config_1.TYPE],
|
||||
['GPUOrigin3DDict', base_config_1.TYPE],
|
||||
['GPUPipelineDescriptorBase', base_config_1.TYPE],
|
||||
['GPUPipelineErrorInit', base_config_1.TYPE],
|
||||
['GPUPipelineLayoutDescriptor', base_config_1.TYPE],
|
||||
['GPUPrimitiveState', base_config_1.TYPE],
|
||||
['GPUProgrammableStage', base_config_1.TYPE],
|
||||
['GPUQuerySetDescriptor', base_config_1.TYPE],
|
||||
['GPUQueueDescriptor', base_config_1.TYPE],
|
||||
['GPURenderBundleDescriptor', base_config_1.TYPE],
|
||||
['GPURenderBundleEncoderDescriptor', base_config_1.TYPE],
|
||||
['GPURenderPassColorAttachment', base_config_1.TYPE],
|
||||
['GPURenderPassDepthStencilAttachment', base_config_1.TYPE],
|
||||
['GPURenderPassDescriptor', base_config_1.TYPE],
|
||||
['GPURenderPassLayout', base_config_1.TYPE],
|
||||
['GPURenderPassTimestampWrites', base_config_1.TYPE],
|
||||
['GPURenderPipelineDescriptor', base_config_1.TYPE],
|
||||
['GPURequestAdapterOptions', base_config_1.TYPE],
|
||||
['GPUSamplerBindingLayout', base_config_1.TYPE],
|
||||
['GPUSamplerDescriptor', base_config_1.TYPE],
|
||||
['GPUShaderModuleDescriptor', base_config_1.TYPE],
|
||||
['GPUStencilFaceState', base_config_1.TYPE],
|
||||
['GPUStorageTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUTexelCopyBufferInfo', base_config_1.TYPE],
|
||||
['GPUTexelCopyBufferLayout', base_config_1.TYPE],
|
||||
['GPUTexelCopyTextureInfo', base_config_1.TYPE],
|
||||
['GPUTextureBindingLayout', base_config_1.TYPE],
|
||||
['GPUTextureDescriptor', base_config_1.TYPE],
|
||||
['GPUTextureViewDescriptor', base_config_1.TYPE],
|
||||
['GPUUncapturedErrorEventInit', base_config_1.TYPE],
|
||||
['GPUVertexAttribute', base_config_1.TYPE],
|
||||
['GPUVertexBufferLayout', base_config_1.TYPE],
|
||||
['GPUVertexState', base_config_1.TYPE],
|
||||
['GetNotificationOptions', base_config_1.TYPE],
|
||||
['HkdfParams', base_config_1.TYPE],
|
||||
['HmacImportParams', base_config_1.TYPE],
|
||||
@@ -121,12 +185,15 @@ exports.webworker = {
|
||||
['RTCEncodedAudioFrameMetadata', base_config_1.TYPE],
|
||||
['RTCEncodedFrameMetadata', base_config_1.TYPE],
|
||||
['RTCEncodedVideoFrameMetadata', base_config_1.TYPE],
|
||||
['ReadableStreamBYOBReaderReadOptions', base_config_1.TYPE],
|
||||
['ReadableStreamGetReaderOptions', base_config_1.TYPE],
|
||||
['ReadableStreamIteratorOptions', base_config_1.TYPE],
|
||||
['ReadableStreamReadDoneResult', base_config_1.TYPE],
|
||||
['ReadableStreamReadValueResult', base_config_1.TYPE],
|
||||
['ReadableWritablePair', base_config_1.TYPE],
|
||||
['RegistrationOptions', base_config_1.TYPE],
|
||||
['Report', base_config_1.TYPE],
|
||||
['ReportBody', base_config_1.TYPE],
|
||||
['ReportingObserverOptions', base_config_1.TYPE],
|
||||
['RequestInit', base_config_1.TYPE],
|
||||
['ResponseInit', base_config_1.TYPE],
|
||||
@@ -136,14 +203,23 @@ exports.webworker = {
|
||||
['RsaOaepParams', base_config_1.TYPE],
|
||||
['RsaOtherPrimesInfo', base_config_1.TYPE],
|
||||
['RsaPssParams', base_config_1.TYPE],
|
||||
['SchedulerPostTaskOptions', base_config_1.TYPE],
|
||||
['SecurityPolicyViolationEventInit', base_config_1.TYPE],
|
||||
['StorageEstimate', base_config_1.TYPE],
|
||||
['StreamPipeOptions', base_config_1.TYPE],
|
||||
['StructuredSerializeOptions', base_config_1.TYPE],
|
||||
['SvcOutputMetadata', base_config_1.TYPE],
|
||||
['TaskControllerInit', base_config_1.TYPE],
|
||||
['TaskPriorityChangeEventInit', base_config_1.TYPE],
|
||||
['TaskSignalAnyInit', base_config_1.TYPE],
|
||||
['TextDecodeOptions', base_config_1.TYPE],
|
||||
['TextDecoderOptions', base_config_1.TYPE],
|
||||
['TextEncoderEncodeIntoResult', base_config_1.TYPE],
|
||||
['Transformer', base_config_1.TYPE],
|
||||
['URLPatternComponentResult', base_config_1.TYPE],
|
||||
['URLPatternInit', base_config_1.TYPE],
|
||||
['URLPatternOptions', base_config_1.TYPE],
|
||||
['URLPatternResult', base_config_1.TYPE],
|
||||
['UnderlyingByteSource', base_config_1.TYPE],
|
||||
['UnderlyingDefaultSource', base_config_1.TYPE],
|
||||
['UnderlyingSink', base_config_1.TYPE],
|
||||
@@ -295,7 +371,47 @@ exports.webworker = {
|
||||
['FontFaceSetLoadEvent', base_config_1.TYPE_VALUE],
|
||||
['FontFaceSource', base_config_1.TYPE],
|
||||
['FormData', base_config_1.TYPE_VALUE],
|
||||
['GPUError', base_config_1.TYPE],
|
||||
['GPU', base_config_1.TYPE_VALUE],
|
||||
['GPUAdapter', base_config_1.TYPE_VALUE],
|
||||
['GPUAdapterInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUBindGroup', base_config_1.TYPE_VALUE],
|
||||
['GPUBindGroupLayout', base_config_1.TYPE_VALUE],
|
||||
['GPUBindingCommandsMixin', base_config_1.TYPE],
|
||||
['GPUBuffer', base_config_1.TYPE_VALUE],
|
||||
['GPUCanvasContext', base_config_1.TYPE_VALUE],
|
||||
['GPUCommandBuffer', base_config_1.TYPE_VALUE],
|
||||
['GPUCommandEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPUCompilationInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUCompilationMessage', base_config_1.TYPE_VALUE],
|
||||
['GPUComputePassEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPUComputePipeline', base_config_1.TYPE_VALUE],
|
||||
['GPUDebugCommandsMixin', base_config_1.TYPE],
|
||||
['GPUDeviceEventMap', base_config_1.TYPE],
|
||||
['GPUDevice', base_config_1.TYPE_VALUE],
|
||||
['GPUDeviceLostInfo', base_config_1.TYPE_VALUE],
|
||||
['GPUError', base_config_1.TYPE_VALUE],
|
||||
['GPUExternalTexture', base_config_1.TYPE_VALUE],
|
||||
['GPUInternalError', base_config_1.TYPE_VALUE],
|
||||
['GPUObjectBase', base_config_1.TYPE],
|
||||
['GPUOutOfMemoryError', base_config_1.TYPE_VALUE],
|
||||
['GPUPipelineBase', base_config_1.TYPE],
|
||||
['GPUPipelineError', base_config_1.TYPE_VALUE],
|
||||
['GPUPipelineLayout', base_config_1.TYPE_VALUE],
|
||||
['GPUQuerySet', base_config_1.TYPE_VALUE],
|
||||
['GPUQueue', base_config_1.TYPE_VALUE],
|
||||
['GPURenderBundle', base_config_1.TYPE_VALUE],
|
||||
['GPURenderBundleEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPURenderCommandsMixin', base_config_1.TYPE],
|
||||
['GPURenderPassEncoder', base_config_1.TYPE_VALUE],
|
||||
['GPURenderPipeline', base_config_1.TYPE_VALUE],
|
||||
['GPUSampler', base_config_1.TYPE_VALUE],
|
||||
['GPUShaderModule', base_config_1.TYPE_VALUE],
|
||||
['GPUSupportedFeatures', base_config_1.TYPE_VALUE],
|
||||
['GPUSupportedLimits', base_config_1.TYPE_VALUE],
|
||||
['GPUTexture', base_config_1.TYPE_VALUE],
|
||||
['GPUTextureView', base_config_1.TYPE_VALUE],
|
||||
['GPUUncapturedErrorEvent', base_config_1.TYPE_VALUE],
|
||||
['GPUValidationError', base_config_1.TYPE_VALUE],
|
||||
['GenericTransformStream', base_config_1.TYPE],
|
||||
['Headers', base_config_1.TYPE_VALUE],
|
||||
['IDBCursor', base_config_1.TYPE_VALUE],
|
||||
@@ -335,6 +451,7 @@ exports.webworker = {
|
||||
['NavigationPreloadManager', base_config_1.TYPE_VALUE],
|
||||
['NavigatorBadge', base_config_1.TYPE],
|
||||
['NavigatorConcurrentHardware', base_config_1.TYPE],
|
||||
['NavigatorGPU', base_config_1.TYPE],
|
||||
['NavigatorID', base_config_1.TYPE],
|
||||
['NavigatorLanguage', base_config_1.TYPE],
|
||||
['NavigatorLocks', base_config_1.TYPE],
|
||||
@@ -373,6 +490,7 @@ exports.webworker = {
|
||||
['PromiseRejectionEvent', base_config_1.TYPE_VALUE],
|
||||
['PushEvent', base_config_1.TYPE_VALUE],
|
||||
['PushManager', base_config_1.TYPE_VALUE],
|
||||
['PushManagerAttribute', base_config_1.TYPE],
|
||||
['PushMessageData', base_config_1.TYPE_VALUE],
|
||||
['PushSubscription', base_config_1.TYPE_VALUE],
|
||||
['PushSubscriptionChangeEvent', base_config_1.TYPE_VALUE],
|
||||
@@ -390,11 +508,10 @@ exports.webworker = {
|
||||
['ReadableStreamDefaultController', base_config_1.TYPE_VALUE],
|
||||
['ReadableStreamDefaultReader', base_config_1.TYPE_VALUE],
|
||||
['ReadableStreamGenericReader', base_config_1.TYPE],
|
||||
['Report', base_config_1.TYPE_VALUE],
|
||||
['ReportBody', base_config_1.TYPE_VALUE],
|
||||
['ReportingObserver', base_config_1.TYPE_VALUE],
|
||||
['Request', base_config_1.TYPE_VALUE],
|
||||
['Response', base_config_1.TYPE_VALUE],
|
||||
['Scheduler', base_config_1.TYPE_VALUE],
|
||||
['SecurityPolicyViolationEvent', base_config_1.TYPE_VALUE],
|
||||
['ServiceWorkerEventMap', base_config_1.TYPE],
|
||||
['ServiceWorker', base_config_1.TYPE_VALUE],
|
||||
@@ -409,6 +526,10 @@ exports.webworker = {
|
||||
['StorageManager', base_config_1.TYPE_VALUE],
|
||||
['StylePropertyMapReadOnly', base_config_1.TYPE_VALUE],
|
||||
['SubtleCrypto', base_config_1.TYPE_VALUE],
|
||||
['TaskController', base_config_1.TYPE_VALUE],
|
||||
['TaskPriorityChangeEvent', base_config_1.TYPE_VALUE],
|
||||
['TaskSignalEventMap', base_config_1.TYPE],
|
||||
['TaskSignal', base_config_1.TYPE_VALUE],
|
||||
['TextDecoder', base_config_1.TYPE_VALUE],
|
||||
['TextDecoderCommon', base_config_1.TYPE],
|
||||
['TextDecoderStream', base_config_1.TYPE_VALUE],
|
||||
@@ -419,6 +540,7 @@ exports.webworker = {
|
||||
['TransformStream', base_config_1.TYPE_VALUE],
|
||||
['TransformStreamDefaultController', base_config_1.TYPE_VALUE],
|
||||
['URL', base_config_1.TYPE_VALUE],
|
||||
['URLPattern', base_config_1.TYPE_VALUE],
|
||||
['URLSearchParams', base_config_1.TYPE_VALUE],
|
||||
['VideoColorSpace', base_config_1.TYPE_VALUE],
|
||||
['VideoDecoderEventMap', base_config_1.TYPE],
|
||||
@@ -439,6 +561,7 @@ exports.webworker = {
|
||||
['WEBGL_draw_buffers', base_config_1.TYPE],
|
||||
['WEBGL_lose_context', base_config_1.TYPE],
|
||||
['WEBGL_multi_draw', base_config_1.TYPE],
|
||||
['WGSLLanguageFeatures', base_config_1.TYPE_VALUE],
|
||||
['WebGL2RenderingContext', base_config_1.TYPE_VALUE],
|
||||
['WebGL2RenderingContextBase', base_config_1.TYPE],
|
||||
['WebGL2RenderingContextOverloads', base_config_1.TYPE],
|
||||
@@ -494,6 +617,7 @@ exports.webworker = {
|
||||
['PerformanceObserverCallback', base_config_1.TYPE],
|
||||
['QueuingStrategySize', base_config_1.TYPE],
|
||||
['ReportingObserverCallback', base_config_1.TYPE],
|
||||
['SchedulerPostTaskCallback', base_config_1.TYPE],
|
||||
['TransformerFlushCallback', base_config_1.TYPE],
|
||||
['TransformerStartCallback', base_config_1.TYPE],
|
||||
['TransformerTransformCallback', base_config_1.TYPE],
|
||||
@@ -537,6 +661,31 @@ exports.webworker = {
|
||||
['GLsizeiptr', base_config_1.TYPE],
|
||||
['GLuint', base_config_1.TYPE],
|
||||
['GLuint64', base_config_1.TYPE],
|
||||
['GPUBindingResource', base_config_1.TYPE],
|
||||
['GPUBufferDynamicOffset', base_config_1.TYPE],
|
||||
['GPUBufferUsageFlags', base_config_1.TYPE],
|
||||
['GPUColor', base_config_1.TYPE],
|
||||
['GPUColorWriteFlags', base_config_1.TYPE],
|
||||
['GPUCopyExternalImageSource', base_config_1.TYPE],
|
||||
['GPUDepthBias', base_config_1.TYPE],
|
||||
['GPUExtent3D', base_config_1.TYPE],
|
||||
['GPUFlagsConstant', base_config_1.TYPE],
|
||||
['GPUIndex32', base_config_1.TYPE],
|
||||
['GPUIntegerCoordinate', base_config_1.TYPE],
|
||||
['GPUIntegerCoordinateOut', base_config_1.TYPE],
|
||||
['GPUMapModeFlags', base_config_1.TYPE],
|
||||
['GPUOrigin2D', base_config_1.TYPE],
|
||||
['GPUOrigin3D', base_config_1.TYPE],
|
||||
['GPUPipelineConstantValue', base_config_1.TYPE],
|
||||
['GPUSampleMask', base_config_1.TYPE],
|
||||
['GPUShaderStageFlags', base_config_1.TYPE],
|
||||
['GPUSignedOffset32', base_config_1.TYPE],
|
||||
['GPUSize32', base_config_1.TYPE],
|
||||
['GPUSize32Out', base_config_1.TYPE],
|
||||
['GPUSize64', base_config_1.TYPE],
|
||||
['GPUSize64Out', base_config_1.TYPE],
|
||||
['GPUStencilValue', base_config_1.TYPE],
|
||||
['GPUTextureUsageFlags', base_config_1.TYPE],
|
||||
['HashAlgorithmIdentifier', base_config_1.TYPE],
|
||||
['HeadersInit', base_config_1.TYPE],
|
||||
['IDBValidKey', base_config_1.TYPE],
|
||||
@@ -558,8 +707,10 @@ exports.webworker = {
|
||||
['TexImageSource', base_config_1.TYPE],
|
||||
['TimerHandler', base_config_1.TYPE],
|
||||
['Transferable', base_config_1.TYPE],
|
||||
['URLPatternInput', base_config_1.TYPE],
|
||||
['Uint32List', base_config_1.TYPE],
|
||||
['XMLHttpRequestBodyInit', base_config_1.TYPE],
|
||||
['AacBitstreamFormat', base_config_1.TYPE],
|
||||
['AlphaOption', base_config_1.TYPE],
|
||||
['AudioSampleFormat', base_config_1.TYPE],
|
||||
['AvcBitstreamFormat', base_config_1.TYPE],
|
||||
@@ -592,6 +743,40 @@ exports.webworker = {
|
||||
['FontFaceLoadStatus', base_config_1.TYPE],
|
||||
['FontFaceSetLoadStatus', base_config_1.TYPE],
|
||||
['FrameType', base_config_1.TYPE],
|
||||
['GPUAddressMode', base_config_1.TYPE],
|
||||
['GPUAutoLayoutMode', base_config_1.TYPE],
|
||||
['GPUBlendFactor', base_config_1.TYPE],
|
||||
['GPUBlendOperation', base_config_1.TYPE],
|
||||
['GPUBufferBindingType', base_config_1.TYPE],
|
||||
['GPUBufferMapState', base_config_1.TYPE],
|
||||
['GPUCanvasAlphaMode', base_config_1.TYPE],
|
||||
['GPUCanvasToneMappingMode', base_config_1.TYPE],
|
||||
['GPUCompareFunction', base_config_1.TYPE],
|
||||
['GPUCompilationMessageType', base_config_1.TYPE],
|
||||
['GPUCullMode', base_config_1.TYPE],
|
||||
['GPUDeviceLostReason', base_config_1.TYPE],
|
||||
['GPUErrorFilter', base_config_1.TYPE],
|
||||
['GPUFeatureName', base_config_1.TYPE],
|
||||
['GPUFilterMode', base_config_1.TYPE],
|
||||
['GPUFrontFace', base_config_1.TYPE],
|
||||
['GPUIndexFormat', base_config_1.TYPE],
|
||||
['GPULoadOp', base_config_1.TYPE],
|
||||
['GPUMipmapFilterMode', base_config_1.TYPE],
|
||||
['GPUPipelineErrorReason', base_config_1.TYPE],
|
||||
['GPUPowerPreference', base_config_1.TYPE],
|
||||
['GPUPrimitiveTopology', base_config_1.TYPE],
|
||||
['GPUQueryType', base_config_1.TYPE],
|
||||
['GPUSamplerBindingType', base_config_1.TYPE],
|
||||
['GPUStencilOperation', base_config_1.TYPE],
|
||||
['GPUStorageTextureAccess', base_config_1.TYPE],
|
||||
['GPUStoreOp', base_config_1.TYPE],
|
||||
['GPUTextureAspect', base_config_1.TYPE],
|
||||
['GPUTextureDimension', base_config_1.TYPE],
|
||||
['GPUTextureFormat', base_config_1.TYPE],
|
||||
['GPUTextureSampleType', base_config_1.TYPE],
|
||||
['GPUTextureViewDimension', base_config_1.TYPE],
|
||||
['GPUVertexFormat', base_config_1.TYPE],
|
||||
['GPUVertexStepMode', base_config_1.TYPE],
|
||||
['GlobalCompositeOperation', base_config_1.TYPE],
|
||||
['HardwareAcceleration', base_config_1.TYPE],
|
||||
['HdrMetadataType', base_config_1.TYPE],
|
||||
@@ -599,6 +784,7 @@ exports.webworker = {
|
||||
['IDBRequestReadyState', base_config_1.TYPE],
|
||||
['IDBTransactionDurability', base_config_1.TYPE],
|
||||
['IDBTransactionMode', base_config_1.TYPE],
|
||||
['ImageDataPixelFormat', base_config_1.TYPE],
|
||||
['ImageOrientation', base_config_1.TYPE],
|
||||
['ImageSmoothingQuality', base_config_1.TYPE],
|
||||
['KeyFormat', base_config_1.TYPE],
|
||||
@@ -619,7 +805,6 @@ exports.webworker = {
|
||||
['PremultiplyAlpha', base_config_1.TYPE],
|
||||
['PushEncryptionKeyName', base_config_1.TYPE],
|
||||
['RTCDataChannelState', base_config_1.TYPE],
|
||||
['RTCEncodedVideoFrameType', base_config_1.TYPE],
|
||||
['ReadableStreamReaderMode', base_config_1.TYPE],
|
||||
['ReadableStreamType', base_config_1.TYPE],
|
||||
['ReferrerPolicy', base_config_1.TYPE],
|
||||
@@ -634,6 +819,7 @@ exports.webworker = {
|
||||
['SecurityPolicyViolationEventDisposition', base_config_1.TYPE],
|
||||
['ServiceWorkerState', base_config_1.TYPE],
|
||||
['ServiceWorkerUpdateViaCache', base_config_1.TYPE],
|
||||
['TaskPriority', base_config_1.TYPE],
|
||||
['TransferFunction', base_config_1.TYPE],
|
||||
['VideoColorPrimaries', base_config_1.TYPE],
|
||||
['VideoEncoderBitrateMode', base_config_1.TYPE],
|
||||
@@ -646,5 +832,11 @@ exports.webworker = {
|
||||
['WorkerType', base_config_1.TYPE],
|
||||
['WriteCommandType', base_config_1.TYPE],
|
||||
['XMLHttpRequestResponseType', base_config_1.TYPE],
|
||||
['FormDataIterator', base_config_1.TYPE],
|
||||
['HeadersIterator', base_config_1.TYPE],
|
||||
['StylePropertyMapReadOnlyIterator', base_config_1.TYPE],
|
||||
['URLSearchParamsIterator', base_config_1.TYPE],
|
||||
['FileSystemDirectoryHandleAsyncIterator', base_config_1.TYPE],
|
||||
['ReadableStreamAsyncIterator', base_config_1.TYPE],
|
||||
],
|
||||
};
|
||||
|
||||
+5
@@ -14,6 +14,11 @@ export declare class Referencer extends Visitor {
|
||||
readonly scopeManager: ScopeManager;
|
||||
constructor(options: ReferencerOptions, scopeManager: ScopeManager);
|
||||
private populateGlobalsFromLib;
|
||||
/**
|
||||
* Resolves lib names into a deduplicated set of LibDefinitions,
|
||||
* including all transitive dependencies.
|
||||
*/
|
||||
private resolveLibDefinitions;
|
||||
close(node: TSESTree.Node): void;
|
||||
currentScope(): Scope;
|
||||
currentScope(throwOnNull: true): Scope | null;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user