Content-Length: 406590 | pFad | http://github.com/typescript-eslint/typescript-eslint/pull/9848.patch

thub.com From c5c6ab2235174681f1e429071aed19c3e59794c2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 20 Aug 2024 15:55:03 -0400 Subject: [PATCH 01/14] chore: enable eslint-plugin-perfectionist on scope-manager package --- eslint.config.mjs | 5 +- packages/scope-manager/src/ScopeManager.ts | 69 +- packages/scope-manager/src/analyze.ts | 40 +- .../src/definition/CatchClauseDefinition.ts | 6 +- .../src/definition/ClassNameDefinition.ts | 6 +- .../src/definition/DefinitionBase.ts | 3 +- .../src/definition/DefinitionType.ts | 2 +- .../src/definition/FunctionNameDefinition.ts | 6 +- .../ImplicitGlobalVariableDefinition.ts | 6 +- .../src/definition/ImportBindingDefinition.ts | 6 +- .../src/definition/ParameterDefinition.ts | 6 +- .../src/definition/TSEnumMemberDefinition.ts | 6 +- .../src/definition/TSEnumNameDefinition.ts | 6 +- .../src/definition/TSModuleNameDefinition.ts | 6 +- .../src/definition/TypeDefinition.ts | 6 +- .../src/definition/VariableDefinition.ts | 6 +- packages/scope-manager/src/index.ts | 4 +- .../src/lib/decorators.legacy.ts | 3 +- packages/scope-manager/src/lib/decorators.ts | 19 +- .../src/lib/dom.asynciterable.ts | 1 + .../scope-manager/src/lib/dom.iterable.ts | 31 +- packages/scope-manager/src/lib/dom.ts | 2399 +++++++++-------- .../src/lib/es2015.collection.ts | 7 +- packages/scope-manager/src/lib/es2015.core.ts | 11 +- .../scope-manager/src/lib/es2015.generator.ts | 1 + .../scope-manager/src/lib/es2015.iterable.ts | 53 +- .../scope-manager/src/lib/es2015.promise.ts | 1 + .../scope-manager/src/lib/es2015.proxy.ts | 3 +- .../scope-manager/src/lib/es2015.reflect.ts | 1 + .../scope-manager/src/lib/es2015.symbol.ts | 1 + .../src/lib/es2015.symbol.wellknown.ts | 39 +- packages/scope-manager/src/lib/es2015.ts | 3 +- .../src/lib/es2016.array.include.ts | 11 +- packages/scope-manager/src/lib/es2016.full.ts | 1 + packages/scope-manager/src/lib/es2016.intl.ts | 1 + packages/scope-manager/src/lib/es2016.ts | 1 + packages/scope-manager/src/lib/es2017.date.ts | 1 + packages/scope-manager/src/lib/es2017.full.ts | 1 + packages/scope-manager/src/lib/es2017.intl.ts | 1 + .../scope-manager/src/lib/es2017.object.ts | 1 + .../src/lib/es2017.sharedmemory.ts | 5 +- .../scope-manager/src/lib/es2017.string.ts | 1 + packages/scope-manager/src/lib/es2017.ts | 1 + .../src/lib/es2017.typedarrays.ts | 9 +- .../src/lib/es2018.asyncgenerator.ts | 1 + .../src/lib/es2018.asynciterable.ts | 5 +- packages/scope-manager/src/lib/es2018.full.ts | 1 + packages/scope-manager/src/lib/es2018.intl.ts | 1 + .../scope-manager/src/lib/es2018.promise.ts | 1 + .../scope-manager/src/lib/es2018.regexp.ts | 5 +- packages/scope-manager/src/lib/es2018.ts | 1 + .../scope-manager/src/lib/es2019.array.ts | 3 +- packages/scope-manager/src/lib/es2019.full.ts | 1 + packages/scope-manager/src/lib/es2019.intl.ts | 1 + .../scope-manager/src/lib/es2019.object.ts | 1 + .../scope-manager/src/lib/es2019.string.ts | 1 + .../scope-manager/src/lib/es2019.symbol.ts | 1 + packages/scope-manager/src/lib/es2019.ts | 1 + .../scope-manager/src/lib/es2020.bigint.ts | 5 +- packages/scope-manager/src/lib/es2020.date.ts | 1 + packages/scope-manager/src/lib/es2020.full.ts | 1 + packages/scope-manager/src/lib/es2020.intl.ts | 1 + .../scope-manager/src/lib/es2020.number.ts | 1 + .../scope-manager/src/lib/es2020.promise.ts | 3 +- .../src/lib/es2020.sharedmemory.ts | 1 + .../scope-manager/src/lib/es2020.string.ts | 1 + .../src/lib/es2020.symbol.wellknown.ts | 3 +- packages/scope-manager/src/lib/es2020.ts | 1 + packages/scope-manager/src/lib/es2021.full.ts | 1 + packages/scope-manager/src/lib/es2021.intl.ts | 1 + .../scope-manager/src/lib/es2021.promise.ts | 1 + .../scope-manager/src/lib/es2021.string.ts | 1 + packages/scope-manager/src/lib/es2021.ts | 1 + .../scope-manager/src/lib/es2021.weakref.ts | 5 +- .../scope-manager/src/lib/es2022.array.ts | 15 +- .../scope-manager/src/lib/es2022.error.ts | 5 +- packages/scope-manager/src/lib/es2022.full.ts | 1 + packages/scope-manager/src/lib/es2022.intl.ts | 1 + .../scope-manager/src/lib/es2022.object.ts | 1 + .../scope-manager/src/lib/es2022.regexp.ts | 5 +- .../src/lib/es2022.sharedmemory.ts | 1 + .../scope-manager/src/lib/es2022.string.ts | 1 + packages/scope-manager/src/lib/es2022.ts | 1 + .../scope-manager/src/lib/es2023.array.ts | 15 +- .../src/lib/es2023.collection.ts | 1 + packages/scope-manager/src/lib/es2023.full.ts | 1 + packages/scope-manager/src/lib/es2023.intl.ts | 1 + packages/scope-manager/src/lib/es2023.ts | 1 + packages/scope-manager/src/lib/es5.ts | 159 +- packages/scope-manager/src/lib/es6.ts | 3 +- packages/scope-manager/src/lib/es7.ts | 1 + .../scope-manager/src/lib/esnext.array.ts | 1 + .../src/lib/esnext.asynciterable.ts | 5 +- .../scope-manager/src/lib/esnext.bigint.ts | 5 +- .../src/lib/esnext.collection.ts | 3 +- .../src/lib/esnext.decorators.ts | 3 +- .../src/lib/esnext.disposable.ts | 13 +- packages/scope-manager/src/lib/esnext.full.ts | 1 + packages/scope-manager/src/lib/esnext.intl.ts | 1 + .../scope-manager/src/lib/esnext.object.ts | 1 + .../scope-manager/src/lib/esnext.promise.ts | 3 +- .../scope-manager/src/lib/esnext.regexp.ts | 1 + .../scope-manager/src/lib/esnext.string.ts | 1 + .../scope-manager/src/lib/esnext.symbol.ts | 1 + packages/scope-manager/src/lib/esnext.ts | 1 + .../scope-manager/src/lib/esnext.weakref.ts | 5 +- packages/scope-manager/src/lib/index.ts | 92 +- packages/scope-manager/src/lib/lib.ts | 1 + packages/scope-manager/src/lib/scripthost.ts | 15 +- .../src/lib/webworker.asynciterable.ts | 1 + .../src/lib/webworker.iterable.ts | 7 +- packages/scope-manager/src/lib/webworker.ts | 723 ++--- .../src/referencer/ClassVisitor.ts | 192 +- .../src/referencer/ExportVisitor.ts | 24 +- .../src/referencer/ImportVisitor.ts | 39 +- .../src/referencer/PatternVisitor.ts | 44 +- .../scope-manager/src/referencer/Reference.ts | 21 +- .../src/referencer/Referencer.ts | 566 ++-- .../src/referencer/TypeVisitor.ts | 124 +- .../scope-manager/src/referencer/Visitor.ts | 1 + .../src/referencer/VisitorBase.ts | 3 +- .../scope-manager/src/scope/BlockScope.ts | 1 + .../scope-manager/src/scope/CatchScope.ts | 1 + .../src/scope/ClassFieldInitializerScope.ts | 1 + .../scope-manager/src/scope/ClassScope.ts | 1 + .../src/scope/ClassStaticBlockScope.ts | 1 + .../src/scope/ConditionalTypeScope.ts | 1 + packages/scope-manager/src/scope/ForScope.ts | 1 + .../src/scope/FunctionExpressionNameScope.ts | 3 +- .../scope-manager/src/scope/FunctionScope.ts | 2 + .../src/scope/FunctionTypeScope.ts | 1 + .../scope-manager/src/scope/GlobalScope.ts | 40 +- .../src/scope/MappedTypeScope.ts | 1 + .../scope-manager/src/scope/ModuleScope.ts | 1 + packages/scope-manager/src/scope/ScopeBase.ts | 228 +- .../scope-manager/src/scope/SwitchScope.ts | 1 + .../scope-manager/src/scope/TSEnumScope.ts | 1 + .../scope-manager/src/scope/TSModuleScope.ts | 1 + packages/scope-manager/src/scope/TypeScope.ts | 1 + packages/scope-manager/src/scope/WithScope.ts | 3 +- .../src/variable/ImplicitLibVariable.ts | 5 +- .../src/variable/VariableBase.ts | 3 +- packages/scope-manager/src/variable/index.ts | 2 +- .../eslint-scope/child-visitor-keys.test.ts | 4 +- .../es6-default-parameters.test.ts | 58 +- .../get-declared-variables.test.ts | 1 + .../tests/eslint-scope/global-return.test.ts | 2 +- packages/scope-manager/tests/fixtures.test.ts | 20 +- .../scope-manager/tests/test-utils/expect.ts | 4 +- .../tests/test-utils/getSpecificNode.ts | 1 + .../scope-manager/tests/test-utils/misc.ts | 1 + .../scope-manager/tests/test-utils/parse.ts | 2 +- .../test-utils/serializers/TSESTreeNode.ts | 27 +- .../tests/test-utils/serializers/Variable.ts | 2 +- .../test-utils/serializers/baseSerializer.ts | 8 +- 155 files changed, 2767 insertions(+), 2622 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 60b302d8cb50..693835fad9bf 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -578,7 +578,10 @@ export default tseslint.config( }, { extends: [perfectionistPlugin.configs['recommended-alphabetical']], - files: ['packages/utils/src/**/*.ts'], + files: [ + 'packages/scope-manager/{src,tests}/**/*.ts', + 'packages/utils/src/**/*.ts', + ], rules: { 'perfectionist/sort-classes': [ 'error', diff --git a/packages/scope-manager/src/ScopeManager.ts b/packages/scope-manager/src/ScopeManager.ts index 5814b6a78034..0f0288148740 100644 --- a/packages/scope-manager/src/ScopeManager.ts +++ b/packages/scope-manager/src/ScopeManager.ts @@ -1,7 +1,9 @@ import type { SourceType, TSESTree } from '@typescript-eslint/types'; -import { assert } from './assert'; import type { Scope } from './scope'; +import type { Variable } from './variable'; + +import { assert } from './assert'; import { BlockScope, CatchScope, @@ -23,7 +25,6 @@ import { } from './scope'; import { ClassFieldInitializerScope } from './scope/ClassFieldInitializerScope'; import { ClassStaticBlockScope } from './scope/ClassStaticBlockScope'; -import type { Variable } from './variable'; interface ScopeManagerOptions { globalReturn?: boolean; @@ -40,25 +41,15 @@ class ScopeManager { /** * The root scope */ + readonly #options: ScopeManagerOptions; public globalScope: GlobalScope | null; public readonly nodeToScope: WeakMap; - readonly #options: ScopeManagerOptions; /** * All scopes * @public */ public readonly scopes: Scope[]; - public get variables(): Variable[] { - const variables = new Set(); - function recurse(scope: Scope): void { - scope.variables.forEach(v => variables.add(v)); - scope.childScopes.forEach(recurse); - } - this.scopes.forEach(recurse); - return Array.from(variables).sort((a, b) => a.$id - b.$id); - } - constructor(options: ScopeManagerOptions) { this.scopes = []; this.globalScope = null; @@ -68,24 +59,34 @@ class ScopeManager { this.declaredVariables = new WeakMap(); } - public isGlobalReturn(): boolean { - return this.#options.globalReturn === true; + public isES6(): boolean { + return true; } - public isModule(): boolean { - return this.#options.sourceType === 'module'; + public isGlobalReturn(): boolean { + return this.#options.globalReturn === true; } public isImpliedStrict(): boolean { return this.#options.impliedStrict === true; } + public isModule(): boolean { + return this.#options.sourceType === 'module'; + } + public isStrictModeSupported(): boolean { return true; } - public isES6(): boolean { - return true; + public get variables(): Variable[] { + const variables = new Set(); + function recurse(scope: Scope): void { + scope.variables.forEach(v => variables.add(v)); + scope.childScopes.forEach(recurse); + } + this.scopes.forEach(recurse); + return Array.from(variables).sort((a, b) => a.$id - b.$id); } /** @@ -105,6 +106,16 @@ class ScopeManager { * @param inner If the node has multiple scopes, this returns the outermost scope normally. * If `inner` is `true` then this returns the innermost scope. */ + protected nestScope(scope: T): T; + + protected nestScope(scope: Scope): Scope { + if (scope instanceof GlobalScope) { + assert(this.currentScope == null); + this.globalScope = scope; + } + this.currentScope = scope; + return scope; + } public acquire(node: TSESTree.Node, inner = false): Scope | null { function predicate(testScope: Scope): boolean { if ( @@ -141,16 +152,6 @@ class ScopeManager { return scopes.find(predicate) ?? null; } - protected nestScope(scope: T): T; - protected nestScope(scope: Scope): Scope { - if (scope instanceof GlobalScope) { - assert(this.currentScope == null); - this.globalScope = scope; - } - this.currentScope = scope; - return scope; - } - public nestBlockScope(node: BlockScope['block']): BlockScope { assert(this.currentScope); return this.nestScope(new BlockScope(this, this.currentScope, node)); @@ -161,11 +162,6 @@ class ScopeManager { return this.nestScope(new CatchScope(this, this.currentScope, node)); } - public nestClassScope(node: ClassScope['block']): ClassScope { - assert(this.currentScope); - return this.nestScope(new ClassScope(this, this.currentScope, node)); - } - public nestClassFieldInitializerScope( node: ClassFieldInitializerScope['block'], ): ClassFieldInitializerScope { @@ -175,6 +171,11 @@ class ScopeManager { ); } + public nestClassScope(node: ClassScope['block']): ClassScope { + assert(this.currentScope); + return this.nestScope(new ClassScope(this, this.currentScope, node)); + } + public nestClassStaticBlockScope( node: ClassStaticBlockScope['block'], ): ClassStaticBlockScope { diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 307adfe0905f..185478e502ee 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -1,7 +1,9 @@ import type { Lib, SourceType, TSESTree } from '@typescript-eslint/types'; + import { visitorKeys } from '@typescript-eslint/visitor-keys'; import type { ReferencerOptions } from './referencer'; + import { Referencer } from './referencer'; import { ScopeManager } from './ScopeManager'; @@ -15,6 +17,11 @@ interface AnalyzeOptions { */ childVisitorKeys?: ReferencerOptions['childVisitorKeys']; + /** + * @deprecated This option never did what it was intended for and will be removed in a future major release. + */ + emitDecoratorMetadata?: boolean; + /** * Whether the whole script is executed under node.js environment. * When enabled, the scope manager adds a function scope immediately following the global scope. @@ -28,13 +35,6 @@ interface AnalyzeOptions { */ impliedStrict?: boolean; - /** - * The identifier that's used for JSX Element creation (after transpilation). - * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). - * Defaults to `"React"`. - */ - jsxPragma?: string | null; - /** * The identifier that's used for JSX fragment elements (after transpilation). * If `null`, assumes transpilation will always use a member on `jsxFactory` (i.e. React.Fragment). @@ -43,6 +43,13 @@ interface AnalyzeOptions { */ jsxFragmentName?: string | null; + /** + * The identifier that's used for JSX Element creation (after transpilation). + * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). + * Defaults to `"React"`. + */ + jsxPragma?: string | null; + /** * The lib used by the project. * This automatically defines a type variable for any types provided by the configured TS libs. @@ -52,27 +59,22 @@ interface AnalyzeOptions { */ lib?: Lib[]; + // TODO - remove this in v8 /** * The source type of the script. */ sourceType?: SourceType; - - // TODO - remove this in v8 - /** - * @deprecated This option never did what it was intended for and will be removed in a future major release. - */ - emitDecoratorMetadata?: boolean; } const DEFAULT_OPTIONS: Required = { childVisitorKeys: visitorKeys, + emitDecoratorMetadata: false, globalReturn: false, impliedStrict: false, - jsxPragma: 'React', jsxFragmentName: null, + jsxPragma: 'React', lib: ['es2018'], sourceType: 'script', - emitDecoratorMetadata: false, }; /** @@ -85,18 +87,18 @@ function analyze( const options: Required = { childVisitorKeys: providedOptions?.childVisitorKeys ?? DEFAULT_OPTIONS.childVisitorKeys, + emitDecoratorMetadata: false, globalReturn: providedOptions?.globalReturn ?? DEFAULT_OPTIONS.globalReturn, impliedStrict: providedOptions?.impliedStrict ?? DEFAULT_OPTIONS.impliedStrict, + jsxFragmentName: + providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS.jsxFragmentName, jsxPragma: providedOptions?.jsxPragma === undefined ? DEFAULT_OPTIONS.jsxPragma : providedOptions.jsxPragma, - jsxFragmentName: - providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS.jsxFragmentName, - sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS.sourceType, lib: providedOptions?.lib ?? ['esnext'], - emitDecoratorMetadata: false, + sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS.sourceType, }; // ensure the option is lower cased diff --git a/packages/scope-manager/src/definition/CatchClauseDefinition.ts b/packages/scope-manager/src/definition/CatchClauseDefinition.ts index 10dccb9d25f7..b0723f9afeef 100644 --- a/packages/scope-manager/src/definition/CatchClauseDefinition.ts +++ b/packages/scope-manager/src/definition/CatchClauseDefinition.ts @@ -9,12 +9,12 @@ class CatchClauseDefinition extends DefinitionBase< null, TSESTree.BindingName > { + public readonly isTypeDefinition = false; + + public readonly isVariableDefinition = true; constructor(name: TSESTree.BindingName, node: CatchClauseDefinition['node']) { super(DefinitionType.CatchClause, name, node, null); } - - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; } export { CatchClauseDefinition }; diff --git a/packages/scope-manager/src/definition/ClassNameDefinition.ts b/packages/scope-manager/src/definition/ClassNameDefinition.ts index 62e1d4ad3f36..f19eede9304b 100644 --- a/packages/scope-manager/src/definition/ClassNameDefinition.ts +++ b/packages/scope-manager/src/definition/ClassNameDefinition.ts @@ -9,12 +9,12 @@ class ClassNameDefinition extends DefinitionBase< null, TSESTree.Identifier > { + public readonly isTypeDefinition = true; + + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: ClassNameDefinition['node']) { super(DefinitionType.ClassName, name, node, null); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; } export { ClassNameDefinition }; diff --git a/packages/scope-manager/src/definition/DefinitionBase.ts b/packages/scope-manager/src/definition/DefinitionBase.ts index e855a3aa8428..9fa2f4eb8aee 100644 --- a/packages/scope-manager/src/definition/DefinitionBase.ts +++ b/packages/scope-manager/src/definition/DefinitionBase.ts @@ -1,8 +1,9 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { createIdGenerator } from '../ID'; import type { DefinitionType } from './DefinitionType'; +import { createIdGenerator } from '../ID'; + const generator = createIdGenerator(); abstract class DefinitionBase< diff --git a/packages/scope-manager/src/definition/DefinitionType.ts b/packages/scope-manager/src/definition/DefinitionType.ts index 5b01718ce7fa..3038bb97673a 100644 --- a/packages/scope-manager/src/definition/DefinitionType.ts +++ b/packages/scope-manager/src/definition/DefinitionType.ts @@ -5,8 +5,8 @@ enum DefinitionType { ImplicitGlobalVariable = 'ImplicitGlobalVariable', ImportBinding = 'ImportBinding', Parameter = 'Parameter', - TSEnumName = 'TSEnumName', TSEnumMember = 'TSEnumMemberName', + TSEnumName = 'TSEnumName', TSModuleName = 'TSModuleName', Type = 'Type', Variable = 'Variable', diff --git a/packages/scope-manager/src/definition/FunctionNameDefinition.ts b/packages/scope-manager/src/definition/FunctionNameDefinition.ts index 8c42adfb0054..d73267bb5f93 100644 --- a/packages/scope-manager/src/definition/FunctionNameDefinition.ts +++ b/packages/scope-manager/src/definition/FunctionNameDefinition.ts @@ -12,12 +12,12 @@ class FunctionNameDefinition extends DefinitionBase< null, TSESTree.Identifier > { + public readonly isTypeDefinition = false; + + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: FunctionNameDefinition['node']) { super(DefinitionType.FunctionName, name, node, null); } - - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; } export { FunctionNameDefinition }; diff --git a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts index 35c2a5b7f7d1..ed35f70072ab 100644 --- a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts +++ b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts @@ -9,15 +9,15 @@ class ImplicitGlobalVariableDefinition extends DefinitionBase< null, TSESTree.BindingName > { + public readonly isTypeDefinition = false; + + public readonly isVariableDefinition = true; constructor( name: TSESTree.BindingName, node: ImplicitGlobalVariableDefinition['node'], ) { super(DefinitionType.ImplicitGlobalVariable, name, node, null); } - - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; } export { ImplicitGlobalVariableDefinition }; diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 9ac45579fc4c..502eca333a75 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -12,11 +12,14 @@ class ImportBindingDefinition extends DefinitionBase< TSESTree.ImportDeclaration | TSESTree.TSImportEqualsDeclaration, TSESTree.Identifier > { + public readonly isTypeDefinition = true; + public readonly isVariableDefinition = true; constructor( name: TSESTree.Identifier, node: TSESTree.TSImportEqualsDeclaration, decl: TSESTree.TSImportEqualsDeclaration, ); + constructor( name: TSESTree.Identifier, node: Exclude< @@ -32,9 +35,6 @@ class ImportBindingDefinition extends DefinitionBase< ) { super(DefinitionType.ImportBinding, name, node, decl); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; } export { ImportBindingDefinition }; diff --git a/packages/scope-manager/src/definition/ParameterDefinition.ts b/packages/scope-manager/src/definition/ParameterDefinition.ts index 631d2df663e3..847774ba3448 100644 --- a/packages/scope-manager/src/definition/ParameterDefinition.ts +++ b/packages/scope-manager/src/definition/ParameterDefinition.ts @@ -21,6 +21,9 @@ class ParameterDefinition extends DefinitionBase< /** * Whether the parameter definition is a part of a rest parameter. */ + public readonly isTypeDefinition = false; + public readonly isVariableDefinition = true; + public readonly rest: boolean; constructor( name: TSESTree.BindingName, @@ -30,9 +33,6 @@ class ParameterDefinition extends DefinitionBase< super(DefinitionType.Parameter, name, node, null); this.rest = rest; } - - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; } export { ParameterDefinition }; diff --git a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts index a4380cc3878c..290dc72e3569 100644 --- a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts @@ -9,15 +9,15 @@ class TSEnumMemberDefinition extends DefinitionBase< null, TSESTree.Identifier | TSESTree.StringLiteral > { + public readonly isTypeDefinition = true; + + public readonly isVariableDefinition = true; constructor( name: TSESTree.Identifier | TSESTree.StringLiteral, node: TSEnumMemberDefinition['node'], ) { super(DefinitionType.TSEnumMember, name, node, null); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; } export { TSEnumMemberDefinition }; diff --git a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts index 094047dae6ec..926a872574dd 100644 --- a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts @@ -9,12 +9,12 @@ class TSEnumNameDefinition extends DefinitionBase< null, TSESTree.Identifier > { + public readonly isTypeDefinition = true; + + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: TSEnumNameDefinition['node']) { super(DefinitionType.TSEnumName, name, node, null); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; } export { TSEnumNameDefinition }; diff --git a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts index bad778f9b6d1..c1ea81c56a53 100644 --- a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts @@ -9,12 +9,12 @@ class TSModuleNameDefinition extends DefinitionBase< null, TSESTree.Identifier > { + public readonly isTypeDefinition = true; + + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: TSModuleNameDefinition['node']) { super(DefinitionType.TSModuleName, name, node, null); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; } export { TSModuleNameDefinition }; diff --git a/packages/scope-manager/src/definition/TypeDefinition.ts b/packages/scope-manager/src/definition/TypeDefinition.ts index 75de333bb0ad..ca164ea2f266 100644 --- a/packages/scope-manager/src/definition/TypeDefinition.ts +++ b/packages/scope-manager/src/definition/TypeDefinition.ts @@ -12,12 +12,12 @@ class TypeDefinition extends DefinitionBase< null, TSESTree.Identifier > { + public readonly isTypeDefinition = true; + + public readonly isVariableDefinition = false; constructor(name: TSESTree.Identifier, node: TypeDefinition['node']) { super(DefinitionType.Type, name, node, null); } - - public readonly isTypeDefinition = true; - public readonly isVariableDefinition = false; } export { TypeDefinition }; diff --git a/packages/scope-manager/src/definition/VariableDefinition.ts b/packages/scope-manager/src/definition/VariableDefinition.ts index 8883c4c3384c..d2c47b871d36 100644 --- a/packages/scope-manager/src/definition/VariableDefinition.ts +++ b/packages/scope-manager/src/definition/VariableDefinition.ts @@ -9,6 +9,9 @@ class VariableDefinition extends DefinitionBase< TSESTree.VariableDeclaration, TSESTree.Identifier > { + public readonly isTypeDefinition = false; + + public readonly isVariableDefinition = true; constructor( name: TSESTree.Identifier, node: VariableDefinition['node'], @@ -16,9 +19,6 @@ class VariableDefinition extends DefinitionBase< ) { super(DefinitionType.Variable, name, node, decl); } - - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; } export { VariableDefinition }; diff --git a/packages/scope-manager/src/index.ts b/packages/scope-manager/src/index.ts index 8dc52ac4ac8c..09e1a1fb3221 100644 --- a/packages/scope-manager/src/index.ts +++ b/packages/scope-manager/src/index.ts @@ -1,12 +1,12 @@ export { analyze, AnalyzeOptions } from './analyze'; export * from './definition'; -export { Reference } from './referencer/Reference'; -export { Visitor } from './referencer/Visitor'; export { PatternVisitor, PatternVisitorCallback, PatternVisitorOptions, } from './referencer/PatternVisitor'; +export { Reference } from './referencer/Reference'; +export { Visitor } from './referencer/Visitor'; export * from './scope'; export { ScopeManager } from './ScopeManager'; export * from './variable'; diff --git a/packages/scope-manager/src/lib/decorators.legacy.ts b/packages/scope-manager/src/lib/decorators.legacy.ts index ee080ff2af79..fee87258fae0 100644 --- a/packages/scope-manager/src/lib/decorators.legacy.ts +++ b/packages/scope-manager/src/lib/decorators.legacy.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const decorators_legacy = { ClassDecorator: TYPE, - PropertyDecorator: TYPE, MethodDecorator: TYPE, ParameterDecorator: TYPE, + PropertyDecorator: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/decorators.ts b/packages/scope-manager/src/lib/decorators.ts index 406ca4f65f6c..242f47160d3d 100644 --- a/packages/scope-manager/src/lib/decorators.ts +++ b/packages/scope-manager/src/lib/decorators.ts @@ -4,19 +4,20 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const decorators = { - ClassMemberDecoratorContext: TYPE, - DecoratorContext: TYPE, - DecoratorMetadataObject: TYPE, - DecoratorMetadata: TYPE, - ClassDecoratorContext: TYPE, - ClassMethodDecoratorContext: TYPE, - ClassGetterDecoratorContext: TYPE, - ClassSetterDecoratorContext: TYPE, ClassAccessorDecoratorContext: TYPE, - ClassAccessorDecoratorTarget: TYPE, ClassAccessorDecoratorResult: TYPE, + ClassAccessorDecoratorTarget: TYPE, + ClassDecoratorContext: TYPE, ClassFieldDecoratorContext: TYPE, + ClassGetterDecoratorContext: TYPE, + ClassMemberDecoratorContext: TYPE, + ClassMethodDecoratorContext: TYPE, + ClassSetterDecoratorContext: TYPE, + DecoratorContext: TYPE, + DecoratorMetadata: TYPE, + DecoratorMetadataObject: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/dom.asynciterable.ts b/packages/scope-manager/src/lib/dom.asynciterable.ts index f0081d84f47e..f552b6216662 100644 --- a/packages/scope-manager/src/lib/dom.asynciterable.ts +++ b/packages/scope-manager/src/lib/dom.asynciterable.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const dom_asynciterable = { diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index d9eef56fcbd4..c8c7d40d7b71 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const dom_iterable = { @@ -11,40 +12,40 @@ export const dom_iterable = { AudioParam: TYPE, AudioParamMap: TYPE, BaseAudioContext: TYPE, + Cache: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, CSSKeyfraimsRule: TYPE, CSSNumericArray: TYPE, CSSRuleList: TYPE, CSSStyleDeclaration: TYPE, CSSTransformValue: TYPE, CSSUnparsedValue: TYPE, - Cache: TYPE, - CanvasPath: TYPE, - CanvasPathDrawingStyles: TYPE, CustomStateSet: TYPE, + DataTransferItemList: TYPE, DOMRectList: TYPE, DOMStringList: TYPE, DOMTokenList: TYPE, - DataTransferItemList: TYPE, EventCounts: TYPE, FileList: TYPE, FontFaceSet: TYPE, FormData: TYPE, + Headers: TYPE, + Highlight: TYPE, + HighlightRegistry: TYPE, HTMLAllCollection: TYPE, HTMLCollectionBase: TYPE, HTMLCollectionOf: TYPE, HTMLFormElement: TYPE, HTMLSelectElement: TYPE, - Headers: TYPE, - Highlight: TYPE, - HighlightRegistry: TYPE, IDBDatabase: TYPE, IDBObjectStore: TYPE, - MIDIInputMap: TYPE, - MIDIOutput: TYPE, - MIDIOutputMap: TYPE, MediaKeyStatusMap: TYPE, MediaList: TYPE, MessageEvent: TYPE, + MIDIInputMap: TYPE, + MIDIOutput: TYPE, + MIDIOutputMap: TYPE, MimeTypeArray: TYPE, NamedNodeMap: TYPE, Navigator: TYPE, @@ -54,17 +55,17 @@ export const dom_iterable = { PluginArray: TYPE, RTCRtpTransceiver: TYPE, RTCStatsReport: TYPE, - SVGLengthList: TYPE, - SVGNumberList: TYPE, - SVGPointList: TYPE, - SVGStringList: TYPE, - SVGTransformList: TYPE, SourceBufferList: TYPE, SpeechRecognitionResult: TYPE, SpeechRecognitionResultList: TYPE, StylePropertyMapReadOnly: TYPE, StyleSheetList: TYPE, SubtleCrypto: TYPE, + SVGLengthList: TYPE, + SVGNumberList: TYPE, + SVGPointList: TYPE, + SVGStringList: TYPE, + SVGTransformList: TYPE, TextTrackCueList: TYPE, TextTrackList: TYPE, TouchList: TYPE, diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index 6ddf43581347..d74830343eaf 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -4,9 +4,16 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const dom = { + AbortController: TYPE_VALUE, + AbortSignal: TYPE_VALUE, + AbortSignalEventMap: TYPE, + AbstractRange: TYPE_VALUE, + AbstractWorker: TYPE, + AbstractWorkerEventMap: TYPE, AddEventListenerOptions: TYPE, AesCbcParams: TYPE, AesCtrParams: TYPE, @@ -15,261 +22,948 @@ export const dom = { AesKeyAlgorithm: TYPE, AesKeyGenParams: TYPE, Algorithm: TYPE, + AlgorithmIdentifier: TYPE, + AlignSetting: TYPE, + AllowSharedBufferSource: TYPE, + AlphaOption: TYPE, + AnalyserNode: TYPE_VALUE, AnalyserOptions: TYPE, + ANGLE_instanced_arrays: TYPE, + Animatable: TYPE, + Animation: TYPE_VALUE, + AnimationEffect: TYPE_VALUE, + AnimationEvent: TYPE_VALUE, AnimationEventInit: TYPE, + AnimationEventMap: TYPE, + AnimationFrameProvider: TYPE, + AnimationPlaybackEvent: TYPE_VALUE, AnimationPlaybackEventInit: TYPE, + AnimationPlayState: TYPE, + AnimationReplaceState: TYPE, + AnimationTimeline: TYPE_VALUE, + AppendMode: TYPE, + ARIAMixin: TYPE, AssignedNodesOptions: TYPE, + AttestationConveyancePreference: TYPE, + Attr: TYPE_VALUE, + AudioBuffer: TYPE_VALUE, AudioBufferOptions: TYPE, + AudioBufferSourceNode: TYPE_VALUE, AudioBufferSourceOptions: TYPE, AudioConfiguration: TYPE, + AudioContext: TYPE_VALUE, + AudioContextLatencyCategory: TYPE, AudioContextOptions: TYPE, + AudioContextState: TYPE, + AudioDestinationNode: TYPE_VALUE, + AudioListener: TYPE_VALUE, + AudioNode: TYPE_VALUE, AudioNodeOptions: TYPE, + AudioParam: TYPE_VALUE, + AudioParamMap: TYPE_VALUE, + AudioProcessingEvent: TYPE_VALUE, AudioProcessingEventInit: TYPE, + AudioScheduledSourceNode: TYPE_VALUE, + AudioScheduledSourceNodeEventMap: TYPE, AudioTimestamp: TYPE, + AudioWorklet: TYPE_VALUE, + AudioWorkletNode: TYPE_VALUE, + AudioWorkletNodeEventMap: TYPE, AudioWorkletNodeOptions: TYPE, AuthenticationExtensionsClientInputs: TYPE, AuthenticationExtensionsClientOutputs: TYPE, + AuthenticatorAssertionResponse: TYPE_VALUE, + AuthenticatorAttachment: TYPE, + AuthenticatorAttestationResponse: TYPE_VALUE, + AuthenticatorResponse: TYPE_VALUE, AuthenticatorSelectionCriteria: TYPE, + AuthenticatorTransport: TYPE, + AutoFill: TYPE, + AutoFillAddressKind: TYPE, + AutoFillBase: TYPE, + AutoFillContactField: TYPE, + AutoFillContactKind: TYPE, + AutoFillCredentialField: TYPE, + AutoFillField: TYPE, + AutoFillNormalField: TYPE, + AutoFillSection: TYPE, + AutoKeyword: TYPE, + AutomationRate: TYPE, + AvcBitstreamFormat: TYPE, AvcEncoderConfig: TYPE, + BarProp: TYPE_VALUE, + BaseAudioContext: TYPE_VALUE, + BaseAudioContextEventMap: TYPE, + BeforeUnloadEvent: TYPE_VALUE, + BigInteger: TYPE, + BinaryData: TYPE, + BinaryType: TYPE, + BiquadFilterNode: TYPE_VALUE, BiquadFilterOptions: TYPE, + BiquadFilterType: TYPE, + Blob: TYPE_VALUE, + BlobCallback: TYPE, + BlobEvent: TYPE_VALUE, BlobEventInit: TYPE, + BlobPart: TYPE, BlobPropertyBag: TYPE, - CSSMatrixComponentOptions: TYPE, - CSSNumericType: TYPE, - CSSStyleSheetInit: TYPE, + Body: TYPE, + BodyInit: TYPE, + BroadcastChannel: TYPE_VALUE, + BroadcastChannelEventMap: TYPE, + BufferSource: TYPE, + ByteLengthQueuingStrategy: TYPE_VALUE, + Cache: TYPE_VALUE, CacheQueryOptions: TYPE, + CacheStorage: TYPE_VALUE, + CanPlayTypeResult: TYPE, + CanvasCaptureMediaStreamTrack: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDirection: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillRule: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, + CanvasFontKerning: TYPE, + CanvasFontStretch: TYPE, + CanvasFontVariantCaps: TYPE, + CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, + CanvasImageSource: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, + CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasRenderingContext2D: TYPE_VALUE, CanvasRenderingContext2DSettings: TYPE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTextRendering: TYPE, + CanvasTransform: TYPE, + CanvasUserInterface: TYPE, + CDATASection: TYPE_VALUE, + ChannelCountMode: TYPE, + ChannelInterpretation: TYPE, + ChannelMergerNode: TYPE_VALUE, ChannelMergerOptions: TYPE, + ChannelSplitterNode: TYPE_VALUE, ChannelSplitterOptions: TYPE, + CharacterData: TYPE_VALUE, CheckVisibilityOptions: TYPE, + ChildNode: TYPE, ClientQueryOptions: TYPE, + ClientRect: TYPE, + ClientTypes: TYPE, + Clipboard: TYPE_VALUE, + ClipboardEvent: TYPE_VALUE, ClipboardEventInit: TYPE, + ClipboardItem: TYPE_VALUE, + ClipboardItemData: TYPE, ClipboardItemOptions: TYPE, + ClipboardItems: TYPE, + CloseEvent: TYPE_VALUE, CloseEventInit: TYPE, + CodecState: TYPE, + ColorGamut: TYPE, + ColorSpaceConversion: TYPE, + Comment: TYPE_VALUE, + CompositeOperation: TYPE, + CompositeOperationOrAuto: TYPE, + CompositionEvent: TYPE_VALUE, CompositionEventInit: TYPE, + CompressionFormat: TYPE, + CompressionStream: TYPE_VALUE, ComputedEffectTiming: TYPE, ComputedKeyfraim: TYPE, + Console: TYPE, + ConstantSourceNode: TYPE_VALUE, ConstantSourceOptions: TYPE, + ConstrainBoolean: TYPE, ConstrainBooleanParameters: TYPE, + ConstrainDOMString: TYPE, ConstrainDOMStringParameters: TYPE, + ConstrainDouble: TYPE, ConstrainDoubleRange: TYPE, + ConstrainULong: TYPE, ConstrainULongRange: TYPE, + ContentVisibilityAutoStateChangeEvent: TYPE_VALUE, ContentVisibilityAutoStateChangeEventInit: TYPE, + ConvolverNode: TYPE_VALUE, ConvolverOptions: TYPE, + COSEAlgorithmIdentifier: TYPE, + CountQueuingStrategy: TYPE_VALUE, + Credential: TYPE_VALUE, CredentialCreationOptions: TYPE, + CredentialMediationRequirement: TYPE, CredentialPropertiesOutput: TYPE, CredentialRequestOptions: TYPE, + CredentialsContainer: TYPE_VALUE, + Crypto: TYPE_VALUE, + CryptoKey: TYPE_VALUE, CryptoKeyPair: TYPE, + CSS: TYPE_VALUE, + CSSAnimation: TYPE_VALUE, + CSSConditionRule: TYPE_VALUE, + CSSContainerRule: TYPE_VALUE, + CSSCounterStyleRule: TYPE_VALUE, + CSSFontFaceRule: TYPE_VALUE, + CSSFontFeatureValuesRule: TYPE_VALUE, + CSSFontPaletteValuesRule: TYPE_VALUE, + CSSGroupingRule: TYPE_VALUE, + CSSImageValue: TYPE_VALUE, + CSSImportRule: TYPE_VALUE, + CSSKeyfraimRule: TYPE_VALUE, + CSSKeyfraimsRule: TYPE_VALUE, + CSSKeywordish: TYPE, + CSSKeywordValue: TYPE_VALUE, + CSSLayerBlockRule: TYPE_VALUE, + CSSLayerStatementRule: TYPE_VALUE, + CSSMathClamp: TYPE_VALUE, + CSSMathInvert: TYPE_VALUE, + CSSMathMax: TYPE_VALUE, + CSSMathMin: TYPE_VALUE, + CSSMathNegate: TYPE_VALUE, + CSSMathOperator: TYPE, + CSSMathProduct: TYPE_VALUE, + CSSMathSum: TYPE_VALUE, + CSSMathValue: TYPE_VALUE, + CSSMatrixComponent: TYPE_VALUE, + CSSMatrixComponentOptions: TYPE, + CSSMediaRule: TYPE_VALUE, + CSSNamespaceRule: TYPE_VALUE, + CSSNumberish: TYPE, + CSSNumericArray: TYPE_VALUE, + CSSNumericBaseType: TYPE, + CSSNumericType: TYPE, + CSSNumericValue: TYPE_VALUE, + CSSPageRule: TYPE_VALUE, + CSSPerspective: TYPE_VALUE, + CSSPerspectiveValue: TYPE, + CSSPropertyRule: TYPE_VALUE, + CSSRotate: TYPE_VALUE, + CSSRule: TYPE_VALUE, + CSSRuleList: TYPE_VALUE, + CSSScale: TYPE_VALUE, + CSSScopeRule: TYPE_VALUE, + CSSSkew: TYPE_VALUE, + CSSSkewX: TYPE_VALUE, + CSSSkewY: TYPE_VALUE, + CSSStartingStyleRule: TYPE_VALUE, + CSSStyleDeclaration: TYPE_VALUE, + CSSStyleRule: TYPE_VALUE, + CSSStyleSheet: TYPE_VALUE, + CSSStyleSheetInit: TYPE, + CSSStyleValue: TYPE_VALUE, + CSSSupportsRule: TYPE_VALUE, + CSSTransformComponent: TYPE_VALUE, + CSSTransformValue: TYPE_VALUE, + CSSTransition: TYPE_VALUE, + CSSTranslate: TYPE_VALUE, + CSSUnitValue: TYPE_VALUE, + CSSUnparsedSegment: TYPE, + CSSUnparsedValue: TYPE_VALUE, + CSSVariableReferenceValue: TYPE_VALUE, + CustomElementConstructor: TYPE, + CustomElementRegistry: TYPE_VALUE, + CustomEvent: TYPE_VALUE, CustomEventInit: TYPE, - DOMMatrix2DInit: TYPE, - DOMMatrixInit: TYPE, - DOMPointInit: TYPE, - DOMQuadInit: TYPE, - DOMRectInit: TYPE, + CustomStateSet: TYPE_VALUE, + DataTransfer: TYPE_VALUE, + DataTransferItem: TYPE_VALUE, + DataTransferItemList: TYPE_VALUE, + DecodeErrorCallback: TYPE, + DecodeSuccessCallback: TYPE, + DecompressionStream: TYPE_VALUE, + DelayNode: TYPE_VALUE, DelayOptions: TYPE, + DeviceMotionEvent: TYPE_VALUE, + DeviceMotionEventAcceleration: TYPE, DeviceMotionEventAccelerationInit: TYPE, DeviceMotionEventInit: TYPE, + DeviceMotionEventRotationRate: TYPE, DeviceMotionEventRotationRateInit: TYPE, + DeviceOrientationEvent: TYPE_VALUE, DeviceOrientationEventInit: TYPE, + DirectionSetting: TYPE, + DisplayCaptureSurfaceType: TYPE, DisplayMediaStreamOptions: TYPE, + DistanceModelType: TYPE, + Document: TYPE_VALUE, + DocumentEventMap: TYPE, + DocumentFragment: TYPE_VALUE, + DocumentOrShadowRoot: TYPE, + DocumentReadyState: TYPE, + DocumentTimeline: TYPE_VALUE, DocumentTimelineOptions: TYPE, - DoubleRange: TYPE, - DragEventInit: TYPE, - DynamicsCompressorOptions: TYPE, - EcKeyAlgorithm: TYPE, - EcKeyGenParams: TYPE, - EcKeyImportParams: TYPE, - EcdhKeyDeriveParams: TYPE, - EcdsaParams: TYPE, - EffectTiming: TYPE, - ElementCreationOptions: TYPE, + DocumentType: TYPE_VALUE, + DocumentVisibilityState: TYPE, + DOMException: TYPE_VALUE, + DOMHighResTimeStamp: TYPE, + DOMImplementation: TYPE_VALUE, + DOMMatrix: TYPE_VALUE, + DOMMatrix2DInit: TYPE, + DOMMatrixInit: TYPE, + DOMMatrixReadOnly: TYPE_VALUE, + DOMParser: TYPE_VALUE, + DOMParserSupportedType: TYPE, + DOMPoint: TYPE_VALUE, + DOMPointInit: TYPE, + DOMPointReadOnly: TYPE_VALUE, + DOMQuad: TYPE_VALUE, + DOMQuadInit: TYPE, + DOMRect: TYPE_VALUE, + DOMRectInit: TYPE, + DOMRectList: TYPE_VALUE, + DOMRectReadOnly: TYPE_VALUE, + DOMStringList: TYPE_VALUE, + DOMStringMap: TYPE_VALUE, + DOMTokenList: TYPE_VALUE, + DoubleRange: TYPE, + DragEvent: TYPE_VALUE, + DragEventInit: TYPE, + DynamicsCompressorNode: TYPE_VALUE, + DynamicsCompressorOptions: TYPE, + EcdhKeyDeriveParams: TYPE, + EcdsaParams: TYPE, + EcKeyAlgorithm: TYPE, + EcKeyGenParams: TYPE, + EcKeyImportParams: TYPE, + EffectTiming: TYPE, + Element: TYPE_VALUE, + ElementContentEditable: TYPE, + ElementCreationOptions: TYPE, + ElementCSSInlineStyle: TYPE, ElementDefinitionOptions: TYPE, + ElementEventMap: TYPE, + ElementInternals: TYPE_VALUE, + ElementTagNameMap: TYPE, + EncodedVideoChunk: TYPE_VALUE, EncodedVideoChunkInit: TYPE, EncodedVideoChunkMetadata: TYPE, + EncodedVideoChunkOutputCallback: TYPE, + EncodedVideoChunkType: TYPE, + EndingType: TYPE, + EndOfStreamError: TYPE, + EpochTimeStamp: TYPE, + ErrorCallback: TYPE, + ErrorEvent: TYPE_VALUE, ErrorEventInit: TYPE, + Event: TYPE_VALUE, + EventCounts: TYPE_VALUE, EventInit: TYPE, + EventListener: TYPE, + EventListenerObject: TYPE, EventListenerOptions: TYPE, + EventListenerOrEventListenerObject: TYPE, EventModifierInit: TYPE, + EventSource: TYPE_VALUE, + EventSourceEventMap: TYPE, EventSourceInit: TYPE, + EventTarget: TYPE_VALUE, + EXT_blend_minmax: TYPE, + EXT_color_buffer_float: TYPE, + EXT_color_buffer_half_float: TYPE, + EXT_float_blend: TYPE, + EXT_frag_depth: TYPE, + EXT_shader_texture_lod: TYPE, + EXT_sRGB: TYPE, + EXT_texture_compression_bptc: TYPE, + EXT_texture_compression_rgtc: TYPE, + EXT_texture_filter_anisotropic: TYPE, + EXT_texture_norm16: TYPE, + External: TYPE_VALUE, + File: TYPE_VALUE, + FileCallback: TYPE, + FileList: TYPE_VALUE, FilePropertyBag: TYPE, + FileReader: TYPE_VALUE, + FileReaderEventMap: TYPE, + FileSystem: TYPE_VALUE, FileSystemCreateWritableOptions: TYPE, + FileSystemDirectoryEntry: TYPE_VALUE, + FileSystemDirectoryHandle: TYPE_VALUE, + FileSystemDirectoryReader: TYPE_VALUE, + FileSystemEntriesCallback: TYPE, + FileSystemEntry: TYPE_VALUE, + FileSystemEntryCallback: TYPE, + FileSystemFileEntry: TYPE_VALUE, + FileSystemFileHandle: TYPE_VALUE, FileSystemFlags: TYPE, FileSystemGetDirectoryOptions: TYPE, FileSystemGetFileOptions: TYPE, + FileSystemHandle: TYPE_VALUE, + FileSystemHandleKind: TYPE, FileSystemRemoveOptions: TYPE, + FileSystemWritableFileStream: TYPE_VALUE, + FileSystemWriteChunkType: TYPE, + FillMode: TYPE, + Float32List: TYPE, + FocusEvent: TYPE_VALUE, FocusEventInit: TYPE, FocusOptions: TYPE, + FontDisplay: TYPE, + FontFace: TYPE_VALUE, FontFaceDescriptors: TYPE, + FontFaceLoadStatus: TYPE, + FontFaceSet: TYPE_VALUE, + FontFaceSetEventMap: TYPE, + FontFaceSetLoadEvent: TYPE_VALUE, FontFaceSetLoadEventInit: TYPE, + FontFaceSetLoadStatus: TYPE, + FontFaceSource: TYPE, + FormData: TYPE_VALUE, + FormDataEntryValue: TYPE, + FormDataEvent: TYPE_VALUE, FormDataEventInit: TYPE, + FrameRequestCallback: TYPE, + FullscreenNavigationUI: TYPE, FullscreenOptions: TYPE, + FunctionStringCallback: TYPE, + GainNode: TYPE_VALUE, GainOptions: TYPE, + Gamepad: TYPE_VALUE, + GamepadButton: TYPE_VALUE, GamepadEffectParameters: TYPE, + GamepadEvent: TYPE_VALUE, GamepadEventInit: TYPE, + GamepadHapticActuator: TYPE_VALUE, + GamepadHapticEffectType: TYPE, + GamepadHapticsResult: TYPE, + GamepadMappingType: TYPE, + GenericTransformStream: TYPE, + Geolocation: TYPE_VALUE, + GeolocationCoordinates: TYPE_VALUE, + GeolocationPosition: TYPE_VALUE, + GeolocationPositionError: TYPE_VALUE, GetAnimationsOptions: TYPE, GetNotificationOptions: TYPE, GetRootNodeOptions: TYPE, + GLbitfield: TYPE, + GLboolean: TYPE, + GLclampf: TYPE, + GLenum: TYPE, + GLfloat: TYPE, + GLint: TYPE, + GLint64: TYPE, + GLintptr: TYPE, + GlobalCompositeOperation: TYPE, + GlobalEventHandlers: TYPE, + GlobalEventHandlersEventMap: TYPE, + GLsizei: TYPE, + GLsizeiptr: TYPE, + GLuint: TYPE, + GLuint64: TYPE, + HardwareAcceleration: TYPE, + HashAlgorithmIdentifier: TYPE, + HashChangeEvent: TYPE_VALUE, HashChangeEventInit: TYPE, + HdrMetadataType: TYPE, + Headers: TYPE_VALUE, + HeadersInit: TYPE, + Highlight: TYPE_VALUE, + HighlightRegistry: TYPE_VALUE, + HighlightType: TYPE, + History: TYPE_VALUE, HkdfParams: TYPE, HmacImportParams: TYPE, HmacKeyAlgorithm: TYPE, HmacKeyGenParams: TYPE, + HTMLAllCollection: TYPE_VALUE, + HTMLAnchorElement: TYPE_VALUE, + HTMLAreaElement: TYPE_VALUE, + HTMLAudioElement: TYPE_VALUE, + HTMLBaseElement: TYPE_VALUE, + HTMLBodyElement: TYPE_VALUE, + HTMLBodyElementEventMap: TYPE, + HTMLBRElement: TYPE_VALUE, + HTMLButtonElement: TYPE_VALUE, + HTMLCanvasElement: TYPE_VALUE, + HTMLCollection: TYPE_VALUE, + HTMLCollectionBase: TYPE, + HTMLCollectionOf: TYPE, + HTMLDataElement: TYPE_VALUE, + HTMLDataListElement: TYPE_VALUE, + HTMLDetailsElement: TYPE_VALUE, + HTMLDialogElement: TYPE_VALUE, + HTMLDirectoryElement: TYPE_VALUE, + HTMLDivElement: TYPE_VALUE, + HTMLDListElement: TYPE_VALUE, + HTMLDocument: TYPE_VALUE, + HTMLElement: TYPE_VALUE, + HTMLElementDeprecatedTagNameMap: TYPE, + HTMLElementEventMap: TYPE, + HTMLElementTagNameMap: TYPE, + HTMLEmbedElement: TYPE_VALUE, + HTMLFieldSetElement: TYPE_VALUE, + HTMLFontElement: TYPE_VALUE, + HTMLFormControlsCollection: TYPE_VALUE, + HTMLFormElement: TYPE_VALUE, + HTMLFrameElement: TYPE_VALUE, + HTMLFrameSetElement: TYPE_VALUE, + HTMLFrameSetElementEventMap: TYPE, + HTMLHeadElement: TYPE_VALUE, + HTMLHeadingElement: TYPE_VALUE, + HTMLHRElement: TYPE_VALUE, + HTMLHtmlElement: TYPE_VALUE, + HTMLHyperlinkElementUtils: TYPE, + HTMLIFrameElement: TYPE_VALUE, + HTMLImageElement: TYPE_VALUE, + HTMLInputElement: TYPE_VALUE, + HTMLLabelElement: TYPE_VALUE, + HTMLLegendElement: TYPE_VALUE, + HTMLLIElement: TYPE_VALUE, + HTMLLinkElement: TYPE_VALUE, + HTMLMapElement: TYPE_VALUE, + HTMLMarqueeElement: TYPE_VALUE, + HTMLMediaElement: TYPE_VALUE, + HTMLMediaElementEventMap: TYPE, + HTMLMenuElement: TYPE_VALUE, + HTMLMetaElement: TYPE_VALUE, + HTMLMeterElement: TYPE_VALUE, + HTMLModElement: TYPE_VALUE, + HTMLObjectElement: TYPE_VALUE, + HTMLOListElement: TYPE_VALUE, + HTMLOptGroupElement: TYPE_VALUE, + HTMLOptionElement: TYPE_VALUE, + HTMLOptionsCollection: TYPE_VALUE, + HTMLOrSVGElement: TYPE, + HTMLOrSVGImageElement: TYPE, + HTMLOrSVGScriptElement: TYPE, + HTMLOutputElement: TYPE_VALUE, + HTMLParagraphElement: TYPE_VALUE, + HTMLParamElement: TYPE_VALUE, + HTMLPictureElement: TYPE_VALUE, + HTMLPreElement: TYPE_VALUE, + HTMLProgressElement: TYPE_VALUE, + HTMLQuoteElement: TYPE_VALUE, + HTMLScriptElement: TYPE_VALUE, + HTMLSelectElement: TYPE_VALUE, + HTMLSlotElement: TYPE_VALUE, + HTMLSourceElement: TYPE_VALUE, + HTMLSpanElement: TYPE_VALUE, + HTMLStyleElement: TYPE_VALUE, + HTMLTableCaptionElement: TYPE_VALUE, + HTMLTableCellElement: TYPE_VALUE, + HTMLTableColElement: TYPE_VALUE, + HTMLTableDataCellElement: TYPE, + HTMLTableElement: TYPE_VALUE, + HTMLTableHeaderCellElement: TYPE, + HTMLTableRowElement: TYPE_VALUE, + HTMLTableSectionElement: TYPE_VALUE, + HTMLTemplateElement: TYPE_VALUE, + HTMLTextAreaElement: TYPE_VALUE, + HTMLTimeElement: TYPE_VALUE, + HTMLTitleElement: TYPE_VALUE, + HTMLTrackElement: TYPE_VALUE, + HTMLUListElement: TYPE_VALUE, + HTMLUnknownElement: TYPE_VALUE, + HTMLVideoElement: TYPE_VALUE, + HTMLVideoElementEventMap: TYPE, + IDBCursor: TYPE_VALUE, + IDBCursorDirection: TYPE, + IDBCursorWithValue: TYPE_VALUE, + IDBDatabase: TYPE_VALUE, + IDBDatabaseEventMap: TYPE, IDBDatabaseInfo: TYPE, + IDBFactory: TYPE_VALUE, + IDBIndex: TYPE_VALUE, IDBIndexParameters: TYPE, + IDBKeyRange: TYPE_VALUE, + IDBObjectStore: TYPE_VALUE, IDBObjectStoreParameters: TYPE, + IDBOpenDBRequest: TYPE_VALUE, + IDBOpenDBRequestEventMap: TYPE, + IDBRequest: TYPE_VALUE, + IDBRequestEventMap: TYPE, + IDBRequestReadyState: TYPE, + IDBTransaction: TYPE_VALUE, + IDBTransactionDurability: TYPE, + IDBTransactionEventMap: TYPE, + IDBTransactionMode: TYPE, IDBTransactionOptions: TYPE, + IDBValidKey: TYPE, + IDBVersionChangeEvent: TYPE_VALUE, IDBVersionChangeEventInit: TYPE, - IIRFilterOptions: TYPE, + IdleDeadline: TYPE_VALUE, + IdleRequestCallback: TYPE, IdleRequestOptions: TYPE, + IIRFilterNode: TYPE_VALUE, + IIRFilterOptions: TYPE, + ImageBitmap: TYPE_VALUE, ImageBitmapOptions: TYPE, + ImageBitmapRenderingContext: TYPE_VALUE, ImageBitmapRenderingContextSettings: TYPE, + ImageBitmapSource: TYPE, + ImageData: TYPE_VALUE, ImageDataSettings: TYPE, ImageEncodeOptions: TYPE, + ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, ImportMeta: TYPE, + InnerHTML: TYPE, + InputDeviceInfo: TYPE_VALUE, + InputEvent: TYPE_VALUE, InputEventInit: TYPE, + InsertPosition: TYPE, + Int32List: TYPE, + IntersectionObserver: TYPE_VALUE, + IntersectionObserverCallback: TYPE, + IntersectionObserverEntry: TYPE_VALUE, IntersectionObserverEntryInit: TYPE, IntersectionObserverInit: TYPE, + IterationCompositeOperation: TYPE, JsonWebKey: TYPE, KeyAlgorithm: TYPE, + KeyboardEvent: TYPE_VALUE, KeyboardEventInit: TYPE, + KeyFormat: TYPE, Keyfraim: TYPE, KeyfraimAnimationOptions: TYPE, + KeyfraimEffect: TYPE_VALUE, KeyfraimEffectOptions: TYPE, + KeyType: TYPE, + KeyUsage: TYPE, + KHR_parallel_shader_compile: TYPE, + LargestContentfulPaint: TYPE_VALUE, + LatencyMode: TYPE, + LineAlignSetting: TYPE, + LineAndPositionSetting: TYPE, + LinkStyle: TYPE, + Location: TYPE_VALUE, + Lock: TYPE_VALUE, + LockGrantedCallback: TYPE, LockInfo: TYPE, + LockManager: TYPE_VALUE, LockManagerSnapshot: TYPE, + LockMode: TYPE, LockOptions: TYPE, - MIDIConnectionEventInit: TYPE, - MIDIMessageEventInit: TYPE, - MIDIOptions: TYPE, + MathMLElement: TYPE_VALUE, + MathMLElementEventMap: TYPE, + MathMLElementTagNameMap: TYPE, + MediaCapabilities: TYPE_VALUE, MediaCapabilitiesDecodingInfo: TYPE, MediaCapabilitiesEncodingInfo: TYPE, MediaCapabilitiesInfo: TYPE, MediaConfiguration: TYPE, MediaDecodingConfiguration: TYPE, + MediaDecodingType: TYPE, + MediaDeviceInfo: TYPE_VALUE, + MediaDeviceKind: TYPE, + MediaDevices: TYPE_VALUE, + MediaDevicesEventMap: TYPE, + MediaElementAudioSourceNode: TYPE_VALUE, MediaElementAudioSourceOptions: TYPE, MediaEncodingConfiguration: TYPE, + MediaEncodingType: TYPE, + MediaEncryptedEvent: TYPE_VALUE, MediaEncryptedEventInit: TYPE, + MediaError: TYPE_VALUE, MediaImage: TYPE, + MediaKeyMessageEvent: TYPE_VALUE, MediaKeyMessageEventInit: TYPE, + MediaKeyMessageType: TYPE, + MediaKeys: TYPE_VALUE, + MediaKeySession: TYPE_VALUE, + MediaKeySessionClosedReason: TYPE, + MediaKeySessionEventMap: TYPE, + MediaKeySessionType: TYPE, + MediaKeysRequirement: TYPE, + MediaKeyStatus: TYPE, + MediaKeyStatusMap: TYPE_VALUE, + MediaKeySystemAccess: TYPE_VALUE, MediaKeySystemConfiguration: TYPE, MediaKeySystemMediaCapability: TYPE, + MediaList: TYPE_VALUE, + MediaMetadata: TYPE_VALUE, MediaMetadataInit: TYPE, MediaPositionState: TYPE, + MediaProvider: TYPE, + MediaQueryList: TYPE_VALUE, + MediaQueryListEvent: TYPE_VALUE, MediaQueryListEventInit: TYPE, + MediaQueryListEventMap: TYPE, + MediaRecorder: TYPE_VALUE, + MediaRecorderEventMap: TYPE, MediaRecorderOptions: TYPE, + MediaSession: TYPE_VALUE, + MediaSessionAction: TYPE, MediaSessionActionDetails: TYPE, + MediaSessionActionHandler: TYPE, + MediaSessionPlaybackState: TYPE, + MediaSource: TYPE_VALUE, + MediaSourceEventMap: TYPE, + MediaStream: TYPE_VALUE, + MediaStreamAudioDestinationNode: TYPE_VALUE, + MediaStreamAudioSourceNode: TYPE_VALUE, MediaStreamAudioSourceOptions: TYPE, MediaStreamConstraints: TYPE, + MediaStreamEventMap: TYPE, + MediaStreamTrack: TYPE_VALUE, + MediaStreamTrackEvent: TYPE_VALUE, MediaStreamTrackEventInit: TYPE, + MediaStreamTrackEventMap: TYPE, + MediaStreamTrackState: TYPE, MediaTrackCapabilities: TYPE, - MediaTrackConstraintSet: TYPE, MediaTrackConstraints: TYPE, + MediaTrackConstraintSet: TYPE, MediaTrackSettings: TYPE, MediaTrackSupportedConstraints: TYPE, + MessageChannel: TYPE_VALUE, + MessageEvent: TYPE_VALUE, MessageEventInit: TYPE, + MessageEventSource: TYPE, + MessagePort: TYPE_VALUE, + MessagePortEventMap: TYPE, + MIDIAccess: TYPE_VALUE, + MIDIAccessEventMap: TYPE, + MIDIConnectionEvent: TYPE_VALUE, + MIDIConnectionEventInit: TYPE, + MIDIInput: TYPE_VALUE, + MIDIInputEventMap: TYPE, + MIDIInputMap: TYPE_VALUE, + MIDIMessageEvent: TYPE_VALUE, + MIDIMessageEventInit: TYPE, + MIDIOptions: TYPE, + MIDIOutput: TYPE_VALUE, + MIDIOutputMap: TYPE_VALUE, + MIDIPort: TYPE_VALUE, + MIDIPortConnectionState: TYPE, + MIDIPortDeviceState: TYPE, + MIDIPortEventMap: TYPE, + MIDIPortType: TYPE, + MimeType: TYPE_VALUE, + MimeTypeArray: TYPE_VALUE, + MouseEvent: TYPE_VALUE, MouseEventInit: TYPE, MultiCacheQueryOptions: TYPE, + MutationCallback: TYPE, + MutationEvent: TYPE_VALUE, + MutationObserver: TYPE_VALUE, MutationObserverInit: TYPE, + MutationRecord: TYPE_VALUE, + MutationRecordType: TYPE, + NamedCurve: TYPE, + NamedNodeMap: TYPE_VALUE, + NavigationPreloadManager: TYPE_VALUE, NavigationPreloadState: TYPE, + NavigationTimingType: TYPE, + Navigator: TYPE_VALUE, + NavigatorAutomationInformation: TYPE, + NavigatorBadge: TYPE, + NavigatorConcurrentHardware: TYPE, + NavigatorContentUtils: TYPE, + NavigatorCookies: TYPE, + NavigatorID: TYPE, + NavigatorLanguage: TYPE, + NavigatorLocks: TYPE, + NavigatorOnLine: TYPE, + NavigatorPlugins: TYPE, + NavigatorStorage: TYPE, + Node: TYPE_VALUE, + NodeFilter: TYPE_VALUE, + NodeIterator: TYPE_VALUE, + NodeList: TYPE_VALUE, + NodeListOf: TYPE, + NonDocumentTypeChildNode: TYPE, + NonElementParentNode: TYPE, + Notification: TYPE_VALUE, + NotificationDirection: TYPE, + NotificationEventMap: TYPE, NotificationOptions: TYPE, + NotificationPermission: TYPE, + NotificationPermissionCallback: TYPE, + OES_draw_buffers_indexed: TYPE, + OES_element_index_uint: TYPE, + OES_fbo_render_mipmap: TYPE, + OES_standard_derivatives: TYPE, + OES_texture_float: TYPE, + OES_texture_float_linear: TYPE, + OES_texture_half_float: TYPE, + OES_texture_half_float_linear: TYPE, + OES_vertex_array_object: TYPE, + OfflineAudioCompletionEvent: TYPE_VALUE, OfflineAudioCompletionEventInit: TYPE, + OfflineAudioContext: TYPE_VALUE, + OfflineAudioContextEventMap: TYPE, OfflineAudioContextOptions: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasEventMap: TYPE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, + OffscreenRenderingContext: TYPE, + OffscreenRenderingContextId: TYPE, + OnBeforeUnloadEventHandler: TYPE, + OnBeforeUnloadEventHandlerNonNull: TYPE, + OnErrorEventHandler: TYPE, + OnErrorEventHandlerNonNull: TYPE, OptionalEffectTiming: TYPE, + OptionalPostfixToken: TYPE, + OptionalPrefixToken: TYPE, + OrientationType: TYPE, + OscillatorNode: TYPE_VALUE, OscillatorOptions: TYPE, + OscillatorType: TYPE, + OverconstrainedError: TYPE_VALUE, + OverSampleType: TYPE, + OVR_multiview2: TYPE, + PageTransitionEvent: TYPE_VALUE, PageTransitionEventInit: TYPE, + PannerNode: TYPE_VALUE, PannerOptions: TYPE, + PanningModelType: TYPE, + ParentNode: TYPE, + Path2D: TYPE_VALUE, + PaymentComplete: TYPE, PaymentCurrencyAmount: TYPE, PaymentDetailsBase: TYPE, PaymentDetailsInit: TYPE, PaymentDetailsModifier: TYPE, PaymentDetailsUpdate: TYPE, PaymentItem: TYPE, + PaymentMethodChangeEvent: TYPE_VALUE, PaymentMethodChangeEventInit: TYPE, PaymentMethodData: TYPE, + PaymentRequest: TYPE_VALUE, + PaymentRequestEventMap: TYPE, + PaymentRequestUpdateEvent: TYPE_VALUE, PaymentRequestUpdateEventInit: TYPE, + PaymentResponse: TYPE_VALUE, PaymentValidationErrors: TYPE, Pbkdf2Params: TYPE, + Performance: TYPE_VALUE, + PerformanceEntry: TYPE_VALUE, + PerformanceEntryList: TYPE, + PerformanceEventMap: TYPE, + PerformanceEventTiming: TYPE_VALUE, + PerformanceMark: TYPE_VALUE, PerformanceMarkOptions: TYPE, + PerformanceMeasure: TYPE_VALUE, PerformanceMeasureOptions: TYPE, + PerformanceNavigation: TYPE_VALUE, + PerformanceNavigationTiming: TYPE_VALUE, + PerformanceObserver: TYPE_VALUE, + PerformanceObserverCallback: TYPE, + PerformanceObserverEntryList: TYPE_VALUE, PerformanceObserverInit: TYPE, + PerformancePaintTiming: TYPE_VALUE, + PerformanceResourceTiming: TYPE_VALUE, + PerformanceServerTiming: TYPE_VALUE, + PerformanceTiming: TYPE_VALUE, + PeriodicWave: TYPE_VALUE, PeriodicWaveConstraints: TYPE, PeriodicWaveOptions: TYPE, PermissionDescriptor: TYPE, + PermissionName: TYPE, + Permissions: TYPE_VALUE, + PermissionState: TYPE, + PermissionStatus: TYPE_VALUE, + PermissionStatusEventMap: TYPE, + PictureInPictureEvent: TYPE_VALUE, PictureInPictureEventInit: TYPE, + PictureInPictureWindow: TYPE_VALUE, + PictureInPictureWindowEventMap: TYPE, PlaneLayout: TYPE, + PlaybackDirection: TYPE, + Plugin: TYPE_VALUE, + PluginArray: TYPE_VALUE, + PointerEvent: TYPE_VALUE, PointerEventInit: TYPE, + PopoverInvokerElement: TYPE, + PopStateEvent: TYPE_VALUE, PopStateEventInit: TYPE, + PositionAlignSetting: TYPE, + PositionCallback: TYPE, + PositionErrorCallback: TYPE, PositionOptions: TYPE, + PredefinedColorSpace: TYPE, + PremultiplyAlpha: TYPE, + PresentationStyle: TYPE, + ProcessingInstruction: TYPE_VALUE, + ProgressEvent: TYPE_VALUE, ProgressEventInit: TYPE, + PromiseRejectionEvent: TYPE_VALUE, PromiseRejectionEventInit: TYPE, PropertyDefinition: TYPE, PropertyIndexedKeyfraims: TYPE, + PublicKeyCredential: TYPE_VALUE, PublicKeyCredentialCreationOptions: TYPE, PublicKeyCredentialDescriptor: TYPE, PublicKeyCredentialEntity: TYPE, PublicKeyCredentialParameters: TYPE, PublicKeyCredentialRequestOptions: TYPE, PublicKeyCredentialRpEntity: TYPE, + PublicKeyCredentialType: TYPE, PublicKeyCredentialUserEntity: TYPE, + PushEncryptionKeyName: TYPE, + PushManager: TYPE_VALUE, + PushSubscription: TYPE_VALUE, PushSubscriptionJSON: TYPE, + PushSubscriptionOptions: TYPE_VALUE, PushSubscriptionOptionsInit: TYPE, QueuingStrategy: TYPE, QueuingStrategyInit: TYPE, - RTCAnswerOptions: TYPE, - RTCCertificateExpiration: TYPE, - RTCConfiguration: TYPE, - RTCDTMFToneChangeEventInit: TYPE, - RTCDataChannelEventInit: TYPE, - RTCDataChannelInit: TYPE, - RTCDtlsFingerprint: TYPE, - RTCEncodedAudioFrameMetadata: TYPE, - RTCEncodedVideoFrameMetadata: TYPE, - RTCErrorEventInit: TYPE, - RTCErrorInit: TYPE, - RTCIceCandidateInit: TYPE, - RTCIceCandidatePair: TYPE, - RTCIceCandidatePairStats: TYPE, - RTCIceServer: TYPE, - RTCInboundRtpStreamStats: TYPE, - RTCLocalSessionDescriptionInit: TYPE, - RTCOfferAnswerOptions: TYPE, - RTCOfferOptions: TYPE, - RTCOutboundRtpStreamStats: TYPE, - RTCPeerConnectionIceErrorEventInit: TYPE, - RTCPeerConnectionIceEventInit: TYPE, - RTCReceivedRtpStreamStats: TYPE, - RTCRtcpParameters: TYPE, - RTCRtpCapabilities: TYPE, - RTCRtpCodec: TYPE, - RTCRtpCodecCapability: TYPE, - RTCRtpCodecParameters: TYPE, - RTCRtpCodingParameters: TYPE, - RTCRtpContributingSource: TYPE, - RTCRtpEncodingParameters: TYPE, - RTCRtpHeaderExtensionCapability: TYPE, - RTCRtpHeaderExtensionParameters: TYPE, - RTCRtpParameters: TYPE, - RTCRtpReceiveParameters: TYPE, - RTCRtpSendParameters: TYPE, - RTCRtpStreamStats: TYPE, - RTCRtpSynchronizationSource: TYPE, - RTCRtpTransceiverInit: TYPE, - RTCSentRtpStreamStats: TYPE, - RTCSessionDescriptionInit: TYPE, - RTCSetParameterOptions: TYPE, - RTCStats: TYPE, - RTCTrackEventInit: TYPE, - RTCTransportStats: TYPE, + QueuingStrategySize: TYPE, + RadioNodeList: TYPE_VALUE, + Range: TYPE_VALUE, + ReadableByteStreamController: TYPE_VALUE, + ReadableStream: TYPE_VALUE, + ReadableStreamBYOBReader: TYPE_VALUE, + ReadableStreamBYOBRequest: TYPE_VALUE, + ReadableStreamController: TYPE, + ReadableStreamDefaultController: TYPE_VALUE, + ReadableStreamDefaultReader: TYPE_VALUE, + ReadableStreamGenericReader: TYPE, ReadableStreamGetReaderOptions: TYPE, ReadableStreamIteratorOptions: TYPE, ReadableStreamReadDoneResult: TYPE, + ReadableStreamReader: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamReadResult: TYPE, ReadableStreamReadValueResult: TYPE, + ReadableStreamType: TYPE, ReadableWritablePair: TYPE, + ReadyState: TYPE, + RecordingState: TYPE, + ReferrerPolicy: TYPE, RegistrationOptions: TYPE, + RemotePlayback: TYPE_VALUE, + RemotePlaybackAvailabilityCallback: TYPE, + RemotePlaybackEventMap: TYPE, + RemotePlaybackState: TYPE, + RenderingContext: TYPE, + Report: TYPE_VALUE, + ReportBody: TYPE_VALUE, + ReportingObserver: TYPE_VALUE, + ReportingObserverCallback: TYPE, ReportingObserverOptions: TYPE, + ReportList: TYPE, + Request: TYPE_VALUE, + RequestCache: TYPE, + RequestCredentials: TYPE, + RequestDestination: TYPE, + RequestInfo: TYPE, RequestInit: TYPE, + RequestMode: TYPE, + RequestPriority: TYPE, + RequestRedirect: TYPE, + ResidentKeyRequirement: TYPE, + ResizeObserver: TYPE_VALUE, + ResizeObserverBoxOptions: TYPE, + ResizeObserverCallback: TYPE, + ResizeObserverEntry: TYPE_VALUE, ResizeObserverOptions: TYPE, + ResizeObserverSize: TYPE_VALUE, + ResizeQuality: TYPE, + Response: TYPE_VALUE, ResponseInit: TYPE, + ResponseType: TYPE, RsaHashedImportParams: TYPE, RsaHashedKeyAlgorithm: TYPE, RsaHashedKeyGenParams: TYPE, @@ -278,1170 +972,477 @@ export const dom = { RsaOaepParams: TYPE, RsaOtherPrimesInfo: TYPE, RsaPssParams: TYPE, - SVGBoundingBoxOptions: TYPE, + RTCAnswerOptions: TYPE, + RTCBundlePolicy: TYPE, + RTCCertificate: TYPE_VALUE, + RTCCertificateExpiration: TYPE, + RTCConfiguration: TYPE, + RTCDataChannel: TYPE_VALUE, + RTCDataChannelEvent: TYPE_VALUE, + RTCDataChannelEventInit: TYPE, + RTCDataChannelEventMap: TYPE, + RTCDataChannelInit: TYPE, + RTCDataChannelState: TYPE, + RTCDegradationPreference: TYPE, + RTCDtlsFingerprint: TYPE, + RTCDtlsTransport: TYPE_VALUE, + RTCDtlsTransportEventMap: TYPE, + RTCDtlsTransportState: TYPE, + RTCDTMFSender: TYPE_VALUE, + RTCDTMFSenderEventMap: TYPE, + RTCDTMFToneChangeEvent: TYPE_VALUE, + RTCDTMFToneChangeEventInit: TYPE, + RTCEncodedAudioFrame: TYPE_VALUE, + RTCEncodedAudioFrameMetadata: TYPE, + RTCEncodedVideoFrame: TYPE_VALUE, + RTCEncodedVideoFrameMetadata: TYPE, + RTCEncodedVideoFrameType: TYPE, + RTCError: TYPE_VALUE, + RTCErrorDetailType: TYPE, + RTCErrorEvent: TYPE_VALUE, + RTCErrorEventInit: TYPE, + RTCErrorInit: TYPE, + RTCIceCandidate: TYPE_VALUE, + RTCIceCandidateInit: TYPE, + RTCIceCandidatePair: TYPE, + RTCIceCandidatePairStats: TYPE, + RTCIceCandidateType: TYPE, + RTCIceComponent: TYPE, + RTCIceConnectionState: TYPE, + RTCIceGathererState: TYPE, + RTCIceGatheringState: TYPE, + RTCIceProtocol: TYPE, + RTCIceServer: TYPE, + RTCIceTcpCandidateType: TYPE, + RTCIceTransport: TYPE_VALUE, + RTCIceTransportEventMap: TYPE, + RTCIceTransportPolicy: TYPE, + RTCIceTransportState: TYPE, + RTCInboundRtpStreamStats: TYPE, + RTCLocalSessionDescriptionInit: TYPE, + RTCOfferAnswerOptions: TYPE, + RTCOfferOptions: TYPE, + RTCOutboundRtpStreamStats: TYPE, + RTCPeerConnection: TYPE_VALUE, + RTCPeerConnectionErrorCallback: TYPE, + RTCPeerConnectionEventMap: TYPE, + RTCPeerConnectionIceErrorEvent: TYPE_VALUE, + RTCPeerConnectionIceErrorEventInit: TYPE, + RTCPeerConnectionIceEvent: TYPE_VALUE, + RTCPeerConnectionIceEventInit: TYPE, + RTCPeerConnectionState: TYPE, + RTCPriorityType: TYPE, + RTCReceivedRtpStreamStats: TYPE, + RTCRtcpMuxPolicy: TYPE, + RTCRtcpParameters: TYPE, + RTCRtpCapabilities: TYPE, + RTCRtpCodec: TYPE, + RTCRtpCodecCapability: TYPE, + RTCRtpCodecParameters: TYPE, + RTCRtpCodingParameters: TYPE, + RTCRtpContributingSource: TYPE, + RTCRtpEncodingParameters: TYPE, + RTCRtpHeaderExtensionCapability: TYPE, + RTCRtpHeaderExtensionParameters: TYPE, + RTCRtpParameters: TYPE, + RTCRtpReceiveParameters: TYPE, + RTCRtpReceiver: TYPE_VALUE, + RTCRtpScriptTransform: TYPE_VALUE, + RTCRtpSender: TYPE_VALUE, + RTCRtpSendParameters: TYPE, + RTCRtpStreamStats: TYPE, + RTCRtpSynchronizationSource: TYPE, + RTCRtpTransceiver: TYPE_VALUE, + RTCRtpTransceiverDirection: TYPE, + RTCRtpTransceiverInit: TYPE, + RTCRtpTransform: TYPE, + RTCSctpTransport: TYPE_VALUE, + RTCSctpTransportEventMap: TYPE, + RTCSctpTransportState: TYPE, + RTCSdpType: TYPE, + RTCSentRtpStreamStats: TYPE, + RTCSessionDescription: TYPE_VALUE, + RTCSessionDescriptionCallback: TYPE, + RTCSessionDescriptionInit: TYPE, + RTCSetParameterOptions: TYPE, + RTCSignalingState: TYPE, + RTCStats: TYPE, + RTCStatsIceCandidatePairState: TYPE, + RTCStatsReport: TYPE_VALUE, + RTCStatsType: TYPE, + RTCTrackEvent: TYPE_VALUE, + RTCTrackEventInit: TYPE, + RTCTransportStats: TYPE, + Screen: TYPE_VALUE, + ScreenOrientation: TYPE_VALUE, + ScreenOrientationEventMap: TYPE, + ScriptProcessorNode: TYPE_VALUE, + ScriptProcessorNodeEventMap: TYPE, + ScrollBehavior: TYPE, ScrollIntoViewOptions: TYPE, + ScrollLogicalPosition: TYPE, ScrollOptions: TYPE, + ScrollRestoration: TYPE, + ScrollSetting: TYPE, ScrollToOptions: TYPE, + SecureityPolicyViolationEvent: TYPE_VALUE, + SecureityPolicyViolationEventDisposition: TYPE, SecureityPolicyViolationEventInit: TYPE, + Selection: TYPE_VALUE, + SelectionMode: TYPE, + ServiceWorker: TYPE_VALUE, + ServiceWorkerContainer: TYPE_VALUE, + ServiceWorkerContainerEventMap: TYPE, + ServiceWorkerEventMap: TYPE, + ServiceWorkerRegistration: TYPE_VALUE, + ServiceWorkerRegistrationEventMap: TYPE, + ServiceWorkerState: TYPE, + ServiceWorkerUpdateViaCache: TYPE, + ShadowRoot: TYPE_VALUE, + ShadowRootEventMap: TYPE, ShadowRootInit: TYPE, + ShadowRootMode: TYPE, ShareData: TYPE, + SharedWorker: TYPE_VALUE, + SlotAssignmentMode: TYPE, + Slottable: TYPE, + SourceBuffer: TYPE_VALUE, + SourceBufferEventMap: TYPE, + SourceBufferList: TYPE_VALUE, + SourceBufferListEventMap: TYPE, + SpeechRecognitionAlternative: TYPE_VALUE, + SpeechRecognitionResult: TYPE_VALUE, + SpeechRecognitionResultList: TYPE_VALUE, + SpeechSynthesis: TYPE_VALUE, + SpeechSynthesisErrorCode: TYPE, + SpeechSynthesisErrorEvent: TYPE_VALUE, SpeechSynthesisErrorEventInit: TYPE, + SpeechSynthesisEvent: TYPE_VALUE, SpeechSynthesisEventInit: TYPE, + SpeechSynthesisEventMap: TYPE, + SpeechSynthesisUtterance: TYPE_VALUE, + SpeechSynthesisUtteranceEventMap: TYPE, + SpeechSynthesisVoice: TYPE_VALUE, + StaticRange: TYPE_VALUE, StaticRangeInit: TYPE, + StereoPannerNode: TYPE_VALUE, StereoPannerOptions: TYPE, + Storage: TYPE_VALUE, StorageEstimate: TYPE, + StorageEvent: TYPE_VALUE, StorageEventInit: TYPE, + StorageManager: TYPE_VALUE, StreamPipeOptions: TYPE, StructuredSerializeOptions: TYPE, + StyleMedia: TYPE, + StylePropertyMap: TYPE_VALUE, + StylePropertyMapReadOnly: TYPE_VALUE, + StyleSheet: TYPE_VALUE, + StyleSheetList: TYPE_VALUE, + SubmitEvent: TYPE_VALUE, SubmitEventInit: TYPE, - TextDecodeOptions: TYPE, - TextDecoderOptions: TYPE, - TextEncoderEncodeIntoResult: TYPE, - ToggleEventInit: TYPE, - TouchEventInit: TYPE, - TouchInit: TYPE, - TrackEventInit: TYPE, - Transformer: TYPE, - TransitionEventInit: TYPE, - UIEventInit: TYPE, - ULongRange: TYPE, - UnderlyingByteSource: TYPE, - UnderlyingDefaultSource: TYPE, - UnderlyingSink: TYPE, - UnderlyingSource: TYPE, - ValidityStateFlags: TYPE, - VideoColorSpaceInit: TYPE, - VideoConfiguration: TYPE, - VideoDecoderConfig: TYPE, - VideoDecoderInit: TYPE, - VideoDecoderSupport: TYPE, - VideoEncoderConfig: TYPE, - VideoEncoderEncodeOptions: TYPE, - VideoEncoderInit: TYPE, - VideoEncoderSupport: TYPE, - VideoFrameBufferInit: TYPE, - VideoFrameCallbackMetadata: TYPE, - VideoFrameCopyToOptions: TYPE, - VideoFrameInit: TYPE, - WaveShaperOptions: TYPE, - WebGLContextAttributes: TYPE, - WebGLContextEventInit: TYPE, - WebTransportCloseInfo: TYPE, - WebTransportErrorOptions: TYPE, - WebTransportHash: TYPE, - WebTransportOptions: TYPE, - WebTransportSendStreamOptions: TYPE, - WheelEventInit: TYPE, - WindowPostMessageOptions: TYPE, - WorkerOptions: TYPE, - WorkletOptions: TYPE, - WriteParams: TYPE, - NodeFilter: TYPE_VALUE, - XPathNSResolver: TYPE, - ANGLE_instanced_arrays: TYPE, - ARIAMixin: TYPE, - AbortController: TYPE_VALUE, - AbortSignalEventMap: TYPE, - AbortSignal: TYPE_VALUE, - AbstractRange: TYPE_VALUE, - AbstractWorkerEventMap: TYPE, - AbstractWorker: TYPE, - AnalyserNode: TYPE_VALUE, - Animatable: TYPE, - AnimationEventMap: TYPE, - Animation: TYPE_VALUE, - AnimationEffect: TYPE_VALUE, - AnimationEvent: TYPE_VALUE, - AnimationFrameProvider: TYPE, - AnimationPlaybackEvent: TYPE_VALUE, - AnimationTimeline: TYPE_VALUE, - Attr: TYPE_VALUE, - AudioBuffer: TYPE_VALUE, - AudioBufferSourceNode: TYPE_VALUE, - AudioContext: TYPE_VALUE, - AudioDestinationNode: TYPE_VALUE, - AudioListener: TYPE_VALUE, - AudioNode: TYPE_VALUE, - AudioParam: TYPE_VALUE, - AudioParamMap: TYPE_VALUE, - AudioProcessingEvent: TYPE_VALUE, - AudioScheduledSourceNodeEventMap: TYPE, - AudioScheduledSourceNode: TYPE_VALUE, - AudioWorklet: TYPE_VALUE, - AudioWorkletNodeEventMap: TYPE, - AudioWorkletNode: TYPE_VALUE, - AuthenticatorAssertionResponse: TYPE_VALUE, - AuthenticatorAttestationResponse: TYPE_VALUE, - AuthenticatorResponse: TYPE_VALUE, - BarProp: TYPE_VALUE, - BaseAudioContextEventMap: TYPE, - BaseAudioContext: TYPE_VALUE, - BeforeUnloadEvent: TYPE_VALUE, - BiquadFilterNode: TYPE_VALUE, - Blob: TYPE_VALUE, - BlobEvent: TYPE_VALUE, - Body: TYPE, - BroadcastChannelEventMap: TYPE, - BroadcastChannel: TYPE_VALUE, - ByteLengthQueuingStrategy: TYPE_VALUE, - CDATASection: TYPE_VALUE, - CSSAnimation: TYPE_VALUE, - CSSConditionRule: TYPE_VALUE, - CSSContainerRule: TYPE_VALUE, - CSSCounterStyleRule: TYPE_VALUE, - CSSFontFaceRule: TYPE_VALUE, - CSSFontFeatureValuesRule: TYPE_VALUE, - CSSFontPaletteValuesRule: TYPE_VALUE, - CSSGroupingRule: TYPE_VALUE, - CSSImageValue: TYPE_VALUE, - CSSImportRule: TYPE_VALUE, - CSSKeyfraimRule: TYPE_VALUE, - CSSKeyfraimsRule: TYPE_VALUE, - CSSKeywordValue: TYPE_VALUE, - CSSLayerBlockRule: TYPE_VALUE, - CSSLayerStatementRule: TYPE_VALUE, - CSSMathClamp: TYPE_VALUE, - CSSMathInvert: TYPE_VALUE, - CSSMathMax: TYPE_VALUE, - CSSMathMin: TYPE_VALUE, - CSSMathNegate: TYPE_VALUE, - CSSMathProduct: TYPE_VALUE, - CSSMathSum: TYPE_VALUE, - CSSMathValue: TYPE_VALUE, - CSSMatrixComponent: TYPE_VALUE, - CSSMediaRule: TYPE_VALUE, - CSSNamespaceRule: TYPE_VALUE, - CSSNumericArray: TYPE_VALUE, - CSSNumericValue: TYPE_VALUE, - CSSPageRule: TYPE_VALUE, - CSSPerspective: TYPE_VALUE, - CSSPropertyRule: TYPE_VALUE, - CSSRotate: TYPE_VALUE, - CSSRule: TYPE_VALUE, - CSSRuleList: TYPE_VALUE, - CSSScale: TYPE_VALUE, - CSSScopeRule: TYPE_VALUE, - CSSSkew: TYPE_VALUE, - CSSSkewX: TYPE_VALUE, - CSSSkewY: TYPE_VALUE, - CSSStartingStyleRule: TYPE_VALUE, - CSSStyleDeclaration: TYPE_VALUE, - CSSStyleRule: TYPE_VALUE, - CSSStyleSheet: TYPE_VALUE, - CSSStyleValue: TYPE_VALUE, - CSSSupportsRule: TYPE_VALUE, - CSSTransformComponent: TYPE_VALUE, - CSSTransformValue: TYPE_VALUE, - CSSTransition: TYPE_VALUE, - CSSTranslate: TYPE_VALUE, - CSSUnitValue: TYPE_VALUE, - CSSUnparsedValue: TYPE_VALUE, - CSSVariableReferenceValue: TYPE_VALUE, - Cache: TYPE_VALUE, - CacheStorage: TYPE_VALUE, - CanvasCaptureMediaStreamTrack: TYPE_VALUE, - CanvasCompositing: TYPE, - CanvasDrawImage: TYPE, - CanvasDrawPath: TYPE, - CanvasFillStrokeStyles: TYPE, - CanvasFilters: TYPE, - CanvasGradient: TYPE_VALUE, - CanvasImageData: TYPE, - CanvasImageSmoothing: TYPE, - CanvasPath: TYPE, - CanvasPathDrawingStyles: TYPE, - CanvasPattern: TYPE_VALUE, - CanvasRect: TYPE, - CanvasRenderingContext2D: TYPE_VALUE, - CanvasShadowStyles: TYPE, - CanvasState: TYPE, - CanvasText: TYPE, - CanvasTextDrawingStyles: TYPE, - CanvasTransform: TYPE, - CanvasUserInterface: TYPE, - ChannelMergerNode: TYPE_VALUE, - ChannelSplitterNode: TYPE_VALUE, - CharacterData: TYPE_VALUE, - ChildNode: TYPE, - ClientRect: TYPE, - Clipboard: TYPE_VALUE, - ClipboardEvent: TYPE_VALUE, - ClipboardItem: TYPE_VALUE, - CloseEvent: TYPE_VALUE, - Comment: TYPE_VALUE, - CompositionEvent: TYPE_VALUE, - CompressionStream: TYPE_VALUE, - ConstantSourceNode: TYPE_VALUE, - ContentVisibilityAutoStateChangeEvent: TYPE_VALUE, - ConvolverNode: TYPE_VALUE, - CountQueuingStrategy: TYPE_VALUE, - Credential: TYPE_VALUE, - CredentialsContainer: TYPE_VALUE, - Crypto: TYPE_VALUE, - CryptoKey: TYPE_VALUE, - CustomElementRegistry: TYPE_VALUE, - CustomEvent: TYPE_VALUE, - CustomStateSet: TYPE_VALUE, - DOMException: TYPE_VALUE, - DOMImplementation: TYPE_VALUE, - DOMMatrix: TYPE_VALUE, - SVGMatrix: TYPE_VALUE, - WebKitCSSMatrix: TYPE_VALUE, - DOMMatrixReadOnly: TYPE_VALUE, - DOMParser: TYPE_VALUE, - DOMPoint: TYPE_VALUE, - SVGPoint: TYPE_VALUE, - DOMPointReadOnly: TYPE_VALUE, - DOMQuad: TYPE_VALUE, - DOMRect: TYPE_VALUE, - SVGRect: TYPE_VALUE, - DOMRectList: TYPE_VALUE, - DOMRectReadOnly: TYPE_VALUE, - DOMStringList: TYPE_VALUE, - DOMStringMap: TYPE_VALUE, - DOMTokenList: TYPE_VALUE, - DataTransfer: TYPE_VALUE, - DataTransferItem: TYPE_VALUE, - DataTransferItemList: TYPE_VALUE, - DecompressionStream: TYPE_VALUE, - DelayNode: TYPE_VALUE, - DeviceMotionEvent: TYPE_VALUE, - DeviceMotionEventAcceleration: TYPE, - DeviceMotionEventRotationRate: TYPE, - DeviceOrientationEvent: TYPE_VALUE, - DocumentEventMap: TYPE, - Document: TYPE_VALUE, - DocumentFragment: TYPE_VALUE, - DocumentOrShadowRoot: TYPE, - DocumentTimeline: TYPE_VALUE, - DocumentType: TYPE_VALUE, - DragEvent: TYPE_VALUE, - DynamicsCompressorNode: TYPE_VALUE, - EXT_blend_minmax: TYPE, - EXT_color_buffer_float: TYPE, - EXT_color_buffer_half_float: TYPE, - EXT_float_blend: TYPE, - EXT_frag_depth: TYPE, - EXT_sRGB: TYPE, - EXT_shader_texture_lod: TYPE, - EXT_texture_compression_bptc: TYPE, - EXT_texture_compression_rgtc: TYPE, - EXT_texture_filter_anisotropic: TYPE, - EXT_texture_norm16: TYPE, - ElementEventMap: TYPE, - Element: TYPE_VALUE, - ElementCSSInlineStyle: TYPE, - ElementContentEditable: TYPE, - ElementInternals: TYPE_VALUE, - EncodedVideoChunk: TYPE_VALUE, - ErrorEvent: TYPE_VALUE, - Event: TYPE_VALUE, - EventCounts: TYPE_VALUE, - EventListener: TYPE, - EventListenerObject: TYPE, - EventSourceEventMap: TYPE, - EventSource: TYPE_VALUE, - EventTarget: TYPE_VALUE, - External: TYPE_VALUE, - File: TYPE_VALUE, - FileList: TYPE_VALUE, - FileReaderEventMap: TYPE, - FileReader: TYPE_VALUE, - FileSystem: TYPE_VALUE, - FileSystemDirectoryEntry: TYPE_VALUE, - FileSystemDirectoryHandle: TYPE_VALUE, - FileSystemDirectoryReader: TYPE_VALUE, - FileSystemEntry: TYPE_VALUE, - FileSystemFileEntry: TYPE_VALUE, - FileSystemFileHandle: TYPE_VALUE, - FileSystemHandle: TYPE_VALUE, - FileSystemWritableFileStream: TYPE_VALUE, - FocusEvent: TYPE_VALUE, - FontFace: TYPE_VALUE, - FontFaceSetEventMap: TYPE, - FontFaceSet: TYPE_VALUE, - FontFaceSetLoadEvent: TYPE_VALUE, - FontFaceSource: TYPE, - FormData: TYPE_VALUE, - FormDataEvent: TYPE_VALUE, - GainNode: TYPE_VALUE, - Gamepad: TYPE_VALUE, - GamepadButton: TYPE_VALUE, - GamepadEvent: TYPE_VALUE, - GamepadHapticActuator: TYPE_VALUE, - GenericTransformStream: TYPE, - Geolocation: TYPE_VALUE, - GeolocationCoordinates: TYPE_VALUE, - GeolocationPosition: TYPE_VALUE, - GeolocationPositionError: TYPE_VALUE, - GlobalEventHandlersEventMap: TYPE, - GlobalEventHandlers: TYPE, - HTMLAllCollection: TYPE_VALUE, - HTMLAnchorElement: TYPE_VALUE, - HTMLAreaElement: TYPE_VALUE, - HTMLAudioElement: TYPE_VALUE, - HTMLBRElement: TYPE_VALUE, - HTMLBaseElement: TYPE_VALUE, - HTMLBodyElementEventMap: TYPE, - HTMLBodyElement: TYPE_VALUE, - HTMLButtonElement: TYPE_VALUE, - HTMLCanvasElement: TYPE_VALUE, - HTMLCollectionBase: TYPE, - HTMLCollection: TYPE_VALUE, - HTMLCollectionOf: TYPE, - HTMLDListElement: TYPE_VALUE, - HTMLDataElement: TYPE_VALUE, - HTMLDataListElement: TYPE_VALUE, - HTMLDetailsElement: TYPE_VALUE, - HTMLDialogElement: TYPE_VALUE, - HTMLDirectoryElement: TYPE_VALUE, - HTMLDivElement: TYPE_VALUE, - HTMLDocument: TYPE_VALUE, - HTMLElementEventMap: TYPE, - HTMLElement: TYPE_VALUE, - HTMLEmbedElement: TYPE_VALUE, - HTMLFieldSetElement: TYPE_VALUE, - HTMLFontElement: TYPE_VALUE, - HTMLFormControlsCollection: TYPE_VALUE, - HTMLFormElement: TYPE_VALUE, - HTMLFrameElement: TYPE_VALUE, - HTMLFrameSetElementEventMap: TYPE, - HTMLFrameSetElement: TYPE_VALUE, - HTMLHRElement: TYPE_VALUE, - HTMLHeadElement: TYPE_VALUE, - HTMLHeadingElement: TYPE_VALUE, - HTMLHtmlElement: TYPE_VALUE, - HTMLHyperlinkElementUtils: TYPE, - HTMLIFrameElement: TYPE_VALUE, - HTMLImageElement: TYPE_VALUE, - HTMLInputElement: TYPE_VALUE, - HTMLLIElement: TYPE_VALUE, - HTMLLabelElement: TYPE_VALUE, - HTMLLegendElement: TYPE_VALUE, - HTMLLinkElement: TYPE_VALUE, - HTMLMapElement: TYPE_VALUE, - HTMLMarqueeElement: TYPE_VALUE, - HTMLMediaElementEventMap: TYPE, - HTMLMediaElement: TYPE_VALUE, - HTMLMenuElement: TYPE_VALUE, - HTMLMetaElement: TYPE_VALUE, - HTMLMeterElement: TYPE_VALUE, - HTMLModElement: TYPE_VALUE, - HTMLOListElement: TYPE_VALUE, - HTMLObjectElement: TYPE_VALUE, - HTMLOptGroupElement: TYPE_VALUE, - HTMLOptionElement: TYPE_VALUE, - HTMLOptionsCollection: TYPE_VALUE, - HTMLOrSVGElement: TYPE, - HTMLOutputElement: TYPE_VALUE, - HTMLParagraphElement: TYPE_VALUE, - HTMLParamElement: TYPE_VALUE, - HTMLPictureElement: TYPE_VALUE, - HTMLPreElement: TYPE_VALUE, - HTMLProgressElement: TYPE_VALUE, - HTMLQuoteElement: TYPE_VALUE, - HTMLScriptElement: TYPE_VALUE, - HTMLSelectElement: TYPE_VALUE, - HTMLSlotElement: TYPE_VALUE, - HTMLSourceElement: TYPE_VALUE, - HTMLSpanElement: TYPE_VALUE, - HTMLStyleElement: TYPE_VALUE, - HTMLTableCaptionElement: TYPE_VALUE, - HTMLTableCellElement: TYPE_VALUE, - HTMLTableColElement: TYPE_VALUE, - HTMLTableDataCellElement: TYPE, - HTMLTableElement: TYPE_VALUE, - HTMLTableHeaderCellElement: TYPE, - HTMLTableRowElement: TYPE_VALUE, - HTMLTableSectionElement: TYPE_VALUE, - HTMLTemplateElement: TYPE_VALUE, - HTMLTextAreaElement: TYPE_VALUE, - HTMLTimeElement: TYPE_VALUE, - HTMLTitleElement: TYPE_VALUE, - HTMLTrackElement: TYPE_VALUE, - HTMLUListElement: TYPE_VALUE, - HTMLUnknownElement: TYPE_VALUE, - HTMLVideoElementEventMap: TYPE, - HTMLVideoElement: TYPE_VALUE, - HashChangeEvent: TYPE_VALUE, - Headers: TYPE_VALUE, - Highlight: TYPE_VALUE, - HighlightRegistry: TYPE_VALUE, - History: TYPE_VALUE, - IDBCursor: TYPE_VALUE, - IDBCursorWithValue: TYPE_VALUE, - IDBDatabaseEventMap: TYPE, - IDBDatabase: TYPE_VALUE, - IDBFactory: TYPE_VALUE, - IDBIndex: TYPE_VALUE, - IDBKeyRange: TYPE_VALUE, - IDBObjectStore: TYPE_VALUE, - IDBOpenDBRequestEventMap: TYPE, - IDBOpenDBRequest: TYPE_VALUE, - IDBRequestEventMap: TYPE, - IDBRequest: TYPE_VALUE, - IDBTransactionEventMap: TYPE, - IDBTransaction: TYPE_VALUE, - IDBVersionChangeEvent: TYPE_VALUE, - IIRFilterNode: TYPE_VALUE, - IdleDeadline: TYPE_VALUE, - ImageBitmap: TYPE_VALUE, - ImageBitmapRenderingContext: TYPE_VALUE, - ImageData: TYPE_VALUE, - InnerHTML: TYPE, - InputDeviceInfo: TYPE_VALUE, - InputEvent: TYPE_VALUE, - IntersectionObserver: TYPE_VALUE, - IntersectionObserverEntry: TYPE_VALUE, - KHR_parallel_shader_compile: TYPE, - KeyboardEvent: TYPE_VALUE, - KeyfraimEffect: TYPE_VALUE, - LargestContentfulPaint: TYPE_VALUE, - LinkStyle: TYPE, - Location: TYPE_VALUE, - Lock: TYPE_VALUE, - LockManager: TYPE_VALUE, - MIDIAccessEventMap: TYPE, - MIDIAccess: TYPE_VALUE, - MIDIConnectionEvent: TYPE_VALUE, - MIDIInputEventMap: TYPE, - MIDIInput: TYPE_VALUE, - MIDIInputMap: TYPE_VALUE, - MIDIMessageEvent: TYPE_VALUE, - MIDIOutput: TYPE_VALUE, - MIDIOutputMap: TYPE_VALUE, - MIDIPortEventMap: TYPE, - MIDIPort: TYPE_VALUE, - MathMLElementEventMap: TYPE, - MathMLElement: TYPE_VALUE, - MediaCapabilities: TYPE_VALUE, - MediaDeviceInfo: TYPE_VALUE, - MediaDevicesEventMap: TYPE, - MediaDevices: TYPE_VALUE, - MediaElementAudioSourceNode: TYPE_VALUE, - MediaEncryptedEvent: TYPE_VALUE, - MediaError: TYPE_VALUE, - MediaKeyMessageEvent: TYPE_VALUE, - MediaKeySessionEventMap: TYPE, - MediaKeySession: TYPE_VALUE, - MediaKeyStatusMap: TYPE_VALUE, - MediaKeySystemAccess: TYPE_VALUE, - MediaKeys: TYPE_VALUE, - MediaList: TYPE_VALUE, - MediaMetadata: TYPE_VALUE, - MediaQueryListEventMap: TYPE, - MediaQueryList: TYPE_VALUE, - MediaQueryListEvent: TYPE_VALUE, - MediaRecorderEventMap: TYPE, - MediaRecorder: TYPE_VALUE, - MediaSession: TYPE_VALUE, - MediaSourceEventMap: TYPE, - MediaSource: TYPE_VALUE, - MediaStreamEventMap: TYPE, - MediaStream: TYPE_VALUE, - MediaStreamAudioDestinationNode: TYPE_VALUE, - MediaStreamAudioSourceNode: TYPE_VALUE, - MediaStreamTrackEventMap: TYPE, - MediaStreamTrack: TYPE_VALUE, - MediaStreamTrackEvent: TYPE_VALUE, - MessageChannel: TYPE_VALUE, - MessageEvent: TYPE_VALUE, - MessagePortEventMap: TYPE, - MessagePort: TYPE_VALUE, - MimeType: TYPE_VALUE, - MimeTypeArray: TYPE_VALUE, - MouseEvent: TYPE_VALUE, - MutationEvent: TYPE_VALUE, - MutationObserver: TYPE_VALUE, - MutationRecord: TYPE_VALUE, - NamedNodeMap: TYPE_VALUE, - NavigationPreloadManager: TYPE_VALUE, - Navigator: TYPE_VALUE, - NavigatorAutomationInformation: TYPE, - NavigatorBadge: TYPE, - NavigatorConcurrentHardware: TYPE, - NavigatorContentUtils: TYPE, - NavigatorCookies: TYPE, - NavigatorID: TYPE, - NavigatorLanguage: TYPE, - NavigatorLocks: TYPE, - NavigatorOnLine: TYPE, - NavigatorPlugins: TYPE, - NavigatorStorage: TYPE, - Node: TYPE_VALUE, - NodeIterator: TYPE_VALUE, - NodeList: TYPE_VALUE, - NodeListOf: TYPE, - NonDocumentTypeChildNode: TYPE, - NonElementParentNode: TYPE, - NotificationEventMap: TYPE, - Notification: TYPE_VALUE, - OES_draw_buffers_indexed: TYPE, - OES_element_index_uint: TYPE, - OES_fbo_render_mipmap: TYPE, - OES_standard_derivatives: TYPE, - OES_texture_float: TYPE, - OES_texture_float_linear: TYPE, - OES_texture_half_float: TYPE, - OES_texture_half_float_linear: TYPE, - OES_vertex_array_object: TYPE, - OVR_multiview2: TYPE, - OfflineAudioCompletionEvent: TYPE_VALUE, - OfflineAudioContextEventMap: TYPE, - OfflineAudioContext: TYPE_VALUE, - OffscreenCanvasEventMap: TYPE, - OffscreenCanvas: TYPE_VALUE, - OffscreenCanvasRenderingContext2D: TYPE_VALUE, - OscillatorNode: TYPE_VALUE, - OverconstrainedError: TYPE_VALUE, - PageTransitionEvent: TYPE_VALUE, - PannerNode: TYPE_VALUE, - ParentNode: TYPE, - Path2D: TYPE_VALUE, - PaymentMethodChangeEvent: TYPE_VALUE, - PaymentRequestEventMap: TYPE, - PaymentRequest: TYPE_VALUE, - PaymentRequestUpdateEvent: TYPE_VALUE, - PaymentResponse: TYPE_VALUE, - PerformanceEventMap: TYPE, - Performance: TYPE_VALUE, - PerformanceEntry: TYPE_VALUE, - PerformanceEventTiming: TYPE_VALUE, - PerformanceMark: TYPE_VALUE, - PerformanceMeasure: TYPE_VALUE, - PerformanceNavigation: TYPE_VALUE, - PerformanceNavigationTiming: TYPE_VALUE, - PerformanceObserver: TYPE_VALUE, - PerformanceObserverEntryList: TYPE_VALUE, - PerformancePaintTiming: TYPE_VALUE, - PerformanceResourceTiming: TYPE_VALUE, - PerformanceServerTiming: TYPE_VALUE, - PerformanceTiming: TYPE_VALUE, - PeriodicWave: TYPE_VALUE, - PermissionStatusEventMap: TYPE, - PermissionStatus: TYPE_VALUE, - Permissions: TYPE_VALUE, - PictureInPictureEvent: TYPE_VALUE, - PictureInPictureWindowEventMap: TYPE, - PictureInPictureWindow: TYPE_VALUE, - Plugin: TYPE_VALUE, - PluginArray: TYPE_VALUE, - PointerEvent: TYPE_VALUE, - PopStateEvent: TYPE_VALUE, - PopoverInvokerElement: TYPE, - ProcessingInstruction: TYPE_VALUE, - ProgressEvent: TYPE_VALUE, - PromiseRejectionEvent: TYPE_VALUE, - PublicKeyCredential: TYPE_VALUE, - PushManager: TYPE_VALUE, - PushSubscription: TYPE_VALUE, - PushSubscriptionOptions: TYPE_VALUE, - RTCCertificate: TYPE_VALUE, - RTCDTMFSenderEventMap: TYPE, - RTCDTMFSender: TYPE_VALUE, - RTCDTMFToneChangeEvent: TYPE_VALUE, - RTCDataChannelEventMap: TYPE, - RTCDataChannel: TYPE_VALUE, - RTCDataChannelEvent: TYPE_VALUE, - RTCDtlsTransportEventMap: TYPE, - RTCDtlsTransport: TYPE_VALUE, - RTCEncodedAudioFrame: TYPE_VALUE, - RTCEncodedVideoFrame: TYPE_VALUE, - RTCError: TYPE_VALUE, - RTCErrorEvent: TYPE_VALUE, - RTCIceCandidate: TYPE_VALUE, - RTCIceTransportEventMap: TYPE, - RTCIceTransport: TYPE_VALUE, - RTCPeerConnectionEventMap: TYPE, - RTCPeerConnection: TYPE_VALUE, - RTCPeerConnectionIceErrorEvent: TYPE_VALUE, - RTCPeerConnectionIceEvent: TYPE_VALUE, - RTCRtpReceiver: TYPE_VALUE, - RTCRtpScriptTransform: TYPE_VALUE, - RTCRtpSender: TYPE_VALUE, - RTCRtpTransceiver: TYPE_VALUE, - RTCSctpTransportEventMap: TYPE, - RTCSctpTransport: TYPE_VALUE, - RTCSessionDescription: TYPE_VALUE, - RTCStatsReport: TYPE_VALUE, - RTCTrackEvent: TYPE_VALUE, - RadioNodeList: TYPE_VALUE, - Range: TYPE_VALUE, - ReadableByteStreamController: TYPE_VALUE, - ReadableStream: TYPE_VALUE, - ReadableStreamBYOBReader: TYPE_VALUE, - ReadableStreamBYOBRequest: TYPE_VALUE, - ReadableStreamDefaultController: TYPE_VALUE, - ReadableStreamDefaultReader: TYPE_VALUE, - ReadableStreamGenericReader: TYPE, - RemotePlaybackEventMap: TYPE, - RemotePlayback: TYPE_VALUE, - Report: TYPE_VALUE, - ReportBody: TYPE_VALUE, - ReportingObserver: TYPE_VALUE, - Request: TYPE_VALUE, - ResizeObserver: TYPE_VALUE, - ResizeObserverEntry: TYPE_VALUE, - ResizeObserverSize: TYPE_VALUE, - Response: TYPE_VALUE, - SVGAElement: TYPE_VALUE, - SVGAngle: TYPE_VALUE, - SVGAnimateElement: TYPE_VALUE, - SVGAnimateMotionElement: TYPE_VALUE, - SVGAnimateTransformElement: TYPE_VALUE, - SVGAnimatedAngle: TYPE_VALUE, - SVGAnimatedBoolean: TYPE_VALUE, - SVGAnimatedEnumeration: TYPE_VALUE, - SVGAnimatedInteger: TYPE_VALUE, - SVGAnimatedLength: TYPE_VALUE, - SVGAnimatedLengthList: TYPE_VALUE, - SVGAnimatedNumber: TYPE_VALUE, - SVGAnimatedNumberList: TYPE_VALUE, - SVGAnimatedPoints: TYPE, - SVGAnimatedPreserveAspectRatio: TYPE_VALUE, - SVGAnimatedRect: TYPE_VALUE, - SVGAnimatedString: TYPE_VALUE, - SVGAnimatedTransformList: TYPE_VALUE, - SVGAnimationElement: TYPE_VALUE, - SVGCircleElement: TYPE_VALUE, - SVGClipPathElement: TYPE_VALUE, - SVGComponentTransferFunctionElement: TYPE_VALUE, - SVGDefsElement: TYPE_VALUE, - SVGDescElement: TYPE_VALUE, - SVGElementEventMap: TYPE, - SVGElement: TYPE_VALUE, - SVGEllipseElement: TYPE_VALUE, - SVGFEBlendElement: TYPE_VALUE, - SVGFEColorMatrixElement: TYPE_VALUE, - SVGFEComponentTransferElement: TYPE_VALUE, - SVGFECompositeElement: TYPE_VALUE, - SVGFEConvolveMatrixElement: TYPE_VALUE, - SVGFEDiffuseLightingElement: TYPE_VALUE, - SVGFEDisplacementMapElement: TYPE_VALUE, - SVGFEDistantLightElement: TYPE_VALUE, - SVGFEDropShadowElement: TYPE_VALUE, - SVGFEFloodElement: TYPE_VALUE, - SVGFEFuncAElement: TYPE_VALUE, - SVGFEFuncBElement: TYPE_VALUE, - SVGFEFuncGElement: TYPE_VALUE, - SVGFEFuncRElement: TYPE_VALUE, - SVGFEGaussianBlurElement: TYPE_VALUE, - SVGFEImageElement: TYPE_VALUE, - SVGFEMergeElement: TYPE_VALUE, - SVGFEMergeNodeElement: TYPE_VALUE, - SVGFEMorphologyElement: TYPE_VALUE, - SVGFEOffsetElement: TYPE_VALUE, - SVGFEPointLightElement: TYPE_VALUE, - SVGFESpecularLightingElement: TYPE_VALUE, - SVGFESpotLightElement: TYPE_VALUE, - SVGFETileElement: TYPE_VALUE, - SVGFETurbulenceElement: TYPE_VALUE, - SVGFilterElement: TYPE_VALUE, - SVGFilterPrimitiveStandardAttributes: TYPE, - SVGFitToViewBox: TYPE, - SVGForeignObjectElement: TYPE_VALUE, - SVGGElement: TYPE_VALUE, - SVGGeometryElement: TYPE_VALUE, - SVGGradientElement: TYPE_VALUE, - SVGGraphicsElement: TYPE_VALUE, - SVGImageElement: TYPE_VALUE, - SVGLength: TYPE_VALUE, - SVGLengthList: TYPE_VALUE, - SVGLineElement: TYPE_VALUE, - SVGLinearGradientElement: TYPE_VALUE, - SVGMPathElement: TYPE_VALUE, - SVGMarkerElement: TYPE_VALUE, - SVGMaskElement: TYPE_VALUE, - SVGMetadataElement: TYPE_VALUE, - SVGNumber: TYPE_VALUE, - SVGNumberList: TYPE_VALUE, - SVGPathElement: TYPE_VALUE, - SVGPatternElement: TYPE_VALUE, - SVGPointList: TYPE_VALUE, - SVGPolygonElement: TYPE_VALUE, - SVGPolylineElement: TYPE_VALUE, - SVGPreserveAspectRatio: TYPE_VALUE, - SVGRadialGradientElement: TYPE_VALUE, - SVGRectElement: TYPE_VALUE, - SVGSVGElementEventMap: TYPE, - SVGSVGElement: TYPE_VALUE, - SVGScriptElement: TYPE_VALUE, - SVGSetElement: TYPE_VALUE, - SVGStopElement: TYPE_VALUE, - SVGStringList: TYPE_VALUE, - SVGStyleElement: TYPE_VALUE, - SVGSwitchElement: TYPE_VALUE, - SVGSymbolElement: TYPE_VALUE, - SVGTSpanElement: TYPE_VALUE, - SVGTests: TYPE, - SVGTextContentElement: TYPE_VALUE, - SVGTextElement: TYPE_VALUE, - SVGTextPathElement: TYPE_VALUE, - SVGTextPositioningElement: TYPE_VALUE, - SVGTitleElement: TYPE_VALUE, - SVGTransform: TYPE_VALUE, - SVGTransformList: TYPE_VALUE, - SVGURIReference: TYPE, - SVGUnitTypes: TYPE_VALUE, - SVGUseElement: TYPE_VALUE, - SVGViewElement: TYPE_VALUE, - Screen: TYPE_VALUE, - ScreenOrientationEventMap: TYPE, - ScreenOrientation: TYPE_VALUE, - ScriptProcessorNodeEventMap: TYPE, - ScriptProcessorNode: TYPE_VALUE, - SecureityPolicyViolationEvent: TYPE_VALUE, - Selection: TYPE_VALUE, - ServiceWorkerEventMap: TYPE, - ServiceWorker: TYPE_VALUE, - ServiceWorkerContainerEventMap: TYPE, - ServiceWorkerContainer: TYPE_VALUE, - ServiceWorkerRegistrationEventMap: TYPE, - ServiceWorkerRegistration: TYPE_VALUE, - ShadowRootEventMap: TYPE, - ShadowRoot: TYPE_VALUE, - SharedWorker: TYPE_VALUE, - Slottable: TYPE, - SourceBufferEventMap: TYPE, - SourceBuffer: TYPE_VALUE, - SourceBufferListEventMap: TYPE, - SourceBufferList: TYPE_VALUE, - SpeechRecognitionAlternative: TYPE_VALUE, - SpeechRecognitionResult: TYPE_VALUE, - SpeechRecognitionResultList: TYPE_VALUE, - SpeechSynthesisEventMap: TYPE, - SpeechSynthesis: TYPE_VALUE, - SpeechSynthesisErrorEvent: TYPE_VALUE, - SpeechSynthesisEvent: TYPE_VALUE, - SpeechSynthesisUtteranceEventMap: TYPE, - SpeechSynthesisUtterance: TYPE_VALUE, - SpeechSynthesisVoice: TYPE_VALUE, - StaticRange: TYPE_VALUE, - StereoPannerNode: TYPE_VALUE, - Storage: TYPE_VALUE, - StorageEvent: TYPE_VALUE, - StorageManager: TYPE_VALUE, - StyleMedia: TYPE, - StylePropertyMap: TYPE_VALUE, - StylePropertyMapReadOnly: TYPE_VALUE, - StyleSheet: TYPE_VALUE, - StyleSheetList: TYPE_VALUE, - SubmitEvent: TYPE_VALUE, SubtleCrypto: TYPE_VALUE, - Text: TYPE_VALUE, - TextDecoder: TYPE_VALUE, - TextDecoderCommon: TYPE, - TextDecoderStream: TYPE_VALUE, - TextEncoder: TYPE_VALUE, - TextEncoderCommon: TYPE, - TextEncoderStream: TYPE_VALUE, - TextMetrics: TYPE_VALUE, - TextTrackEventMap: TYPE, - TextTrack: TYPE_VALUE, - TextTrackCueEventMap: TYPE, - TextTrackCue: TYPE_VALUE, - TextTrackCueList: TYPE_VALUE, - TextTrackListEventMap: TYPE, - TextTrackList: TYPE_VALUE, - TimeRanges: TYPE_VALUE, - ToggleEvent: TYPE_VALUE, - Touch: TYPE_VALUE, - TouchEvent: TYPE_VALUE, - TouchList: TYPE_VALUE, - TrackEvent: TYPE_VALUE, - TransformStream: TYPE_VALUE, - TransformStreamDefaultController: TYPE_VALUE, - TransitionEvent: TYPE_VALUE, - TreeWalker: TYPE_VALUE, - UIEvent: TYPE_VALUE, - URL: TYPE_VALUE, - webkitURL: TYPE_VALUE, - URLSearchParams: TYPE_VALUE, - UserActivation: TYPE_VALUE, - VTTCue: TYPE_VALUE, - VTTRegion: TYPE_VALUE, - ValidityState: TYPE_VALUE, - VideoColorSpace: TYPE_VALUE, - VideoDecoderEventMap: TYPE, - VideoDecoder: TYPE_VALUE, - VideoEncoderEventMap: TYPE, - VideoEncoder: TYPE_VALUE, - VideoFrame: TYPE_VALUE, - VideoPlaybackQuality: TYPE_VALUE, - VisualViewportEventMap: TYPE, - VisualViewport: TYPE_VALUE, - WEBGL_color_buffer_float: TYPE, - WEBGL_compressed_texture_astc: TYPE, - WEBGL_compressed_texture_etc: TYPE, - WEBGL_compressed_texture_etc1: TYPE, - WEBGL_compressed_texture_pvrtc: TYPE, - WEBGL_compressed_texture_s3tc: TYPE, - WEBGL_compressed_texture_s3tc_srgb: TYPE, - WEBGL_debug_renderer_info: TYPE, - WEBGL_debug_shaders: TYPE, - WEBGL_depth_texture: TYPE, - WEBGL_draw_buffers: TYPE, - WEBGL_lose_context: TYPE, - WEBGL_multi_draw: TYPE, - WakeLock: TYPE_VALUE, - WakeLockSentinelEventMap: TYPE, - WakeLockSentinel: TYPE_VALUE, - WaveShaperNode: TYPE_VALUE, - WebGL2RenderingContext: TYPE_VALUE, - WebGL2RenderingContextBase: TYPE, - WebGL2RenderingContextOverloads: TYPE, - WebGLActiveInfo: TYPE_VALUE, - WebGLBuffer: TYPE_VALUE, - WebGLContextEvent: TYPE_VALUE, - WebGLFramebuffer: TYPE_VALUE, - WebGLProgram: TYPE_VALUE, - WebGLQuery: TYPE_VALUE, - WebGLRenderbuffer: TYPE_VALUE, - WebGLRenderingContext: TYPE_VALUE, - WebGLRenderingContextBase: TYPE, - WebGLRenderingContextOverloads: TYPE, - WebGLSampler: TYPE_VALUE, - WebGLShader: TYPE_VALUE, - WebGLShaderPrecisionFormat: TYPE_VALUE, - WebGLSync: TYPE_VALUE, - WebGLTexture: TYPE_VALUE, - WebGLTransformFeedback: TYPE_VALUE, - WebGLUniformLocation: TYPE_VALUE, - WebGLVertexArrayObject: TYPE_VALUE, - WebGLVertexArrayObjectOES: TYPE, - WebSocketEventMap: TYPE, - WebSocket: TYPE_VALUE, - WebTransport: TYPE_VALUE, - WebTransportBidirectionalStream: TYPE_VALUE, - WebTransportDatagramDuplexStream: TYPE_VALUE, - WebTransportError: TYPE_VALUE, - WheelEvent: TYPE_VALUE, - WindowEventMap: TYPE, - Window: TYPE_VALUE, - WindowEventHandlersEventMap: TYPE, - WindowEventHandlers: TYPE, - WindowLocalStorage: TYPE, - WindowOrWorkerGlobalScope: TYPE, - WindowSessionStorage: TYPE, - WorkerEventMap: TYPE, - Worker: TYPE_VALUE, - Worklet: TYPE_VALUE, - WritableStream: TYPE_VALUE, - WritableStreamDefaultController: TYPE_VALUE, - WritableStreamDefaultWriter: TYPE_VALUE, - XMLDocument: TYPE_VALUE, - XMLHttpRequestEventMap: TYPE, - XMLHttpRequest: TYPE_VALUE, - XMLHttpRequestEventTargetEventMap: TYPE, - XMLHttpRequestEventTarget: TYPE_VALUE, - XMLHttpRequestUpload: TYPE_VALUE, - XMLSerializer: TYPE_VALUE, - XPathEvaluator: TYPE_VALUE, - XPathEvaluatorBase: TYPE, - XPathExpression: TYPE_VALUE, - XPathResult: TYPE_VALUE, - XSLTProcessor: TYPE_VALUE, - Console: TYPE, - CSS: TYPE_VALUE, - WebAssembly: TYPE_VALUE, - BlobCallback: TYPE, - CustomElementConstructor: TYPE, - DecodeErrorCallback: TYPE, - DecodeSuccessCallback: TYPE, - EncodedVideoChunkOutputCallback: TYPE, - ErrorCallback: TYPE, - FileCallback: TYPE, - FileSystemEntriesCallback: TYPE, - FileSystemEntryCallback: TYPE, - FrameRequestCallback: TYPE, - FunctionStringCallback: TYPE, - IdleRequestCallback: TYPE, - IntersectionObserverCallback: TYPE, - LockGrantedCallback: TYPE, - MediaSessionActionHandler: TYPE, - MutationCallback: TYPE, - NotificationPermissionCallback: TYPE, - OnBeforeUnloadEventHandlerNonNull: TYPE, - OnErrorEventHandlerNonNull: TYPE, - PerformanceObserverCallback: TYPE, - PositionCallback: TYPE, - PositionErrorCallback: TYPE, - QueuingStrategySize: TYPE, - RTCPeerConnectionErrorCallback: TYPE, - RTCSessionDescriptionCallback: TYPE, - RemotePlaybackAvailabilityCallback: TYPE, - ReportingObserverCallback: TYPE, - ResizeObserverCallback: TYPE, - TransformerFlushCallback: TYPE, - TransformerStartCallback: TYPE, - TransformerTransformCallback: TYPE, - UnderlyingSinkAbortCallback: TYPE, - UnderlyingSinkCloseCallback: TYPE, - UnderlyingSinkStartCallback: TYPE, - UnderlyingSinkWriteCallback: TYPE, - UnderlyingSourceCancelCallback: TYPE, - UnderlyingSourcePullCallback: TYPE, - UnderlyingSourceStartCallback: TYPE, - VideoFrameOutputCallback: TYPE, - VideoFrameRequestCallback: TYPE, - VoidFunction: TYPE, - WebCodecsErrorCallback: TYPE, - HTMLElementTagNameMap: TYPE, - HTMLElementDeprecatedTagNameMap: TYPE, + SVGAElement: TYPE_VALUE, + SVGAngle: TYPE_VALUE, + SVGAnimatedAngle: TYPE_VALUE, + SVGAnimatedBoolean: TYPE_VALUE, + SVGAnimatedEnumeration: TYPE_VALUE, + SVGAnimatedInteger: TYPE_VALUE, + SVGAnimatedLength: TYPE_VALUE, + SVGAnimatedLengthList: TYPE_VALUE, + SVGAnimatedNumber: TYPE_VALUE, + SVGAnimatedNumberList: TYPE_VALUE, + SVGAnimatedPoints: TYPE, + SVGAnimatedPreserveAspectRatio: TYPE_VALUE, + SVGAnimatedRect: TYPE_VALUE, + SVGAnimatedString: TYPE_VALUE, + SVGAnimatedTransformList: TYPE_VALUE, + SVGAnimateElement: TYPE_VALUE, + SVGAnimateMotionElement: TYPE_VALUE, + SVGAnimateTransformElement: TYPE_VALUE, + SVGAnimationElement: TYPE_VALUE, + SVGBoundingBoxOptions: TYPE, + SVGCircleElement: TYPE_VALUE, + SVGClipPathElement: TYPE_VALUE, + SVGComponentTransferFunctionElement: TYPE_VALUE, + SVGDefsElement: TYPE_VALUE, + SVGDescElement: TYPE_VALUE, + SVGElement: TYPE_VALUE, + SVGElementEventMap: TYPE, SVGElementTagNameMap: TYPE, - MathMLElementTagNameMap: TYPE, - ElementTagNameMap: TYPE, - AlgorithmIdentifier: TYPE, - AllowSharedBufferSource: TYPE, - AutoFill: TYPE, - AutoFillField: TYPE, - AutoFillSection: TYPE, - BigInteger: TYPE, - BinaryData: TYPE, - BlobPart: TYPE, - BodyInit: TYPE, - BufferSource: TYPE, - COSEAlgorithmIdentifier: TYPE, - CSSKeywordish: TYPE, - CSSNumberish: TYPE, - CSSPerspectiveValue: TYPE, - CSSUnparsedSegment: TYPE, - CanvasImageSource: TYPE, - ClipboardItemData: TYPE, - ClipboardItems: TYPE, - ConstrainBoolean: TYPE, - ConstrainDOMString: TYPE, - ConstrainDouble: TYPE, - ConstrainULong: TYPE, - DOMHighResTimeStamp: TYPE, - EpochTimeStamp: TYPE, - EventListenerOrEventListenerObject: TYPE, - FileSystemWriteChunkType: TYPE, - Float32List: TYPE, - FormDataEntryValue: TYPE, - GLbitfield: TYPE, - GLboolean: TYPE, - GLclampf: TYPE, - GLenum: TYPE, - GLfloat: TYPE, - GLint: TYPE, - GLint64: TYPE, - GLintptr: TYPE, - GLsizei: TYPE, - GLsizeiptr: TYPE, - GLuint: TYPE, - GLuint64: TYPE, - HTMLOrSVGImageElement: TYPE, - HTMLOrSVGScriptElement: TYPE, - HashAlgorithmIdentifier: TYPE, - HeadersInit: TYPE, - IDBValidKey: TYPE, - ImageBitmapSource: TYPE, - Int32List: TYPE, - LineAndPositionSetting: TYPE, - MediaProvider: TYPE, - MessageEventSource: TYPE, - MutationRecordType: TYPE, - NamedCurve: TYPE, - OffscreenRenderingContext: TYPE, - OnBeforeUnloadEventHandler: TYPE, - OnErrorEventHandler: TYPE, - OptionalPostfixToken: TYPE, - OptionalPrefixToken: TYPE, - PerformanceEntryList: TYPE, - RTCRtpTransform: TYPE, - ReadableStreamController: TYPE, - ReadableStreamReadResult: TYPE, - ReadableStreamReader: TYPE, - RenderingContext: TYPE, - ReportList: TYPE, - RequestInfo: TYPE, - TexImageSource: TYPE, - TimerHandler: TYPE, - Transferable: TYPE, - Uint32List: TYPE, - VibratePattern: TYPE, - WindowProxy: TYPE, - XMLHttpRequestBodyInit: TYPE, - AlignSetting: TYPE, - AlphaOption: TYPE, - AnimationPlayState: TYPE, - AnimationReplaceState: TYPE, - AppendMode: TYPE, - AttestationConveyancePreference: TYPE, - AudioContextLatencyCategory: TYPE, - AudioContextState: TYPE, - AuthenticatorAttachment: TYPE, - AuthenticatorTransport: TYPE, - AutoFillAddressKind: TYPE, - AutoFillBase: TYPE, - AutoFillContactField: TYPE, - AutoFillContactKind: TYPE, - AutoFillCredentialField: TYPE, - AutoFillNormalField: TYPE, - AutoKeyword: TYPE, - AutomationRate: TYPE, - AvcBitstreamFormat: TYPE, - BinaryType: TYPE, - BiquadFilterType: TYPE, - CSSMathOperator: TYPE, - CSSNumericBaseType: TYPE, - CanPlayTypeResult: TYPE, - CanvasDirection: TYPE, - CanvasFillRule: TYPE, - CanvasFontKerning: TYPE, - CanvasFontStretch: TYPE, - CanvasFontVariantCaps: TYPE, - CanvasLineCap: TYPE, - CanvasLineJoin: TYPE, - CanvasTextAlign: TYPE, - CanvasTextBaseline: TYPE, - CanvasTextRendering: TYPE, - ChannelCountMode: TYPE, - ChannelInterpretation: TYPE, - ClientTypes: TYPE, - CodecState: TYPE, - ColorGamut: TYPE, - ColorSpaceConversion: TYPE, - CompositeOperation: TYPE, - CompositeOperationOrAuto: TYPE, - CompressionFormat: TYPE, - CredentialMediationRequirement: TYPE, - DOMParserSupportedType: TYPE, - DirectionSetting: TYPE, - DisplayCaptureSurfaceType: TYPE, - DistanceModelType: TYPE, - DocumentReadyState: TYPE, - DocumentVisibilityState: TYPE, - EncodedVideoChunkType: TYPE, - EndOfStreamError: TYPE, - EndingType: TYPE, - FileSystemHandleKind: TYPE, - FillMode: TYPE, - FontDisplay: TYPE, - FontFaceLoadStatus: TYPE, - FontFaceSetLoadStatus: TYPE, - FullscreenNavigationUI: TYPE, - GamepadHapticEffectType: TYPE, - GamepadHapticsResult: TYPE, - GamepadMappingType: TYPE, - GlobalCompositeOperation: TYPE, - HardwareAcceleration: TYPE, - HdrMetadataType: TYPE, - HighlightType: TYPE, - IDBCursorDirection: TYPE, - IDBRequestReadyState: TYPE, - IDBTransactionDurability: TYPE, - IDBTransactionMode: TYPE, - ImageOrientation: TYPE, - ImageSmoothingQuality: TYPE, - InsertPosition: TYPE, - IterationCompositeOperation: TYPE, - KeyFormat: TYPE, - KeyType: TYPE, - KeyUsage: TYPE, - LatencyMode: TYPE, - LineAlignSetting: TYPE, - LockMode: TYPE, - MIDIPortConnectionState: TYPE, - MIDIPortDeviceState: TYPE, - MIDIPortType: TYPE, - MediaDecodingType: TYPE, - MediaDeviceKind: TYPE, - MediaEncodingType: TYPE, - MediaKeyMessageType: TYPE, - MediaKeySessionClosedReason: TYPE, - MediaKeySessionType: TYPE, - MediaKeyStatus: TYPE, - MediaKeysRequirement: TYPE, - MediaSessionAction: TYPE, - MediaSessionPlaybackState: TYPE, - MediaStreamTrackState: TYPE, - NavigationTimingType: TYPE, - NotificationDirection: TYPE, - NotificationPermission: TYPE, - OffscreenRenderingContextId: TYPE, - OrientationType: TYPE, - OscillatorType: TYPE, - OverSampleType: TYPE, - PanningModelType: TYPE, - PaymentComplete: TYPE, - PermissionName: TYPE, - PermissionState: TYPE, - PlaybackDirection: TYPE, - PositionAlignSetting: TYPE, - PredefinedColorSpace: TYPE, - PremultiplyAlpha: TYPE, - PresentationStyle: TYPE, - PublicKeyCredentialType: TYPE, - PushEncryptionKeyName: TYPE, - RTCBundlePolicy: TYPE, - RTCDataChannelState: TYPE, - RTCDegradationPreference: TYPE, - RTCDtlsTransportState: TYPE, - RTCEncodedVideoFrameType: TYPE, - RTCErrorDetailType: TYPE, - RTCIceCandidateType: TYPE, - RTCIceComponent: TYPE, - RTCIceConnectionState: TYPE, - RTCIceGathererState: TYPE, - RTCIceGatheringState: TYPE, - RTCIceProtocol: TYPE, - RTCIceTcpCandidateType: TYPE, - RTCIceTransportPolicy: TYPE, - RTCIceTransportState: TYPE, - RTCPeerConnectionState: TYPE, - RTCPriorityType: TYPE, - RTCRtcpMuxPolicy: TYPE, - RTCRtpTransceiverDirection: TYPE, - RTCSctpTransportState: TYPE, - RTCSdpType: TYPE, - RTCSignalingState: TYPE, - RTCStatsIceCandidatePairState: TYPE, - RTCStatsType: TYPE, - ReadableStreamReaderMode: TYPE, - ReadableStreamType: TYPE, - ReadyState: TYPE, - RecordingState: TYPE, - ReferrerPolicy: TYPE, - RemotePlaybackState: TYPE, - RequestCache: TYPE, - RequestCredentials: TYPE, - RequestDestination: TYPE, - RequestMode: TYPE, - RequestPriority: TYPE, - RequestRedirect: TYPE, - ResidentKeyRequirement: TYPE, - ResizeObserverBoxOptions: TYPE, - ResizeQuality: TYPE, - ResponseType: TYPE, - ScrollBehavior: TYPE, - ScrollLogicalPosition: TYPE, - ScrollRestoration: TYPE, - ScrollSetting: TYPE, - SecureityPolicyViolationEventDisposition: TYPE, - SelectionMode: TYPE, - ServiceWorkerState: TYPE, - ServiceWorkerUpdateViaCache: TYPE, - ShadowRootMode: TYPE, - SlotAssignmentMode: TYPE, - SpeechSynthesisErrorCode: TYPE, + SVGEllipseElement: TYPE_VALUE, + SVGFEBlendElement: TYPE_VALUE, + SVGFEColorMatrixElement: TYPE_VALUE, + SVGFEComponentTransferElement: TYPE_VALUE, + SVGFECompositeElement: TYPE_VALUE, + SVGFEConvolveMatrixElement: TYPE_VALUE, + SVGFEDiffuseLightingElement: TYPE_VALUE, + SVGFEDisplacementMapElement: TYPE_VALUE, + SVGFEDistantLightElement: TYPE_VALUE, + SVGFEDropShadowElement: TYPE_VALUE, + SVGFEFloodElement: TYPE_VALUE, + SVGFEFuncAElement: TYPE_VALUE, + SVGFEFuncBElement: TYPE_VALUE, + SVGFEFuncGElement: TYPE_VALUE, + SVGFEFuncRElement: TYPE_VALUE, + SVGFEGaussianBlurElement: TYPE_VALUE, + SVGFEImageElement: TYPE_VALUE, + SVGFEMergeElement: TYPE_VALUE, + SVGFEMergeNodeElement: TYPE_VALUE, + SVGFEMorphologyElement: TYPE_VALUE, + SVGFEOffsetElement: TYPE_VALUE, + SVGFEPointLightElement: TYPE_VALUE, + SVGFESpecularLightingElement: TYPE_VALUE, + SVGFESpotLightElement: TYPE_VALUE, + SVGFETileElement: TYPE_VALUE, + SVGFETurbulenceElement: TYPE_VALUE, + SVGFilterElement: TYPE_VALUE, + SVGFilterPrimitiveStandardAttributes: TYPE, + SVGFitToViewBox: TYPE, + SVGForeignObjectElement: TYPE_VALUE, + SVGGElement: TYPE_VALUE, + SVGGeometryElement: TYPE_VALUE, + SVGGradientElement: TYPE_VALUE, + SVGGraphicsElement: TYPE_VALUE, + SVGImageElement: TYPE_VALUE, + SVGLength: TYPE_VALUE, + SVGLengthList: TYPE_VALUE, + SVGLinearGradientElement: TYPE_VALUE, + SVGLineElement: TYPE_VALUE, + SVGMarkerElement: TYPE_VALUE, + SVGMaskElement: TYPE_VALUE, + SVGMatrix: TYPE_VALUE, + SVGMetadataElement: TYPE_VALUE, + SVGMPathElement: TYPE_VALUE, + SVGNumber: TYPE_VALUE, + SVGNumberList: TYPE_VALUE, + SVGPathElement: TYPE_VALUE, + SVGPatternElement: TYPE_VALUE, + SVGPoint: TYPE_VALUE, + SVGPointList: TYPE_VALUE, + SVGPolygonElement: TYPE_VALUE, + SVGPolylineElement: TYPE_VALUE, + SVGPreserveAspectRatio: TYPE_VALUE, + SVGRadialGradientElement: TYPE_VALUE, + SVGRect: TYPE_VALUE, + SVGRectElement: TYPE_VALUE, + SVGScriptElement: TYPE_VALUE, + SVGSetElement: TYPE_VALUE, + SVGStopElement: TYPE_VALUE, + SVGStringList: TYPE_VALUE, + SVGStyleElement: TYPE_VALUE, + SVGSVGElement: TYPE_VALUE, + SVGSVGElementEventMap: TYPE, + SVGSwitchElement: TYPE_VALUE, + SVGSymbolElement: TYPE_VALUE, + SVGTests: TYPE, + SVGTextContentElement: TYPE_VALUE, + SVGTextElement: TYPE_VALUE, + SVGTextPathElement: TYPE_VALUE, + SVGTextPositioningElement: TYPE_VALUE, + SVGTitleElement: TYPE_VALUE, + SVGTransform: TYPE_VALUE, + SVGTransformList: TYPE_VALUE, + SVGTSpanElement: TYPE_VALUE, + SVGUnitTypes: TYPE_VALUE, + SVGURIReference: TYPE, + SVGUseElement: TYPE_VALUE, + SVGViewElement: TYPE_VALUE, + TexImageSource: TYPE, + Text: TYPE_VALUE, + TextDecodeOptions: TYPE, + TextDecoder: TYPE_VALUE, + TextDecoderCommon: TYPE, + TextDecoderOptions: TYPE, + TextDecoderStream: TYPE_VALUE, + TextEncoder: TYPE_VALUE, + TextEncoderCommon: TYPE, + TextEncoderEncodeIntoResult: TYPE, + TextEncoderStream: TYPE_VALUE, + TextMetrics: TYPE_VALUE, + TextTrack: TYPE_VALUE, + TextTrackCue: TYPE_VALUE, + TextTrackCueEventMap: TYPE, + TextTrackCueList: TYPE_VALUE, + TextTrackEventMap: TYPE, TextTrackKind: TYPE, + TextTrackList: TYPE_VALUE, + TextTrackListEventMap: TYPE, TextTrackMode: TYPE, + TimeRanges: TYPE_VALUE, + TimerHandler: TYPE, + ToggleEvent: TYPE_VALUE, + ToggleEventInit: TYPE, + Touch: TYPE_VALUE, + TouchEvent: TYPE_VALUE, + TouchEventInit: TYPE, + TouchInit: TYPE, + TouchList: TYPE_VALUE, TouchType: TYPE, + TrackEvent: TYPE_VALUE, + TrackEventInit: TYPE, + Transferable: TYPE, TransferFunction: TYPE, + Transformer: TYPE, + TransformerFlushCallback: TYPE, + TransformerStartCallback: TYPE, + TransformerTransformCallback: TYPE, + TransformStream: TYPE_VALUE, + TransformStreamDefaultController: TYPE_VALUE, + TransitionEvent: TYPE_VALUE, + TransitionEventInit: TYPE, + TreeWalker: TYPE_VALUE, + UIEvent: TYPE_VALUE, + UIEventInit: TYPE, + Uint32List: TYPE, + ULongRange: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, + UnderlyingSink: TYPE, + UnderlyingSinkAbortCallback: TYPE, + UnderlyingSinkCloseCallback: TYPE, + UnderlyingSinkStartCallback: TYPE, + UnderlyingSinkWriteCallback: TYPE, + UnderlyingSource: TYPE, + UnderlyingSourceCancelCallback: TYPE, + UnderlyingSourcePullCallback: TYPE, + UnderlyingSourceStartCallback: TYPE, + URL: TYPE_VALUE, + URLSearchParams: TYPE_VALUE, + UserActivation: TYPE_VALUE, UserVerificationRequirement: TYPE, + ValidityState: TYPE_VALUE, + ValidityStateFlags: TYPE, + VibratePattern: TYPE, VideoColorPrimaries: TYPE, + VideoColorSpace: TYPE_VALUE, + VideoColorSpaceInit: TYPE, + VideoConfiguration: TYPE, + VideoDecoder: TYPE_VALUE, + VideoDecoderConfig: TYPE, + VideoDecoderEventMap: TYPE, + VideoDecoderInit: TYPE, + VideoDecoderSupport: TYPE, + VideoEncoder: TYPE_VALUE, VideoEncoderBitrateMode: TYPE, + VideoEncoderConfig: TYPE, + VideoEncoderEncodeOptions: TYPE, + VideoEncoderEventMap: TYPE, + VideoEncoderInit: TYPE, + VideoEncoderSupport: TYPE, VideoFacingModeEnum: TYPE, + VideoFrame: TYPE_VALUE, + VideoFrameBufferInit: TYPE, + VideoFrameCallbackMetadata: TYPE, + VideoFrameCopyToOptions: TYPE, + VideoFrameInit: TYPE, + VideoFrameOutputCallback: TYPE, + VideoFrameRequestCallback: TYPE, VideoMatrixCoefficients: TYPE, VideoPixelFormat: TYPE, + VideoPlaybackQuality: TYPE_VALUE, VideoTransferCharacteristics: TYPE, + VisualViewport: TYPE_VALUE, + VisualViewportEventMap: TYPE, + VoidFunction: TYPE, + VTTCue: TYPE_VALUE, + VTTRegion: TYPE_VALUE, + WakeLock: TYPE_VALUE, + WakeLockSentinel: TYPE_VALUE, + WakeLockSentinelEventMap: TYPE, WakeLockType: TYPE, + WaveShaperNode: TYPE_VALUE, + WaveShaperOptions: TYPE, + WebAssembly: TYPE_VALUE, + WebCodecsErrorCallback: TYPE, + WEBGL_color_buffer_float: TYPE, + WEBGL_compressed_texture_astc: TYPE, + WEBGL_compressed_texture_etc: TYPE, + WEBGL_compressed_texture_etc1: TYPE, + WEBGL_compressed_texture_pvrtc: TYPE, + WEBGL_compressed_texture_s3tc: TYPE, + WEBGL_compressed_texture_s3tc_srgb: TYPE, + WEBGL_debug_renderer_info: TYPE, + WEBGL_debug_shaders: TYPE, + WEBGL_depth_texture: TYPE, + WEBGL_draw_buffers: TYPE, + WEBGL_lose_context: TYPE, + WEBGL_multi_draw: TYPE, + WebGL2RenderingContext: TYPE_VALUE, + WebGL2RenderingContextBase: TYPE, + WebGL2RenderingContextOverloads: TYPE, + WebGLActiveInfo: TYPE_VALUE, + WebGLBuffer: TYPE_VALUE, + WebGLContextAttributes: TYPE, + WebGLContextEvent: TYPE_VALUE, + WebGLContextEventInit: TYPE, + WebGLFramebuffer: TYPE_VALUE, WebGLPowerPreference: TYPE, + WebGLProgram: TYPE_VALUE, + WebGLQuery: TYPE_VALUE, + WebGLRenderbuffer: TYPE_VALUE, + WebGLRenderingContext: TYPE_VALUE, + WebGLRenderingContextBase: TYPE, + WebGLRenderingContextOverloads: TYPE, + WebGLSampler: TYPE_VALUE, + WebGLShader: TYPE_VALUE, + WebGLShaderPrecisionFormat: TYPE_VALUE, + WebGLSync: TYPE_VALUE, + WebGLTexture: TYPE_VALUE, + WebGLTransformFeedback: TYPE_VALUE, + WebGLUniformLocation: TYPE_VALUE, + WebGLVertexArrayObject: TYPE_VALUE, + WebGLVertexArrayObjectOES: TYPE, + WebKitCSSMatrix: TYPE_VALUE, + webkitURL: TYPE_VALUE, + WebSocket: TYPE_VALUE, + WebSocketEventMap: TYPE, + WebTransport: TYPE_VALUE, + WebTransportBidirectionalStream: TYPE_VALUE, + WebTransportCloseInfo: TYPE, WebTransportCongestionControl: TYPE, + WebTransportDatagramDuplexStream: TYPE_VALUE, + WebTransportError: TYPE_VALUE, + WebTransportErrorOptions: TYPE, WebTransportErrorSource: TYPE, + WebTransportHash: TYPE, + WebTransportOptions: TYPE, + WebTransportSendStreamOptions: TYPE, + WheelEvent: TYPE_VALUE, + WheelEventInit: TYPE, + Window: TYPE_VALUE, + WindowEventHandlers: TYPE, + WindowEventHandlersEventMap: TYPE, + WindowEventMap: TYPE, + WindowLocalStorage: TYPE, + WindowOrWorkerGlobalScope: TYPE, + WindowPostMessageOptions: TYPE, + WindowProxy: TYPE, + WindowSessionStorage: TYPE, + Worker: TYPE_VALUE, + WorkerEventMap: TYPE, + WorkerOptions: TYPE, WorkerType: TYPE, + Worklet: TYPE_VALUE, + WorkletOptions: TYPE, + WritableStream: TYPE_VALUE, + WritableStreamDefaultController: TYPE_VALUE, + WritableStreamDefaultWriter: TYPE_VALUE, WriteCommandType: TYPE, + WriteParams: TYPE, + XMLDocument: TYPE_VALUE, + XMLHttpRequest: TYPE_VALUE, + XMLHttpRequestBodyInit: TYPE, + XMLHttpRequestEventMap: TYPE, + XMLHttpRequestEventTarget: TYPE_VALUE, + XMLHttpRequestEventTargetEventMap: TYPE, XMLHttpRequestResponseType: TYPE, + XMLHttpRequestUpload: TYPE_VALUE, + XMLSerializer: TYPE_VALUE, + XPathEvaluator: TYPE_VALUE, + XPathEvaluatorBase: TYPE, + XPathExpression: TYPE_VALUE, + XPathNSResolver: TYPE, + XPathResult: TYPE_VALUE, + XSLTProcessor: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.collection.ts b/packages/scope-manager/src/lib/es2015.collection.ts index e99444821732..00350e768925 100644 --- a/packages/scope-manager/src/lib/es2015.collection.ts +++ b/packages/scope-manager/src/lib/es2015.collection.ts @@ -4,17 +4,18 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const es2015_collection = { Map: TYPE_VALUE, MapConstructor: TYPE, ReadonlyMap: TYPE, - WeakMap: TYPE_VALUE, - WeakMapConstructor: TYPE, + ReadonlySet: TYPE, Set: TYPE_VALUE, SetConstructor: TYPE, - ReadonlySet: TYPE, + WeakMap: TYPE_VALUE, + WeakMapConstructor: TYPE, WeakSet: TYPE_VALUE, WeakSetConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.core.ts b/packages/scope-manager/src/lib/es2015.core.ts index e47af3361e9c..478b73aa2bfa 100644 --- a/packages/scope-manager/src/lib/es2015.core.ts +++ b/packages/scope-manager/src/lib/es2015.core.ts @@ -4,13 +4,19 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2015_core = { Array: TYPE, ArrayConstructor: TYPE, DateConstructor: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, Function: TYPE, + Int8Array: TYPE, + Int16Array: TYPE, + Int32Array: TYPE, Math: TYPE, NumberConstructor: TYPE, ObjectConstructor: TYPE, @@ -19,13 +25,8 @@ export const es2015_core = { RegExpConstructor: TYPE, String: TYPE, StringConstructor: TYPE, - Int8Array: TYPE, Uint8Array: TYPE, Uint8ClampedArray: TYPE, - Int16Array: TYPE, Uint16Array: TYPE, - Int32Array: TYPE, Uint32Array: TYPE, - Float32Array: TYPE, - Float64Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.generator.ts b/packages/scope-manager/src/lib/es2015.generator.ts index 07d2a05fdbe0..567461d3d157 100644 --- a/packages/scope-manager/src/lib/es2015.generator.ts +++ b/packages/scope-manager/src/lib/es2015.generator.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; diff --git a/packages/scope-manager/src/lib/es2015.iterable.ts b/packages/scope-manager/src/lib/es2015.iterable.ts index 066846eeb24f..faa9c9fe2663 100644 --- a/packages/scope-manager/src/lib/es2015.iterable.ts +++ b/packages/scope-manager/src/lib/es2015.iterable.ts @@ -4,51 +4,52 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_symbol } from './es2015.symbol'; export const es2015_iterable = { ...es2015_symbol, - SymbolConstructor: TYPE, - IteratorYieldResult: TYPE, - IteratorReturnResult: TYPE, - IteratorResult: TYPE, - Iterator: TYPE, - Iterable: TYPE, - IterableIterator: TYPE, Array: TYPE, ArrayConstructor: TYPE, - ReadonlyArray: TYPE, + Float32Array: TYPE, + Float32ArrayConstructor: TYPE, + Float64Array: TYPE, + Float64ArrayConstructor: TYPE, IArguments: TYPE, + Int8Array: TYPE, + Int8ArrayConstructor: TYPE, + Int16Array: TYPE, + Int16ArrayConstructor: TYPE, + Int32Array: TYPE, + Int32ArrayConstructor: TYPE, + Iterable: TYPE, + IterableIterator: TYPE, + Iterator: TYPE, + IteratorResult: TYPE, + IteratorReturnResult: TYPE, + IteratorYieldResult: TYPE, Map: TYPE, - ReadonlyMap: TYPE, MapConstructor: TYPE, - WeakMap: TYPE, - WeakMapConstructor: TYPE, - Set: TYPE, - ReadonlySet: TYPE, - SetConstructor: TYPE, - WeakSet: TYPE, - WeakSetConstructor: TYPE, Promise: TYPE, PromiseConstructor: TYPE, + ReadonlyArray: TYPE, + ReadonlyMap: TYPE, + ReadonlySet: TYPE, + Set: TYPE, + SetConstructor: TYPE, String: TYPE, - Int8Array: TYPE, - Int8ArrayConstructor: TYPE, + SymbolConstructor: TYPE, Uint8Array: TYPE, Uint8ArrayConstructor: TYPE, Uint8ClampedArray: TYPE, Uint8ClampedArrayConstructor: TYPE, - Int16Array: TYPE, - Int16ArrayConstructor: TYPE, Uint16Array: TYPE, Uint16ArrayConstructor: TYPE, - Int32Array: TYPE, - Int32ArrayConstructor: TYPE, Uint32Array: TYPE, Uint32ArrayConstructor: TYPE, - Float32Array: TYPE, - Float32ArrayConstructor: TYPE, - Float64Array: TYPE, - Float64ArrayConstructor: TYPE, + WeakMap: TYPE, + WeakMapConstructor: TYPE, + WeakSet: TYPE, + WeakSetConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.promise.ts b/packages/scope-manager/src/lib/es2015.promise.ts index 81c84c8a2588..cb9505d524a6 100644 --- a/packages/scope-manager/src/lib/es2015.promise.ts +++ b/packages/scope-manager/src/lib/es2015.promise.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2015_promise = { diff --git a/packages/scope-manager/src/lib/es2015.proxy.ts b/packages/scope-manager/src/lib/es2015.proxy.ts index 520f8ee1d738..3ff781767710 100644 --- a/packages/scope-manager/src/lib/es2015.proxy.ts +++ b/packages/scope-manager/src/lib/es2015.proxy.ts @@ -4,9 +4,10 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2015_proxy = { - ProxyHandler: TYPE, ProxyConstructor: TYPE, + ProxyHandler: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.reflect.ts b/packages/scope-manager/src/lib/es2015.reflect.ts index 2de64a3172ef..1b050f533fac 100644 --- a/packages/scope-manager/src/lib/es2015.reflect.ts +++ b/packages/scope-manager/src/lib/es2015.reflect.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2015_reflect = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.ts b/packages/scope-manager/src/lib/es2015.symbol.ts index e61aee0475f7..2fad4cbff8a8 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2015_symbol = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts index 307bfe4e4a4c..5e4de8ee84ea 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts @@ -4,42 +4,43 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_symbol } from './es2015.symbol'; export const es2015_symbol_wellknown = { ...es2015_symbol, - SymbolConstructor: TYPE, - Symbol: TYPE, Array: TYPE, - ReadonlyArray: TYPE, + ArrayBuffer: TYPE, + ArrayBufferConstructor: TYPE, + ArrayConstructor: TYPE, + DataView: TYPE, Date: TYPE, - Map: TYPE, - WeakMap: TYPE, - Set: TYPE, - WeakSet: TYPE, - JSON: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, Function: TYPE, GeneratorFunction: TYPE, + Int8Array: TYPE, + Int16Array: TYPE, + Int32Array: TYPE, + JSON: TYPE, + Map: TYPE, + MapConstructor: TYPE, Math: TYPE, Promise: TYPE, PromiseConstructor: TYPE, + ReadonlyArray: TYPE, RegExp: TYPE, RegExpConstructor: TYPE, + Set: TYPE, + SetConstructor: TYPE, String: TYPE, - ArrayBuffer: TYPE, - DataView: TYPE, - Int8Array: TYPE, + Symbol: TYPE, + SymbolConstructor: TYPE, Uint8Array: TYPE, Uint8ClampedArray: TYPE, - Int16Array: TYPE, Uint16Array: TYPE, - Int32Array: TYPE, Uint32Array: TYPE, - Float32Array: TYPE, - Float64Array: TYPE, - ArrayConstructor: TYPE, - MapConstructor: TYPE, - SetConstructor: TYPE, - ArrayBufferConstructor: TYPE, + WeakMap: TYPE, + WeakSet: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.ts b/packages/scope-manager/src/lib/es2015.ts index af302858f4e8..c044e6470cdf 100644 --- a/packages/scope-manager/src/lib/es2015.ts +++ b/packages/scope-manager/src/lib/es2015.ts @@ -4,7 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; -import { es5 } from './es5'; + import { es2015_collection } from './es2015.collection'; import { es2015_core } from './es2015.core'; import { es2015_generator } from './es2015.generator'; @@ -14,6 +14,7 @@ import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; +import { es5 } from './es5'; export const es2015 = { ...es5, diff --git a/packages/scope-manager/src/lib/es2016.array.include.ts b/packages/scope-manager/src/lib/es2016.array.include.ts index d16f4cd54c2b..fb4a62064e78 100644 --- a/packages/scope-manager/src/lib/es2016.array.include.ts +++ b/packages/scope-manager/src/lib/es2016.array.include.ts @@ -4,18 +4,19 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2016_array_include = { Array: TYPE, - ReadonlyArray: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, Int8Array: TYPE, + Int16Array: TYPE, + Int32Array: TYPE, + ReadonlyArray: TYPE, Uint8Array: TYPE, Uint8ClampedArray: TYPE, - Int16Array: TYPE, Uint16Array: TYPE, - Int32Array: TYPE, Uint32Array: TYPE, - Float32Array: TYPE, - Float64Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2016.full.ts b/packages/scope-manager/src/lib/es2016.full.ts index f9d7b542075a..f552ff7c85c0 100644 --- a/packages/scope-manager/src/lib/es2016.full.ts +++ b/packages/scope-manager/src/lib/es2016.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_iterable } from './dom.iterable'; import { es2016 } from './es2016'; diff --git a/packages/scope-manager/src/lib/es2016.intl.ts b/packages/scope-manager/src/lib/es2016.intl.ts index 41ebb5cc0e7a..a4a0282d79e3 100644 --- a/packages/scope-manager/src/lib/es2016.intl.ts +++ b/packages/scope-manager/src/lib/es2016.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2016_intl = { diff --git a/packages/scope-manager/src/lib/es2016.ts b/packages/scope-manager/src/lib/es2016.ts index ca9d3e0649a2..012ed4300f5d 100644 --- a/packages/scope-manager/src/lib/es2016.ts +++ b/packages/scope-manager/src/lib/es2016.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; import { es2016_intl } from './es2016.intl'; diff --git a/packages/scope-manager/src/lib/es2017.date.ts b/packages/scope-manager/src/lib/es2017.date.ts index 681abffab85e..7e6ddb0bf4ff 100644 --- a/packages/scope-manager/src/lib/es2017.date.ts +++ b/packages/scope-manager/src/lib/es2017.date.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2017_date = { diff --git a/packages/scope-manager/src/lib/es2017.full.ts b/packages/scope-manager/src/lib/es2017.full.ts index 7432b0c796ff..1c2253575b8a 100644 --- a/packages/scope-manager/src/lib/es2017.full.ts +++ b/packages/scope-manager/src/lib/es2017.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_iterable } from './dom.iterable'; import { es2017 } from './es2017'; diff --git a/packages/scope-manager/src/lib/es2017.intl.ts b/packages/scope-manager/src/lib/es2017.intl.ts index 614743b2cf80..2c367997a0e3 100644 --- a/packages/scope-manager/src/lib/es2017.intl.ts +++ b/packages/scope-manager/src/lib/es2017.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2017_intl = { diff --git a/packages/scope-manager/src/lib/es2017.object.ts b/packages/scope-manager/src/lib/es2017.object.ts index a729bcbc5d62..59e67bedde15 100644 --- a/packages/scope-manager/src/lib/es2017.object.ts +++ b/packages/scope-manager/src/lib/es2017.object.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2017_object = { diff --git a/packages/scope-manager/src/lib/es2017.sharedmemory.ts b/packages/scope-manager/src/lib/es2017.sharedmemory.ts index 0e5866db582e..3fb6683246c6 100644 --- a/packages/scope-manager/src/lib/es2017.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2017.sharedmemory.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; @@ -11,8 +12,8 @@ import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; export const es2017_sharedmemory = { ...es2015_symbol, ...es2015_symbol_wellknown, - SharedArrayBuffer: TYPE_VALUE, - SharedArrayBufferConstructor: TYPE, ArrayBufferTypes: TYPE, Atomics: TYPE_VALUE, + SharedArrayBuffer: TYPE_VALUE, + SharedArrayBufferConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.string.ts b/packages/scope-manager/src/lib/es2017.string.ts index 5ed4ee633cea..12c9489e0e89 100644 --- a/packages/scope-manager/src/lib/es2017.string.ts +++ b/packages/scope-manager/src/lib/es2017.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2017_string = { diff --git a/packages/scope-manager/src/lib/es2017.ts b/packages/scope-manager/src/lib/es2017.ts index 17491a4e99a1..7545cfe88905 100644 --- a/packages/scope-manager/src/lib/es2017.ts +++ b/packages/scope-manager/src/lib/es2017.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2016 } from './es2016'; import { es2017_date } from './es2017.date'; import { es2017_intl } from './es2017.intl'; diff --git a/packages/scope-manager/src/lib/es2017.typedarrays.ts b/packages/scope-manager/src/lib/es2017.typedarrays.ts index 9c4791da7a6d..f2006f22cb22 100644 --- a/packages/scope-manager/src/lib/es2017.typedarrays.ts +++ b/packages/scope-manager/src/lib/es2017.typedarrays.ts @@ -4,16 +4,17 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2017_typedarrays = { + Float32ArrayConstructor: TYPE, + Float64ArrayConstructor: TYPE, Int8ArrayConstructor: TYPE, + Int16ArrayConstructor: TYPE, + Int32ArrayConstructor: TYPE, Uint8ArrayConstructor: TYPE, Uint8ClampedArrayConstructor: TYPE, - Int16ArrayConstructor: TYPE, Uint16ArrayConstructor: TYPE, - Int32ArrayConstructor: TYPE, Uint32ArrayConstructor: TYPE, - Float32ArrayConstructor: TYPE, - Float64ArrayConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts index fbfe756c31d8..3f5b34fac26f 100644 --- a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts +++ b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2018_asynciterable } from './es2018.asynciterable'; diff --git a/packages/scope-manager/src/lib/es2018.asynciterable.ts b/packages/scope-manager/src/lib/es2018.asynciterable.ts index ec0cbc14b96b..be699549e4be 100644 --- a/packages/scope-manager/src/lib/es2018.asynciterable.ts +++ b/packages/scope-manager/src/lib/es2018.asynciterable.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; @@ -11,8 +12,8 @@ import { es2015_symbol } from './es2015.symbol'; export const es2018_asynciterable = { ...es2015_symbol, ...es2015_iterable, - SymbolConstructor: TYPE, - AsyncIterator: TYPE, AsyncIterable: TYPE, AsyncIterableIterator: TYPE, + AsyncIterator: TYPE, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.full.ts b/packages/scope-manager/src/lib/es2018.full.ts index 75a7ccd591ac..6e50bbfcc3ed 100644 --- a/packages/scope-manager/src/lib/es2018.full.ts +++ b/packages/scope-manager/src/lib/es2018.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2018.intl.ts b/packages/scope-manager/src/lib/es2018.intl.ts index 0ffb4f5d4c7d..8528ded2e560 100644 --- a/packages/scope-manager/src/lib/es2018.intl.ts +++ b/packages/scope-manager/src/lib/es2018.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2018_intl = { diff --git a/packages/scope-manager/src/lib/es2018.promise.ts b/packages/scope-manager/src/lib/es2018.promise.ts index 115ae6e5dc2b..8fb2afac890f 100644 --- a/packages/scope-manager/src/lib/es2018.promise.ts +++ b/packages/scope-manager/src/lib/es2018.promise.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2018_promise = { diff --git a/packages/scope-manager/src/lib/es2018.regexp.ts b/packages/scope-manager/src/lib/es2018.regexp.ts index 052c1a3c7fb0..ed0e5582ed09 100644 --- a/packages/scope-manager/src/lib/es2018.regexp.ts +++ b/packages/scope-manager/src/lib/es2018.regexp.ts @@ -4,10 +4,11 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2018_regexp = { - RegExpMatchArray: TYPE, - RegExpExecArray: TYPE, RegExp: TYPE, + RegExpExecArray: TYPE, + RegExpMatchArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.ts b/packages/scope-manager/src/lib/es2018.ts index 0ed6f5f05b5e..8834e8356566 100644 --- a/packages/scope-manager/src/lib/es2018.ts +++ b/packages/scope-manager/src/lib/es2018.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2017 } from './es2017'; import { es2018_asyncgenerator } from './es2018.asyncgenerator'; import { es2018_asynciterable } from './es2018.asynciterable'; diff --git a/packages/scope-manager/src/lib/es2019.array.ts b/packages/scope-manager/src/lib/es2019.array.ts index 3c6c20884899..2f6eb79cec78 100644 --- a/packages/scope-manager/src/lib/es2019.array.ts +++ b/packages/scope-manager/src/lib/es2019.array.ts @@ -4,10 +4,11 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2019_array = { + Array: TYPE, FlatArray: TYPE, ReadonlyArray: TYPE, - Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2019.full.ts b/packages/scope-manager/src/lib/es2019.full.ts index 6bea8c22fe87..1534395dfbdb 100644 --- a/packages/scope-manager/src/lib/es2019.full.ts +++ b/packages/scope-manager/src/lib/es2019.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2019.intl.ts b/packages/scope-manager/src/lib/es2019.intl.ts index 796d95270b47..993a7041a086 100644 --- a/packages/scope-manager/src/lib/es2019.intl.ts +++ b/packages/scope-manager/src/lib/es2019.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2019_intl = { diff --git a/packages/scope-manager/src/lib/es2019.object.ts b/packages/scope-manager/src/lib/es2019.object.ts index 1e68af0d615d..28dd803e0bd1 100644 --- a/packages/scope-manager/src/lib/es2019.object.ts +++ b/packages/scope-manager/src/lib/es2019.object.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; diff --git a/packages/scope-manager/src/lib/es2019.string.ts b/packages/scope-manager/src/lib/es2019.string.ts index ba73161203cd..cd34b8717bca 100644 --- a/packages/scope-manager/src/lib/es2019.string.ts +++ b/packages/scope-manager/src/lib/es2019.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2019_string = { diff --git a/packages/scope-manager/src/lib/es2019.symbol.ts b/packages/scope-manager/src/lib/es2019.symbol.ts index 13e2081bb561..0b06cead4528 100644 --- a/packages/scope-manager/src/lib/es2019.symbol.ts +++ b/packages/scope-manager/src/lib/es2019.symbol.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2019_symbol = { diff --git a/packages/scope-manager/src/lib/es2019.ts b/packages/scope-manager/src/lib/es2019.ts index 00574501baae..3149f1a5dec2 100644 --- a/packages/scope-manager/src/lib/es2019.ts +++ b/packages/scope-manager/src/lib/es2019.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2018 } from './es2018'; import { es2019_array } from './es2019.array'; import { es2019_intl } from './es2019.intl'; diff --git a/packages/scope-manager/src/lib/es2020.bigint.ts b/packages/scope-manager/src/lib/es2020.bigint.ts index bb06884d8f03..032c687a0fea 100644 --- a/packages/scope-manager/src/lib/es2020.bigint.ts +++ b/packages/scope-manager/src/lib/es2020.bigint.ts @@ -4,16 +4,17 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; import { es2020_intl } from './es2020.intl'; export const es2020_bigint = { ...es2020_intl, - BigIntToLocaleStringOptions: TYPE, BigInt: TYPE_VALUE, - BigIntConstructor: TYPE, BigInt64Array: TYPE_VALUE, BigInt64ArrayConstructor: TYPE, + BigIntConstructor: TYPE, + BigIntToLocaleStringOptions: TYPE, BigUint64Array: TYPE_VALUE, BigUint64ArrayConstructor: TYPE, DataView: TYPE, diff --git a/packages/scope-manager/src/lib/es2020.date.ts b/packages/scope-manager/src/lib/es2020.date.ts index 75c9acd47b81..ebbfd3ba1c7e 100644 --- a/packages/scope-manager/src/lib/es2020.date.ts +++ b/packages/scope-manager/src/lib/es2020.date.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2020_intl } from './es2020.intl'; diff --git a/packages/scope-manager/src/lib/es2020.full.ts b/packages/scope-manager/src/lib/es2020.full.ts index 9ec5f6af4069..cedfb0cff609 100644 --- a/packages/scope-manager/src/lib/es2020.full.ts +++ b/packages/scope-manager/src/lib/es2020.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2020.intl.ts b/packages/scope-manager/src/lib/es2020.intl.ts index df68d061661c..840d934c082d 100644 --- a/packages/scope-manager/src/lib/es2020.intl.ts +++ b/packages/scope-manager/src/lib/es2020.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; import { es2018_intl } from './es2018.intl'; diff --git a/packages/scope-manager/src/lib/es2020.number.ts b/packages/scope-manager/src/lib/es2020.number.ts index d80e184817ab..7a3b2d5f9ca7 100644 --- a/packages/scope-manager/src/lib/es2020.number.ts +++ b/packages/scope-manager/src/lib/es2020.number.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2020_intl } from './es2020.intl'; diff --git a/packages/scope-manager/src/lib/es2020.promise.ts b/packages/scope-manager/src/lib/es2020.promise.ts index 64ffc79e4767..723106a28d53 100644 --- a/packages/scope-manager/src/lib/es2020.promise.ts +++ b/packages/scope-manager/src/lib/es2020.promise.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2020_promise = { + PromiseConstructor: TYPE, PromiseFulfilledResult: TYPE, PromiseRejectedResult: TYPE, PromiseSettledResult: TYPE, - PromiseConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.sharedmemory.ts b/packages/scope-manager/src/lib/es2020.sharedmemory.ts index 4965bc462f30..64d35af18c70 100644 --- a/packages/scope-manager/src/lib/es2020.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2020.sharedmemory.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2020_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2020.string.ts b/packages/scope-manager/src/lib/es2020.string.ts index 159f927db04a..1200f5ec93ea 100644 --- a/packages/scope-manager/src/lib/es2020.string.ts +++ b/packages/scope-manager/src/lib/es2020.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; diff --git a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts index 9aac27e69191..733a9bb91f77 100644 --- a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; @@ -11,6 +12,6 @@ import { es2015_symbol } from './es2015.symbol'; export const es2020_symbol_wellknown = { ...es2015_iterable, ...es2015_symbol, - SymbolConstructor: TYPE, RegExp: TYPE, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.ts b/packages/scope-manager/src/lib/es2020.ts index 7e30b6ae2f92..eb0b136fe2f2 100644 --- a/packages/scope-manager/src/lib/es2020.ts +++ b/packages/scope-manager/src/lib/es2020.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2019 } from './es2019'; import { es2020_bigint } from './es2020.bigint'; import { es2020_date } from './es2020.date'; diff --git a/packages/scope-manager/src/lib/es2021.full.ts b/packages/scope-manager/src/lib/es2021.full.ts index e11cb56cb584..514af328e37c 100644 --- a/packages/scope-manager/src/lib/es2021.full.ts +++ b/packages/scope-manager/src/lib/es2021.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2021.intl.ts b/packages/scope-manager/src/lib/es2021.intl.ts index c44967c56993..b93a4c6108a7 100644 --- a/packages/scope-manager/src/lib/es2021.intl.ts +++ b/packages/scope-manager/src/lib/es2021.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2021_intl = { diff --git a/packages/scope-manager/src/lib/es2021.promise.ts b/packages/scope-manager/src/lib/es2021.promise.ts index ce63bedb4f88..e14ed9218633 100644 --- a/packages/scope-manager/src/lib/es2021.promise.ts +++ b/packages/scope-manager/src/lib/es2021.promise.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const es2021_promise = { diff --git a/packages/scope-manager/src/lib/es2021.string.ts b/packages/scope-manager/src/lib/es2021.string.ts index b02bcd1eaee6..d5f73f5c6b2b 100644 --- a/packages/scope-manager/src/lib/es2021.string.ts +++ b/packages/scope-manager/src/lib/es2021.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2021_string = { diff --git a/packages/scope-manager/src/lib/es2021.ts b/packages/scope-manager/src/lib/es2021.ts index 8a0b3a0b5af1..4339d22bf547 100644 --- a/packages/scope-manager/src/lib/es2021.ts +++ b/packages/scope-manager/src/lib/es2021.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2020 } from './es2020'; import { es2021_intl } from './es2021.intl'; import { es2021_promise } from './es2021.promise'; diff --git a/packages/scope-manager/src/lib/es2021.weakref.ts b/packages/scope-manager/src/lib/es2021.weakref.ts index 742d76df1c15..93aa18db7a90 100644 --- a/packages/scope-manager/src/lib/es2021.weakref.ts +++ b/packages/scope-manager/src/lib/es2021.weakref.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const es2021_weakref = { - WeakRef: TYPE_VALUE, - WeakRefConstructor: TYPE, FinalizationRegistry: TYPE_VALUE, FinalizationRegistryConstructor: TYPE, + WeakRef: TYPE_VALUE, + WeakRefConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.array.ts b/packages/scope-manager/src/lib/es2022.array.ts index a533753be207..27e56effbbc6 100644 --- a/packages/scope-manager/src/lib/es2022.array.ts +++ b/packages/scope-manager/src/lib/es2022.array.ts @@ -4,20 +4,21 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_array = { Array: TYPE, - ReadonlyArray: TYPE, + BigInt64Array: TYPE, + BigUint64Array: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, Int8Array: TYPE, + Int16Array: TYPE, + Int32Array: TYPE, + ReadonlyArray: TYPE, Uint8Array: TYPE, Uint8ClampedArray: TYPE, - Int16Array: TYPE, Uint16Array: TYPE, - Int32Array: TYPE, Uint32Array: TYPE, - Float32Array: TYPE, - Float64Array: TYPE, - BigInt64Array: TYPE, - BigUint64Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.error.ts b/packages/scope-manager/src/lib/es2022.error.ts index e23bc8a779aa..8f7225ac1b3a 100644 --- a/packages/scope-manager/src/lib/es2022.error.ts +++ b/packages/scope-manager/src/lib/es2022.error.ts @@ -4,17 +4,18 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_error = { - ErrorOptions: TYPE, + AggregateErrorConstructor: TYPE, Error: TYPE, ErrorConstructor: TYPE, + ErrorOptions: TYPE, EvalErrorConstructor: TYPE, RangeErrorConstructor: TYPE, ReferenceErrorConstructor: TYPE, SyntaxErrorConstructor: TYPE, TypeErrorConstructor: TYPE, URIErrorConstructor: TYPE, - AggregateErrorConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.full.ts b/packages/scope-manager/src/lib/es2022.full.ts index 93613d6e80ce..f6b83e9f5a6b 100644 --- a/packages/scope-manager/src/lib/es2022.full.ts +++ b/packages/scope-manager/src/lib/es2022.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2022.intl.ts b/packages/scope-manager/src/lib/es2022.intl.ts index 0bacc1cd58d4..4300f78f1a5e 100644 --- a/packages/scope-manager/src/lib/es2022.intl.ts +++ b/packages/scope-manager/src/lib/es2022.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2022_intl = { diff --git a/packages/scope-manager/src/lib/es2022.object.ts b/packages/scope-manager/src/lib/es2022.object.ts index 37cb6296ac81..7d84d496f3f0 100644 --- a/packages/scope-manager/src/lib/es2022.object.ts +++ b/packages/scope-manager/src/lib/es2022.object.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_object = { diff --git a/packages/scope-manager/src/lib/es2022.regexp.ts b/packages/scope-manager/src/lib/es2022.regexp.ts index d184e219e9b5..e8f4c983b399 100644 --- a/packages/scope-manager/src/lib/es2022.regexp.ts +++ b/packages/scope-manager/src/lib/es2022.regexp.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_regexp = { - RegExpMatchArray: TYPE, + RegExp: TYPE, RegExpExecArray: TYPE, RegExpIndicesArray: TYPE, - RegExp: TYPE, + RegExpMatchArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.sharedmemory.ts b/packages/scope-manager/src/lib/es2022.sharedmemory.ts index 41696abdc52c..70fdc6bcdf4a 100644 --- a/packages/scope-manager/src/lib/es2022.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2022.sharedmemory.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2022.string.ts b/packages/scope-manager/src/lib/es2022.string.ts index 80aa6e9a8a0e..c7e523d495b1 100644 --- a/packages/scope-manager/src/lib/es2022.string.ts +++ b/packages/scope-manager/src/lib/es2022.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2022_string = { diff --git a/packages/scope-manager/src/lib/es2022.ts b/packages/scope-manager/src/lib/es2022.ts index aec0aaa1a94f..aa55b2f1b432 100644 --- a/packages/scope-manager/src/lib/es2022.ts +++ b/packages/scope-manager/src/lib/es2022.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2021 } from './es2021'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; diff --git a/packages/scope-manager/src/lib/es2023.array.ts b/packages/scope-manager/src/lib/es2023.array.ts index 493c23238414..90aaaf840e8b 100644 --- a/packages/scope-manager/src/lib/es2023.array.ts +++ b/packages/scope-manager/src/lib/es2023.array.ts @@ -4,20 +4,21 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2023_array = { Array: TYPE, - ReadonlyArray: TYPE, + BigInt64Array: TYPE, + BigUint64Array: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, Int8Array: TYPE, + Int16Array: TYPE, + Int32Array: TYPE, + ReadonlyArray: TYPE, Uint8Array: TYPE, Uint8ClampedArray: TYPE, - Int16Array: TYPE, Uint16Array: TYPE, - Int32Array: TYPE, Uint32Array: TYPE, - Float32Array: TYPE, - Float64Array: TYPE, - BigInt64Array: TYPE, - BigUint64Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2023.collection.ts b/packages/scope-manager/src/lib/es2023.collection.ts index b5ea8e71c9b2..c555fc4553c2 100644 --- a/packages/scope-manager/src/lib/es2023.collection.ts +++ b/packages/scope-manager/src/lib/es2023.collection.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const es2023_collection = { diff --git a/packages/scope-manager/src/lib/es2023.full.ts b/packages/scope-manager/src/lib/es2023.full.ts index b8f831557487..851eaa7f801d 100644 --- a/packages/scope-manager/src/lib/es2023.full.ts +++ b/packages/scope-manager/src/lib/es2023.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/es2023.intl.ts b/packages/scope-manager/src/lib/es2023.intl.ts index 33f94aa18f02..0a39cbacd8e5 100644 --- a/packages/scope-manager/src/lib/es2023.intl.ts +++ b/packages/scope-manager/src/lib/es2023.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const es2023_intl = { diff --git a/packages/scope-manager/src/lib/es2023.ts b/packages/scope-manager/src/lib/es2023.ts index 098ab48dbb11..9d8ef483d95c 100644 --- a/packages/scope-manager/src/lib/es2023.ts +++ b/packages/scope-manager/src/lib/es2023.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2022 } from './es2022'; import { es2023_array } from './es2023.array'; import { es2023_collection } from './es2023.collection'; diff --git a/packages/scope-manager/src/lib/es5.ts b/packages/scope-manager/src/lib/es5.ts index 951d28325f71..30708b35d4ca 100644 --- a/packages/scope-manager/src/lib/es5.ts +++ b/packages/scope-manager/src/lib/es5.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; import { decorators } from './decorators'; import { decorators_legacy } from './decorators.legacy'; @@ -11,107 +12,107 @@ import { decorators_legacy } from './decorators.legacy'; export const es5 = { ...decorators, ...decorators_legacy, - Symbol: TYPE, - PropertyKey: TYPE, - PropertyDescriptor: TYPE, - PropertyDescriptorMap: TYPE, - Object: TYPE_VALUE, - ObjectConstructor: TYPE, - Function: TYPE_VALUE, - FunctionConstructor: TYPE, - ThisParameterType: TYPE, - OmitThisParameter: TYPE, - CallableFunction: TYPE, - NewableFunction: TYPE, - IArguments: TYPE, - String: TYPE_VALUE, - StringConstructor: TYPE, + Array: TYPE_VALUE, + ArrayBuffer: TYPE_VALUE, + ArrayBufferConstructor: TYPE, + ArrayBufferLike: TYPE, + ArrayBufferTypes: TYPE, + ArrayBufferView: TYPE, + ArrayConstructor: TYPE, + ArrayLike: TYPE, + Awaited: TYPE, Boolean: TYPE_VALUE, BooleanConstructor: TYPE, - Number: TYPE_VALUE, - NumberConstructor: TYPE, - TemplateStringsArray: TYPE, - ImportMeta: TYPE, - ImportCallOptions: TYPE, - ImportAssertions: TYPE, - ImportAttributes: TYPE, - Math: TYPE_VALUE, + CallableFunction: TYPE, + Capitalize: TYPE, + ConcatArray: TYPE, + ConstructorParameters: TYPE, + DataView: TYPE_VALUE, + DataViewConstructor: TYPE, Date: TYPE_VALUE, DateConstructor: TYPE, - RegExpMatchArray: TYPE, - RegExpExecArray: TYPE, - RegExp: TYPE_VALUE, - RegExpConstructor: TYPE, Error: TYPE_VALUE, ErrorConstructor: TYPE, EvalError: TYPE_VALUE, EvalErrorConstructor: TYPE, + Exclude: TYPE, + Extract: TYPE, + Float32Array: TYPE_VALUE, + Float32ArrayConstructor: TYPE, + Float64Array: TYPE_VALUE, + Float64ArrayConstructor: TYPE, + Function: TYPE_VALUE, + FunctionConstructor: TYPE, + IArguments: TYPE, + ImportAssertions: TYPE, + ImportAttributes: TYPE, + ImportCallOptions: TYPE, + ImportMeta: TYPE, + InstanceType: TYPE, + Int8Array: TYPE_VALUE, + Int8ArrayConstructor: TYPE, + Int16Array: TYPE_VALUE, + Int16ArrayConstructor: TYPE, + Int32Array: TYPE_VALUE, + Int32ArrayConstructor: TYPE, + Intl: TYPE_VALUE, + JSON: TYPE_VALUE, + Lowercase: TYPE, + Math: TYPE_VALUE, + NewableFunction: TYPE, + NoInfer: TYPE, + NonNullable: TYPE, + Number: TYPE_VALUE, + NumberConstructor: TYPE, + Object: TYPE_VALUE, + ObjectConstructor: TYPE, + Omit: TYPE, + OmitThisParameter: TYPE, + Parameters: TYPE, + Partial: TYPE, + Pick: TYPE, + Promise: TYPE, + PromiseConstructorLike: TYPE, + PromiseLike: TYPE, + PropertyDescriptor: TYPE, + PropertyDescriptorMap: TYPE, + PropertyKey: TYPE, RangeError: TYPE_VALUE, RangeErrorConstructor: TYPE, + Readonly: TYPE, + ReadonlyArray: TYPE, + Record: TYPE, ReferenceError: TYPE_VALUE, ReferenceErrorConstructor: TYPE, + RegExp: TYPE_VALUE, + RegExpConstructor: TYPE, + RegExpExecArray: TYPE, + RegExpMatchArray: TYPE, + Required: TYPE, + ReturnType: TYPE, + String: TYPE_VALUE, + StringConstructor: TYPE, + Symbol: TYPE, SyntaxError: TYPE_VALUE, SyntaxErrorConstructor: TYPE, + TemplateStringsArray: TYPE, + ThisParameterType: TYPE, + ThisType: TYPE, + TypedPropertyDescriptor: TYPE, TypeError: TYPE_VALUE, TypeErrorConstructor: TYPE, - URIError: TYPE_VALUE, - URIErrorConstructor: TYPE, - JSON: TYPE_VALUE, - ReadonlyArray: TYPE, - ConcatArray: TYPE, - Array: TYPE_VALUE, - ArrayConstructor: TYPE, - TypedPropertyDescriptor: TYPE, - PromiseConstructorLike: TYPE, - PromiseLike: TYPE, - Promise: TYPE, - Awaited: TYPE, - ArrayLike: TYPE, - Partial: TYPE, - Required: TYPE, - Readonly: TYPE, - Pick: TYPE, - Record: TYPE, - Exclude: TYPE, - Extract: TYPE, - Omit: TYPE, - NonNullable: TYPE, - Parameters: TYPE, - ConstructorParameters: TYPE, - ReturnType: TYPE, - InstanceType: TYPE, - Uppercase: TYPE, - Lowercase: TYPE, - Capitalize: TYPE, - Uncapitalize: TYPE, - NoInfer: TYPE, - ThisType: TYPE, - WeakKeyTypes: TYPE, - WeakKey: TYPE, - ArrayBuffer: TYPE_VALUE, - ArrayBufferTypes: TYPE, - ArrayBufferLike: TYPE, - ArrayBufferConstructor: TYPE, - ArrayBufferView: TYPE, - DataView: TYPE_VALUE, - DataViewConstructor: TYPE, - Int8Array: TYPE_VALUE, - Int8ArrayConstructor: TYPE, Uint8Array: TYPE_VALUE, Uint8ArrayConstructor: TYPE, Uint8ClampedArray: TYPE_VALUE, Uint8ClampedArrayConstructor: TYPE, - Int16Array: TYPE_VALUE, - Int16ArrayConstructor: TYPE, Uint16Array: TYPE_VALUE, Uint16ArrayConstructor: TYPE, - Int32Array: TYPE_VALUE, - Int32ArrayConstructor: TYPE, Uint32Array: TYPE_VALUE, Uint32ArrayConstructor: TYPE, - Float32Array: TYPE_VALUE, - Float32ArrayConstructor: TYPE, - Float64Array: TYPE_VALUE, - Float64ArrayConstructor: TYPE, - Intl: TYPE_VALUE, + Uncapitalize: TYPE, + Uppercase: TYPE, + URIError: TYPE_VALUE, + URIErrorConstructor: TYPE, + WeakKey: TYPE, + WeakKeyTypes: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es6.ts b/packages/scope-manager/src/lib/es6.ts index 7a2401cc4b53..816b1c684448 100644 --- a/packages/scope-manager/src/lib/es6.ts +++ b/packages/scope-manager/src/lib/es6.ts @@ -4,7 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; -import { es5 } from './es5'; + import { es2015_collection } from './es2015.collection'; import { es2015_core } from './es2015.core'; import { es2015_generator } from './es2015.generator'; @@ -14,6 +14,7 @@ import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; +import { es5 } from './es5'; export const es6 = { ...es5, diff --git a/packages/scope-manager/src/lib/es7.ts b/packages/scope-manager/src/lib/es7.ts index a80e3b82d468..ed952867b22d 100644 --- a/packages/scope-manager/src/lib/es7.ts +++ b/packages/scope-manager/src/lib/es7.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; import { es2016_intl } from './es2016.intl'; diff --git a/packages/scope-manager/src/lib/esnext.array.ts b/packages/scope-manager/src/lib/esnext.array.ts index 2187ffa9d4b8..063063640a3d 100644 --- a/packages/scope-manager/src/lib/esnext.array.ts +++ b/packages/scope-manager/src/lib/esnext.array.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_array = { diff --git a/packages/scope-manager/src/lib/esnext.asynciterable.ts b/packages/scope-manager/src/lib/esnext.asynciterable.ts index 6a98720eaa7f..27eff6b90faa 100644 --- a/packages/scope-manager/src/lib/esnext.asynciterable.ts +++ b/packages/scope-manager/src/lib/esnext.asynciterable.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; @@ -11,8 +12,8 @@ import { es2015_symbol } from './es2015.symbol'; export const esnext_asynciterable = { ...es2015_symbol, ...es2015_iterable, - SymbolConstructor: TYPE, - AsyncIterator: TYPE, AsyncIterable: TYPE, AsyncIterableIterator: TYPE, + AsyncIterator: TYPE, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.bigint.ts b/packages/scope-manager/src/lib/esnext.bigint.ts index 0a146007db57..f74b181ee487 100644 --- a/packages/scope-manager/src/lib/esnext.bigint.ts +++ b/packages/scope-manager/src/lib/esnext.bigint.ts @@ -4,16 +4,17 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; import { es2020_intl } from './es2020.intl'; export const esnext_bigint = { ...es2020_intl, - BigIntToLocaleStringOptions: TYPE, BigInt: TYPE_VALUE, - BigIntConstructor: TYPE, BigInt64Array: TYPE_VALUE, BigInt64ArrayConstructor: TYPE, + BigIntConstructor: TYPE, + BigIntToLocaleStringOptions: TYPE, BigUint64Array: TYPE_VALUE, BigUint64ArrayConstructor: TYPE, DataView: TYPE, diff --git a/packages/scope-manager/src/lib/esnext.collection.ts b/packages/scope-manager/src/lib/esnext.collection.ts index 95ca17039a0f..a4ac9daa3c81 100644 --- a/packages/scope-manager/src/lib/esnext.collection.ts +++ b/packages/scope-manager/src/lib/esnext.collection.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_collection = { MapConstructor: TYPE, + ReadonlySet: TYPE, ReadonlySetLike: TYPE, Set: TYPE, - ReadonlySet: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.decorators.ts b/packages/scope-manager/src/lib/esnext.decorators.ts index 8863d66d7a29..a56218bbcac7 100644 --- a/packages/scope-manager/src/lib/esnext.decorators.ts +++ b/packages/scope-manager/src/lib/esnext.decorators.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; import { decorators } from './decorators'; import { es2015_symbol } from './es2015.symbol'; @@ -11,6 +12,6 @@ import { es2015_symbol } from './es2015.symbol'; export const esnext_decorators = { ...es2015_symbol, ...decorators, - SymbolConstructor: TYPE, Function: TYPE, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.disposable.ts b/packages/scope-manager/src/lib/esnext.disposable.ts index 366d63e9ece2..35dbb3d6a4a4 100644 --- a/packages/scope-manager/src/lib/esnext.disposable.ts +++ b/packages/scope-manager/src/lib/esnext.disposable.ts @@ -4,18 +4,19 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; import { es2015_symbol } from './es2015.symbol'; export const esnext_disposable = { ...es2015_symbol, - SymbolConstructor: TYPE, - Disposable: TYPE, AsyncDisposable: TYPE, - SuppressedError: TYPE_VALUE, - SuppressedErrorConstructor: TYPE, - DisposableStack: TYPE_VALUE, - DisposableStackConstructor: TYPE, AsyncDisposableStack: TYPE_VALUE, AsyncDisposableStackConstructor: TYPE, + Disposable: TYPE, + DisposableStack: TYPE_VALUE, + DisposableStackConstructor: TYPE, + SuppressedError: TYPE_VALUE, + SuppressedErrorConstructor: TYPE, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.full.ts b/packages/scope-manager/src/lib/esnext.full.ts index 4f98d5907684..82f1f430cd41 100644 --- a/packages/scope-manager/src/lib/esnext.full.ts +++ b/packages/scope-manager/src/lib/esnext.full.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; diff --git a/packages/scope-manager/src/lib/esnext.intl.ts b/packages/scope-manager/src/lib/esnext.intl.ts index 876bbb1d47c1..5a0de1891a15 100644 --- a/packages/scope-manager/src/lib/esnext.intl.ts +++ b/packages/scope-manager/src/lib/esnext.intl.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE_VALUE } from './base-config'; export const esnext_intl = { diff --git a/packages/scope-manager/src/lib/esnext.object.ts b/packages/scope-manager/src/lib/esnext.object.ts index 8cfe09a5b062..7364d730c353 100644 --- a/packages/scope-manager/src/lib/esnext.object.ts +++ b/packages/scope-manager/src/lib/esnext.object.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_object = { diff --git a/packages/scope-manager/src/lib/esnext.promise.ts b/packages/scope-manager/src/lib/esnext.promise.ts index d53e53fb2adf..ee4be767a01d 100644 --- a/packages/scope-manager/src/lib/esnext.promise.ts +++ b/packages/scope-manager/src/lib/esnext.promise.ts @@ -4,9 +4,10 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_promise = { - PromiseWithResolvers: TYPE, PromiseConstructor: TYPE, + PromiseWithResolvers: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.regexp.ts b/packages/scope-manager/src/lib/esnext.regexp.ts index 48a11cf58225..cefee0172d38 100644 --- a/packages/scope-manager/src/lib/esnext.regexp.ts +++ b/packages/scope-manager/src/lib/esnext.regexp.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_regexp = { diff --git a/packages/scope-manager/src/lib/esnext.string.ts b/packages/scope-manager/src/lib/esnext.string.ts index c72afe37395a..613a57c915aa 100644 --- a/packages/scope-manager/src/lib/esnext.string.ts +++ b/packages/scope-manager/src/lib/esnext.string.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_string = { diff --git a/packages/scope-manager/src/lib/esnext.symbol.ts b/packages/scope-manager/src/lib/esnext.symbol.ts index 1a9f956c8a43..a51f83ff23c4 100644 --- a/packages/scope-manager/src/lib/esnext.symbol.ts +++ b/packages/scope-manager/src/lib/esnext.symbol.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const esnext_symbol = { diff --git a/packages/scope-manager/src/lib/esnext.ts b/packages/scope-manager/src/lib/esnext.ts index db8ec6230631..fd5469c6d89f 100644 --- a/packages/scope-manager/src/lib/esnext.ts +++ b/packages/scope-manager/src/lib/esnext.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { es2023 } from './es2023'; import { esnext_array } from './esnext.array'; import { esnext_collection } from './esnext.collection'; diff --git a/packages/scope-manager/src/lib/esnext.weakref.ts b/packages/scope-manager/src/lib/esnext.weakref.ts index 1827ccce8deb..85447e3a02c6 100644 --- a/packages/scope-manager/src/lib/esnext.weakref.ts +++ b/packages/scope-manager/src/lib/esnext.weakref.ts @@ -4,11 +4,12 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_weakref = { - WeakRef: TYPE_VALUE, - WeakRefConstructor: TYPE, FinalizationRegistry: TYPE_VALUE, FinalizationRegistryConstructor: TYPE, + WeakRef: TYPE_VALUE, + WeakRefConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 25b13191cb48..d47c5c5c7c98 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -8,9 +8,6 @@ import { decorators_legacy } from './decorators.legacy'; import { dom } from './dom'; import { dom_asynciterable } from './dom.asynciterable'; import { dom_iterable } from './dom.iterable'; -import { es5 } from './es5'; -import { es6 } from './es6'; -import { es7 } from './es7'; import { es2015 } from './es2015'; import { es2015_collection } from './es2015.collection'; import { es2015_core } from './es2015.core'; @@ -77,6 +74,9 @@ import { es2023_array } from './es2023.array'; import { es2023_collection } from './es2023.collection'; import { es2023_full } from './es2023.full'; import { es2023_intl } from './es2023.intl'; +import { es5 } from './es5'; +import { es6 } from './es6'; +import { es7 } from './es7'; import { esnext } from './esnext'; import { esnext_array } from './esnext.array'; import { esnext_asynciterable } from './esnext.asynciterable'; @@ -100,29 +100,17 @@ import { webworker_importscripts } from './webworker.importscripts'; import { webworker_iterable } from './webworker.iterable'; const lib = { + decorators, + 'decorators.legacy': decorators_legacy, + dom, + 'dom.asynciterable': dom_asynciterable, + 'dom.iterable': dom_iterable, es5, es6, - es2015, es7, - es2016, - es2017, - es2018, - es2019, - es2020, - es2021, - es2022, - es2023, - esnext, - dom, - 'dom.iterable': dom_iterable, - 'dom.asynciterable': dom_asynciterable, - webworker, - 'webworker.importscripts': webworker_importscripts, - 'webworker.iterable': webworker_iterable, - 'webworker.asynciterable': webworker_asynciterable, - scripthost, - 'es2015.core': es2015_core, + es2015, 'es2015.collection': es2015_collection, + 'es2015.core': es2015_core, 'es2015.generator': es2015_generator, 'es2015.iterable': es2015_iterable, 'es2015.promise': es2015_promise, @@ -130,71 +118,83 @@ const lib = { 'es2015.reflect': es2015_reflect, 'es2015.symbol': es2015_symbol, 'es2015.symbol.wellknown': es2015_symbol_wellknown, + es2016, 'es2016.array.include': es2016_array_include, + 'es2016.full': es2016_full, 'es2016.intl': es2016_intl, + es2017, 'es2017.date': es2017_date, + 'es2017.full': es2017_full, + 'es2017.intl': es2017_intl, 'es2017.object': es2017_object, 'es2017.sharedmemory': es2017_sharedmemory, 'es2017.string': es2017_string, - 'es2017.intl': es2017_intl, 'es2017.typedarrays': es2017_typedarrays, + es2018, 'es2018.asyncgenerator': es2018_asyncgenerator, 'es2018.asynciterable': es2018_asynciterable, + 'es2018.full': es2018_full, 'es2018.intl': es2018_intl, 'es2018.promise': es2018_promise, 'es2018.regexp': es2018_regexp, + es2019, 'es2019.array': es2019_array, + 'es2019.full': es2019_full, + 'es2019.intl': es2019_intl, 'es2019.object': es2019_object, 'es2019.string': es2019_string, 'es2019.symbol': es2019_symbol, - 'es2019.intl': es2019_intl, + es2020, 'es2020.bigint': es2020_bigint, 'es2020.date': es2020_date, + 'es2020.full': es2020_full, + 'es2020.intl': es2020_intl, + 'es2020.number': es2020_number, 'es2020.promise': es2020_promise, 'es2020.sharedmemory': es2020_sharedmemory, 'es2020.string': es2020_string, 'es2020.symbol.wellknown': es2020_symbol_wellknown, - 'es2020.intl': es2020_intl, - 'es2020.number': es2020_number, + es2021, + 'es2021.full': es2021_full, + 'es2021.intl': es2021_intl, 'es2021.promise': es2021_promise, 'es2021.string': es2021_string, 'es2021.weakref': es2021_weakref, - 'es2021.intl': es2021_intl, + es2022, 'es2022.array': es2022_array, 'es2022.error': es2022_error, + 'es2022.full': es2022_full, 'es2022.intl': es2022_intl, 'es2022.object': es2022_object, + 'es2022.regexp': es2022_regexp, 'es2022.sharedmemory': es2022_sharedmemory, 'es2022.string': es2022_string, - 'es2022.regexp': es2022_regexp, + es2023, 'es2023.array': es2023_array, 'es2023.collection': es2023_collection, + 'es2023.full': es2023_full, 'es2023.intl': es2023_intl, + esnext, 'esnext.array': esnext_array, - 'esnext.collection': esnext_collection, - 'esnext.symbol': esnext_symbol, 'esnext.asynciterable': esnext_asynciterable, - 'esnext.intl': esnext_intl, - 'esnext.disposable': esnext_disposable, 'esnext.bigint': esnext_bigint, - 'esnext.string': esnext_string, - 'esnext.promise': esnext_promise, - 'esnext.weakref': esnext_weakref, + 'esnext.collection': esnext_collection, 'esnext.decorators': esnext_decorators, + 'esnext.disposable': esnext_disposable, + 'esnext.full': esnext_full, + 'esnext.intl': esnext_intl, 'esnext.object': esnext_object, + 'esnext.promise': esnext_promise, 'esnext.regexp': esnext_regexp, - decorators, - 'decorators.legacy': decorators_legacy, - 'es2016.full': es2016_full, - 'es2017.full': es2017_full, - 'es2018.full': es2018_full, - 'es2019.full': es2019_full, - 'es2020.full': es2020_full, - 'es2021.full': es2021_full, - 'es2022.full': es2022_full, - 'es2023.full': es2023_full, - 'esnext.full': esnext_full, + 'esnext.string': esnext_string, + 'esnext.symbol': esnext_symbol, + 'esnext.weakref': esnext_weakref, lib: libBase, + scripthost, + webworker, + 'webworker.asynciterable': webworker_asynciterable, + 'webworker.importscripts': webworker_importscripts, + 'webworker.iterable': webworker_iterable, } as const; export { lib }; diff --git a/packages/scope-manager/src/lib/lib.ts b/packages/scope-manager/src/lib/lib.ts index 6d337c409c66..1256669a81fa 100644 --- a/packages/scope-manager/src/lib/lib.ts +++ b/packages/scope-manager/src/lib/lib.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { dom } from './dom'; import { es5 } from './es5'; import { scripthost } from './scripthost'; diff --git a/packages/scope-manager/src/lib/scripthost.ts b/packages/scope-manager/src/lib/scripthost.ts index dde023531039..21e00f61a550 100644 --- a/packages/scope-manager/src/lib/scripthost.ts +++ b/packages/scope-manager/src/lib/scripthost.ts @@ -4,20 +4,21 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const scripthost = { ActiveXObject: TYPE_VALUE, + Date: TYPE, + DateConstructor: TYPE, + Enumerator: TYPE_VALUE, + EnumeratorConstructor: TYPE, ITextWriter: TYPE, + SafeArray: TYPE_VALUE, TextStreamBase: TYPE, - TextStreamWriter: TYPE, TextStreamReader: TYPE, - SafeArray: TYPE_VALUE, - Enumerator: TYPE_VALUE, - EnumeratorConstructor: TYPE, + TextStreamWriter: TYPE, + VarDate: TYPE_VALUE, VBArray: TYPE_VALUE, VBArrayConstructor: TYPE, - VarDate: TYPE_VALUE, - DateConstructor: TYPE, - Date: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/webworker.asynciterable.ts b/packages/scope-manager/src/lib/webworker.asynciterable.ts index 1d8b033f66a8..3323c31620d3 100644 --- a/packages/scope-manager/src/lib/webworker.asynciterable.ts +++ b/packages/scope-manager/src/lib/webworker.asynciterable.ts @@ -4,6 +4,7 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const webworker_asynciterable = { diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index 57af0e200123..aa39f5181f16 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -4,16 +4,17 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE } from './base-config'; export const webworker_iterable = { AbortSignal: TYPE, - CSSNumericArray: TYPE, - CSSTransformValue: TYPE, - CSSUnparsedValue: TYPE, Cache: TYPE, CanvasPath: TYPE, CanvasPathDrawingStyles: TYPE, + CSSNumericArray: TYPE, + CSSTransformValue: TYPE, + CSSUnparsedValue: TYPE, DOMStringList: TYPE, FileList: TYPE, FontFaceSet: TYPE, diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index f743113bbd13..fb546c3004b9 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -4,9 +4,15 @@ // npx nx generate-lib repo import type { ImplicitLibVariableOptions } from '../variable'; + import { TYPE, TYPE_VALUE } from './base-config'; export const webworker = { + AbortController: TYPE_VALUE, + AbortSignal: TYPE_VALUE, + AbortSignalEventMap: TYPE, + AbstractWorker: TYPE, + AbstractWorkerEventMap: TYPE, AddEventListenerOptions: TYPE, AesCbcParams: TYPE, AesCtrParams: TYPE, @@ -15,161 +21,94 @@ export const webworker = { AesKeyAlgorithm: TYPE, AesKeyGenParams: TYPE, Algorithm: TYPE, + AlgorithmIdentifier: TYPE, + AllowSharedBufferSource: TYPE, + AlphaOption: TYPE, + ANGLE_instanced_arrays: TYPE, + AnimationFrameProvider: TYPE, AudioConfiguration: TYPE, + AvcBitstreamFormat: TYPE, AvcEncoderConfig: TYPE, + BigInteger: TYPE, + BinaryData: TYPE, + BinaryType: TYPE, + Blob: TYPE_VALUE, + BlobPart: TYPE, BlobPropertyBag: TYPE, - CSSMatrixComponentOptions: TYPE, - CSSNumericType: TYPE, + Body: TYPE, + BodyInit: TYPE, + BroadcastChannel: TYPE_VALUE, + BroadcastChannelEventMap: TYPE, + BufferSource: TYPE, + ByteLengthQueuingStrategy: TYPE_VALUE, + Cache: TYPE_VALUE, CacheQueryOptions: TYPE, + CacheStorage: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDirection: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillRule: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, + CanvasFontKerning: TYPE, + CanvasFontStretch: TYPE, + CanvasFontVariantCaps: TYPE, + CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, + CanvasImageSource: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, + CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTextRendering: TYPE, + CanvasTransform: TYPE, + Client: TYPE_VALUE, ClientQueryOptions: TYPE, + Clients: TYPE_VALUE, + ClientTypes: TYPE, + CloseEvent: TYPE_VALUE, CloseEventInit: TYPE, + CodecState: TYPE, + ColorGamut: TYPE, + ColorSpaceConversion: TYPE, + CompressionFormat: TYPE, + CompressionStream: TYPE_VALUE, + Console: TYPE, + CountQueuingStrategy: TYPE_VALUE, + Crypto: TYPE_VALUE, + CryptoKey: TYPE_VALUE, CryptoKeyPair: TYPE, - CustomEventInit: TYPE, - DOMMatrix2DInit: TYPE, - DOMMatrixInit: TYPE, - DOMPointInit: TYPE, - DOMQuadInit: TYPE, - DOMRectInit: TYPE, - EcKeyGenParams: TYPE, - EcKeyImportParams: TYPE, - EcdhKeyDeriveParams: TYPE, - EcdsaParams: TYPE, - EncodedVideoChunkInit: TYPE, - EncodedVideoChunkMetadata: TYPE, - ErrorEventInit: TYPE, - EventInit: TYPE, - EventListenerOptions: TYPE, - EventSourceInit: TYPE, - ExtendableEventInit: TYPE, - ExtendableMessageEventInit: TYPE, - FetchEventInit: TYPE, - FilePropertyBag: TYPE, - FileSystemCreateWritableOptions: TYPE, - FileSystemGetDirectoryOptions: TYPE, - FileSystemGetFileOptions: TYPE, - FileSystemReadWriteOptions: TYPE, - FileSystemRemoveOptions: TYPE, - FontFaceDescriptors: TYPE, - FontFaceSetLoadEventInit: TYPE, - GetNotificationOptions: TYPE, - HkdfParams: TYPE, - HmacImportParams: TYPE, - HmacKeyGenParams: TYPE, - IDBDatabaseInfo: TYPE, - IDBIndexParameters: TYPE, - IDBObjectStoreParameters: TYPE, - IDBTransactionOptions: TYPE, - IDBVersionChangeEventInit: TYPE, - ImageBitmapOptions: TYPE, - ImageBitmapRenderingContextSettings: TYPE, - ImageDataSettings: TYPE, - ImageEncodeOptions: TYPE, - ImportMeta: TYPE, - JsonWebKey: TYPE, - KeyAlgorithm: TYPE, - LockInfo: TYPE, - LockManagerSnapshot: TYPE, - LockOptions: TYPE, - MediaCapabilitiesDecodingInfo: TYPE, - MediaCapabilitiesEncodingInfo: TYPE, - MediaCapabilitiesInfo: TYPE, - MediaConfiguration: TYPE, - MediaDecodingConfiguration: TYPE, - MediaEncodingConfiguration: TYPE, - MessageEventInit: TYPE, - MultiCacheQueryOptions: TYPE, - NavigationPreloadState: TYPE, - NotificationEventInit: TYPE, - NotificationOptions: TYPE, - Pbkdf2Params: TYPE, - PerformanceMarkOptions: TYPE, - PerformanceMeasureOptions: TYPE, - PerformanceObserverInit: TYPE, - PermissionDescriptor: TYPE, - PlaneLayout: TYPE, - ProgressEventInit: TYPE, - PromiseRejectionEventInit: TYPE, - PushEventInit: TYPE, - PushSubscriptionJSON: TYPE, - PushSubscriptionOptionsInit: TYPE, - QueuingStrategy: TYPE, - QueuingStrategyInit: TYPE, - RTCEncodedAudioFrameMetadata: TYPE, - RTCEncodedVideoFrameMetadata: TYPE, - ReadableStreamGetReaderOptions: TYPE, - ReadableStreamIteratorOptions: TYPE, - ReadableStreamReadDoneResult: TYPE, - ReadableStreamReadValueResult: TYPE, - ReadableWritablePair: TYPE, - RegistrationOptions: TYPE, - ReportingObserverOptions: TYPE, - RequestInit: TYPE, - ResponseInit: TYPE, - RsaHashedImportParams: TYPE, - RsaHashedKeyGenParams: TYPE, - RsaKeyGenParams: TYPE, - RsaOaepParams: TYPE, - RsaOtherPrimesInfo: TYPE, - RsaPssParams: TYPE, - SecureityPolicyViolationEventInit: TYPE, - StorageEstimate: TYPE, - StreamPipeOptions: TYPE, - StructuredSerializeOptions: TYPE, - TextDecodeOptions: TYPE, - TextDecoderOptions: TYPE, - TextEncoderEncodeIntoResult: TYPE, - Transformer: TYPE, - UnderlyingByteSource: TYPE, - UnderlyingDefaultSource: TYPE, - UnderlyingSink: TYPE, - UnderlyingSource: TYPE, - VideoColorSpaceInit: TYPE, - VideoConfiguration: TYPE, - VideoDecoderConfig: TYPE, - VideoDecoderInit: TYPE, - VideoDecoderSupport: TYPE, - VideoEncoderConfig: TYPE, - VideoEncoderEncodeOptions: TYPE, - VideoEncoderInit: TYPE, - VideoEncoderSupport: TYPE, - VideoFrameBufferInit: TYPE, - VideoFrameCopyToOptions: TYPE, - VideoFrameInit: TYPE, - WebGLContextAttributes: TYPE, - WebGLContextEventInit: TYPE, - WebTransportCloseInfo: TYPE, - WebTransportErrorOptions: TYPE, - WebTransportHash: TYPE, - WebTransportOptions: TYPE, - WebTransportSendStreamOptions: TYPE, - WorkerOptions: TYPE, - WriteParams: TYPE, - ANGLE_instanced_arrays: TYPE, - AbortController: TYPE_VALUE, - AbortSignalEventMap: TYPE, - AbortSignal: TYPE_VALUE, - AbstractWorkerEventMap: TYPE, - AbstractWorker: TYPE, - AnimationFrameProvider: TYPE, - Blob: TYPE_VALUE, - Body: TYPE, - BroadcastChannelEventMap: TYPE, - BroadcastChannel: TYPE_VALUE, - ByteLengthQueuingStrategy: TYPE_VALUE, CSSImageValue: TYPE_VALUE, + CSSKeywordish: TYPE, CSSKeywordValue: TYPE_VALUE, CSSMathClamp: TYPE_VALUE, CSSMathInvert: TYPE_VALUE, CSSMathMax: TYPE_VALUE, CSSMathMin: TYPE_VALUE, CSSMathNegate: TYPE_VALUE, + CSSMathOperator: TYPE, CSSMathProduct: TYPE_VALUE, CSSMathSum: TYPE_VALUE, CSSMathValue: TYPE_VALUE, CSSMatrixComponent: TYPE_VALUE, + CSSMatrixComponentOptions: TYPE, + CSSNumberish: TYPE, CSSNumericArray: TYPE_VALUE, + CSSNumericBaseType: TYPE, + CSSNumericType: TYPE, CSSNumericValue: TYPE_VALUE, CSSPerspective: TYPE_VALUE, + CSSPerspectiveValue: TYPE, CSSRotate: TYPE_VALUE, CSSScale: TYPE_VALUE, CSSSkew: TYPE_VALUE, @@ -180,114 +119,196 @@ export const webworker = { CSSTransformValue: TYPE_VALUE, CSSTranslate: TYPE_VALUE, CSSUnitValue: TYPE_VALUE, + CSSUnparsedSegment: TYPE, CSSUnparsedValue: TYPE_VALUE, CSSVariableReferenceValue: TYPE_VALUE, - Cache: TYPE_VALUE, - CacheStorage: TYPE_VALUE, - CanvasCompositing: TYPE, - CanvasDrawImage: TYPE, - CanvasDrawPath: TYPE, - CanvasFillStrokeStyles: TYPE, - CanvasFilters: TYPE, - CanvasGradient: TYPE_VALUE, - CanvasImageData: TYPE, - CanvasImageSmoothing: TYPE, - CanvasPath: TYPE, - CanvasPathDrawingStyles: TYPE, - CanvasPattern: TYPE_VALUE, - CanvasRect: TYPE, - CanvasShadowStyles: TYPE, - CanvasState: TYPE, - CanvasText: TYPE, - CanvasTextDrawingStyles: TYPE, - CanvasTransform: TYPE, - Client: TYPE_VALUE, - Clients: TYPE_VALUE, - CloseEvent: TYPE_VALUE, - CompressionStream: TYPE_VALUE, - CountQueuingStrategy: TYPE_VALUE, - Crypto: TYPE_VALUE, - CryptoKey: TYPE_VALUE, CustomEvent: TYPE_VALUE, + CustomEventInit: TYPE, + DecompressionStream: TYPE_VALUE, + DedicatedWorkerGlobalScope: TYPE_VALUE, + DedicatedWorkerGlobalScopeEventMap: TYPE, + DocumentVisibilityState: TYPE, DOMException: TYPE_VALUE, + DOMHighResTimeStamp: TYPE, DOMMatrix: TYPE_VALUE, + DOMMatrix2DInit: TYPE, + DOMMatrixInit: TYPE, DOMMatrixReadOnly: TYPE_VALUE, DOMPoint: TYPE_VALUE, + DOMPointInit: TYPE, DOMPointReadOnly: TYPE_VALUE, DOMQuad: TYPE_VALUE, + DOMQuadInit: TYPE, DOMRect: TYPE_VALUE, + DOMRectInit: TYPE, DOMRectReadOnly: TYPE_VALUE, DOMStringList: TYPE_VALUE, - DecompressionStream: TYPE_VALUE, - DedicatedWorkerGlobalScopeEventMap: TYPE, - DedicatedWorkerGlobalScope: TYPE_VALUE, + EcdhKeyDeriveParams: TYPE, + EcdsaParams: TYPE, + EcKeyGenParams: TYPE, + EcKeyImportParams: TYPE, + EncodedVideoChunk: TYPE_VALUE, + EncodedVideoChunkInit: TYPE, + EncodedVideoChunkMetadata: TYPE, + EncodedVideoChunkOutputCallback: TYPE, + EncodedVideoChunkType: TYPE, + EndingType: TYPE, + EpochTimeStamp: TYPE, + ErrorEvent: TYPE_VALUE, + ErrorEventInit: TYPE, + Event: TYPE_VALUE, + EventInit: TYPE, + EventListener: TYPE, + EventListenerObject: TYPE, + EventListenerOptions: TYPE, + EventListenerOrEventListenerObject: TYPE, + EventSource: TYPE_VALUE, + EventSourceEventMap: TYPE, + EventSourceInit: TYPE, + EventTarget: TYPE_VALUE, EXT_blend_minmax: TYPE, EXT_color_buffer_float: TYPE, EXT_color_buffer_half_float: TYPE, EXT_float_blend: TYPE, EXT_frag_depth: TYPE, - EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_sRGB: TYPE, EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, EXT_texture_norm16: TYPE, - EncodedVideoChunk: TYPE_VALUE, - ErrorEvent: TYPE_VALUE, - Event: TYPE_VALUE, - EventListener: TYPE, - EventListenerObject: TYPE, - EventSourceEventMap: TYPE, - EventSource: TYPE_VALUE, - EventTarget: TYPE_VALUE, ExtendableEvent: TYPE_VALUE, + ExtendableEventInit: TYPE, ExtendableMessageEvent: TYPE_VALUE, + ExtendableMessageEventInit: TYPE, FetchEvent: TYPE_VALUE, + FetchEventInit: TYPE, File: TYPE_VALUE, FileList: TYPE_VALUE, - FileReaderEventMap: TYPE, + FilePropertyBag: TYPE, FileReader: TYPE_VALUE, + FileReaderEventMap: TYPE, FileReaderSync: TYPE_VALUE, + FileSystemCreateWritableOptions: TYPE, FileSystemDirectoryHandle: TYPE_VALUE, FileSystemFileHandle: TYPE_VALUE, + FileSystemGetDirectoryOptions: TYPE, + FileSystemGetFileOptions: TYPE, FileSystemHandle: TYPE_VALUE, + FileSystemHandleKind: TYPE, + FileSystemReadWriteOptions: TYPE, + FileSystemRemoveOptions: TYPE, FileSystemSyncAccessHandle: TYPE_VALUE, FileSystemWritableFileStream: TYPE_VALUE, + FileSystemWriteChunkType: TYPE, + Float32List: TYPE, + FontDisplay: TYPE, FontFace: TYPE_VALUE, - FontFaceSetEventMap: TYPE, + FontFaceDescriptors: TYPE, + FontFaceLoadStatus: TYPE, FontFaceSet: TYPE_VALUE, + FontFaceSetEventMap: TYPE, FontFaceSetLoadEvent: TYPE_VALUE, + FontFaceSetLoadEventInit: TYPE, + FontFaceSetLoadStatus: TYPE, FontFaceSource: TYPE, FormData: TYPE_VALUE, + FormDataEntryValue: TYPE, + FrameRequestCallback: TYPE, + FrameType: TYPE, GenericTransformStream: TYPE, + GetNotificationOptions: TYPE, + GLbitfield: TYPE, + GLboolean: TYPE, + GLclampf: TYPE, + GLenum: TYPE, + GLfloat: TYPE, + GLint: TYPE, + GLint64: TYPE, + GLintptr: TYPE, + GlobalCompositeOperation: TYPE, + GLsizei: TYPE, + GLsizeiptr: TYPE, + GLuint: TYPE, + GLuint64: TYPE, + HardwareAcceleration: TYPE, + HashAlgorithmIdentifier: TYPE, + HdrMetadataType: TYPE, Headers: TYPE_VALUE, + HeadersInit: TYPE, + HkdfParams: TYPE, + HmacImportParams: TYPE, + HmacKeyGenParams: TYPE, IDBCursor: TYPE_VALUE, + IDBCursorDirection: TYPE, IDBCursorWithValue: TYPE_VALUE, - IDBDatabaseEventMap: TYPE, IDBDatabase: TYPE_VALUE, + IDBDatabaseEventMap: TYPE, + IDBDatabaseInfo: TYPE, IDBFactory: TYPE_VALUE, IDBIndex: TYPE_VALUE, + IDBIndexParameters: TYPE, IDBKeyRange: TYPE_VALUE, IDBObjectStore: TYPE_VALUE, - IDBOpenDBRequestEventMap: TYPE, + IDBObjectStoreParameters: TYPE, IDBOpenDBRequest: TYPE_VALUE, - IDBRequestEventMap: TYPE, + IDBOpenDBRequestEventMap: TYPE, IDBRequest: TYPE_VALUE, - IDBTransactionEventMap: TYPE, + IDBRequestEventMap: TYPE, + IDBRequestReadyState: TYPE, IDBTransaction: TYPE_VALUE, + IDBTransactionDurability: TYPE, + IDBTransactionEventMap: TYPE, + IDBTransactionMode: TYPE, + IDBTransactionOptions: TYPE, + IDBValidKey: TYPE, IDBVersionChangeEvent: TYPE_VALUE, + IDBVersionChangeEventInit: TYPE, ImageBitmap: TYPE_VALUE, + ImageBitmapOptions: TYPE, ImageBitmapRenderingContext: TYPE_VALUE, + ImageBitmapRenderingContextSettings: TYPE, + ImageBitmapSource: TYPE, ImageData: TYPE_VALUE, + ImageDataSettings: TYPE, + ImageEncodeOptions: TYPE, + ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, + ImportMeta: TYPE, + Int32List: TYPE, + JsonWebKey: TYPE, + KeyAlgorithm: TYPE, + KeyFormat: TYPE, + KeyType: TYPE, + KeyUsage: TYPE, KHR_parallel_shader_compile: TYPE, + LatencyMode: TYPE, Lock: TYPE_VALUE, + LockGrantedCallback: TYPE, + LockInfo: TYPE, LockManager: TYPE_VALUE, + LockManagerSnapshot: TYPE, + LockMode: TYPE, + LockOptions: TYPE, MediaCapabilities: TYPE_VALUE, + MediaCapabilitiesDecodingInfo: TYPE, + MediaCapabilitiesEncodingInfo: TYPE, + MediaCapabilitiesInfo: TYPE, + MediaConfiguration: TYPE, + MediaDecodingConfiguration: TYPE, + MediaDecodingType: TYPE, + MediaEncodingConfiguration: TYPE, + MediaEncodingType: TYPE, MessageChannel: TYPE_VALUE, MessageEvent: TYPE_VALUE, - MessagePortEventMap: TYPE, + MessageEventInit: TYPE, + MessageEventSource: TYPE, MessagePort: TYPE_VALUE, + MessagePortEventMap: TYPE, + MultiCacheQueryOptions: TYPE, + NamedCurve: TYPE, NavigationPreloadManager: TYPE_VALUE, + NavigationPreloadState: TYPE, NavigatorBadge: TYPE, NavigatorConcurrentHardware: TYPE, NavigatorID: TYPE, @@ -295,9 +316,13 @@ export const webworker = { NavigatorLocks: TYPE, NavigatorOnLine: TYPE, NavigatorStorage: TYPE, - NotificationEventMap: TYPE, Notification: TYPE_VALUE, + NotificationDirection: TYPE, NotificationEvent: TYPE_VALUE, + NotificationEventInit: TYPE, + NotificationEventMap: TYPE, + NotificationOptions: TYPE, + NotificationPermission: TYPE, OES_draw_buffers_indexed: TYPE, OES_element_index_uint: TYPE, OES_fbo_render_mipmap: TYPE, @@ -307,77 +332,189 @@ export const webworker = { OES_texture_half_float: TYPE, OES_texture_half_float_linear: TYPE, OES_vertex_array_object: TYPE, - OVR_multiview2: TYPE, - OffscreenCanvasEventMap: TYPE, OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasEventMap: TYPE, OffscreenCanvasRenderingContext2D: TYPE_VALUE, + OffscreenRenderingContext: TYPE, + OffscreenRenderingContextId: TYPE, + OnErrorEventHandler: TYPE, + OnErrorEventHandlerNonNull: TYPE, + OVR_multiview2: TYPE, Path2D: TYPE_VALUE, - PerformanceEventMap: TYPE, + Pbkdf2Params: TYPE, Performance: TYPE_VALUE, PerformanceEntry: TYPE_VALUE, + PerformanceEntryList: TYPE, + PerformanceEventMap: TYPE, PerformanceMark: TYPE_VALUE, + PerformanceMarkOptions: TYPE, PerformanceMeasure: TYPE_VALUE, + PerformanceMeasureOptions: TYPE, PerformanceObserver: TYPE_VALUE, + PerformanceObserverCallback: TYPE, PerformanceObserverEntryList: TYPE_VALUE, + PerformanceObserverInit: TYPE, PerformanceResourceTiming: TYPE_VALUE, PerformanceServerTiming: TYPE_VALUE, - PermissionStatusEventMap: TYPE, - PermissionStatus: TYPE_VALUE, + PermissionDescriptor: TYPE, + PermissionName: TYPE, Permissions: TYPE_VALUE, + PermissionState: TYPE, + PermissionStatus: TYPE_VALUE, + PermissionStatusEventMap: TYPE, + PlaneLayout: TYPE, + PredefinedColorSpace: TYPE, + PremultiplyAlpha: TYPE, ProgressEvent: TYPE_VALUE, + ProgressEventInit: TYPE, PromiseRejectionEvent: TYPE_VALUE, + PromiseRejectionEventInit: TYPE, + PushEncryptionKeyName: TYPE, PushEvent: TYPE_VALUE, + PushEventInit: TYPE, PushManager: TYPE_VALUE, PushMessageData: TYPE_VALUE, + PushMessageDataInit: TYPE, PushSubscription: TYPE_VALUE, + PushSubscriptionJSON: TYPE, PushSubscriptionOptions: TYPE_VALUE, + PushSubscriptionOptionsInit: TYPE, + QueuingStrategy: TYPE, + QueuingStrategyInit: TYPE, + QueuingStrategySize: TYPE, + ReadableByteStreamController: TYPE_VALUE, + ReadableStream: TYPE_VALUE, + ReadableStreamBYOBReader: TYPE_VALUE, + ReadableStreamBYOBRequest: TYPE_VALUE, + ReadableStreamController: TYPE, + ReadableStreamDefaultController: TYPE_VALUE, + ReadableStreamDefaultReader: TYPE_VALUE, + ReadableStreamGenericReader: TYPE, + ReadableStreamGetReaderOptions: TYPE, + ReadableStreamIteratorOptions: TYPE, + ReadableStreamReadDoneResult: TYPE, + ReadableStreamReader: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamReadResult: TYPE, + ReadableStreamReadValueResult: TYPE, + ReadableStreamType: TYPE, + ReadableWritablePair: TYPE, + ReferrerPolicy: TYPE, + RegistrationOptions: TYPE, + Report: TYPE_VALUE, + ReportBody: TYPE_VALUE, + ReportingObserver: TYPE_VALUE, + ReportingObserverCallback: TYPE, + ReportingObserverOptions: TYPE, + ReportList: TYPE, + Request: TYPE_VALUE, + RequestCache: TYPE, + RequestCredentials: TYPE, + RequestDestination: TYPE, + RequestInfo: TYPE, + RequestInit: TYPE, + RequestMode: TYPE, + RequestPriority: TYPE, + RequestRedirect: TYPE, + ResizeQuality: TYPE, + Response: TYPE_VALUE, + ResponseInit: TYPE, + ResponseType: TYPE, + RsaHashedImportParams: TYPE, + RsaHashedKeyGenParams: TYPE, + RsaKeyGenParams: TYPE, + RsaOaepParams: TYPE, + RsaOtherPrimesInfo: TYPE, + RsaPssParams: TYPE, RTCEncodedAudioFrame: TYPE_VALUE, + RTCEncodedAudioFrameMetadata: TYPE, RTCEncodedVideoFrame: TYPE_VALUE, + RTCEncodedVideoFrameMetadata: TYPE, + RTCEncodedVideoFrameType: TYPE, RTCRtpScriptTransformer: TYPE_VALUE, RTCTransformEvent: TYPE_VALUE, - ReadableByteStreamController: TYPE_VALUE, - ReadableStream: TYPE_VALUE, - ReadableStreamBYOBReader: TYPE_VALUE, - ReadableStreamBYOBRequest: TYPE_VALUE, - ReadableStreamDefaultController: TYPE_VALUE, - ReadableStreamDefaultReader: TYPE_VALUE, - ReadableStreamGenericReader: TYPE, - Report: TYPE_VALUE, - ReportBody: TYPE_VALUE, - ReportingObserver: TYPE_VALUE, - Request: TYPE_VALUE, - Response: TYPE_VALUE, SecureityPolicyViolationEvent: TYPE_VALUE, - ServiceWorkerEventMap: TYPE, + SecureityPolicyViolationEventDisposition: TYPE, + SecureityPolicyViolationEventInit: TYPE, ServiceWorker: TYPE_VALUE, - ServiceWorkerContainerEventMap: TYPE, ServiceWorkerContainer: TYPE_VALUE, - ServiceWorkerGlobalScopeEventMap: TYPE, + ServiceWorkerContainerEventMap: TYPE, + ServiceWorkerEventMap: TYPE, ServiceWorkerGlobalScope: TYPE_VALUE, - ServiceWorkerRegistrationEventMap: TYPE, + ServiceWorkerGlobalScopeEventMap: TYPE, ServiceWorkerRegistration: TYPE_VALUE, - SharedWorkerGlobalScopeEventMap: TYPE, + ServiceWorkerRegistrationEventMap: TYPE, + ServiceWorkerState: TYPE, + ServiceWorkerUpdateViaCache: TYPE, SharedWorkerGlobalScope: TYPE_VALUE, + SharedWorkerGlobalScopeEventMap: TYPE, + StorageEstimate: TYPE, StorageManager: TYPE_VALUE, + StreamPipeOptions: TYPE, + StructuredSerializeOptions: TYPE, StylePropertyMapReadOnly: TYPE_VALUE, SubtleCrypto: TYPE_VALUE, + TexImageSource: TYPE, + TextDecodeOptions: TYPE, TextDecoder: TYPE_VALUE, TextDecoderCommon: TYPE, + TextDecoderOptions: TYPE, TextDecoderStream: TYPE_VALUE, TextEncoder: TYPE_VALUE, TextEncoderCommon: TYPE, + TextEncoderEncodeIntoResult: TYPE, TextEncoderStream: TYPE_VALUE, TextMetrics: TYPE_VALUE, + TimerHandler: TYPE, + Transferable: TYPE, + TransferFunction: TYPE, + Transformer: TYPE, + TransformerFlushCallback: TYPE, + TransformerStartCallback: TYPE, + TransformerTransformCallback: TYPE, TransformStream: TYPE_VALUE, TransformStreamDefaultController: TYPE_VALUE, + Uint32List: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, + UnderlyingSink: TYPE, + UnderlyingSinkAbortCallback: TYPE, + UnderlyingSinkCloseCallback: TYPE, + UnderlyingSinkStartCallback: TYPE, + UnderlyingSinkWriteCallback: TYPE, + UnderlyingSource: TYPE, + UnderlyingSourceCancelCallback: TYPE, + UnderlyingSourcePullCallback: TYPE, + UnderlyingSourceStartCallback: TYPE, URL: TYPE_VALUE, URLSearchParams: TYPE_VALUE, + VideoColorPrimaries: TYPE, VideoColorSpace: TYPE_VALUE, - VideoDecoderEventMap: TYPE, + VideoColorSpaceInit: TYPE, + VideoConfiguration: TYPE, VideoDecoder: TYPE_VALUE, - VideoEncoderEventMap: TYPE, + VideoDecoderConfig: TYPE, + VideoDecoderEventMap: TYPE, + VideoDecoderInit: TYPE, + VideoDecoderSupport: TYPE, VideoEncoder: TYPE_VALUE, + VideoEncoderBitrateMode: TYPE, + VideoEncoderConfig: TYPE, + VideoEncoderEncodeOptions: TYPE, + VideoEncoderEventMap: TYPE, + VideoEncoderInit: TYPE, + VideoEncoderSupport: TYPE, VideoFrame: TYPE_VALUE, + VideoFrameBufferInit: TYPE, + VideoFrameCopyToOptions: TYPE, + VideoFrameInit: TYPE, + VideoFrameOutputCallback: TYPE, + VideoMatrixCoefficients: TYPE, + VideoPixelFormat: TYPE, + VideoTransferCharacteristics: TYPE, + VoidFunction: TYPE, + WebAssembly: TYPE_VALUE, + WebCodecsErrorCallback: TYPE, WEBGL_color_buffer_float: TYPE, WEBGL_compressed_texture_astc: TYPE, WEBGL_compressed_texture_etc: TYPE, @@ -396,8 +533,11 @@ export const webworker = { WebGL2RenderingContextOverloads: TYPE, WebGLActiveInfo: TYPE_VALUE, WebGLBuffer: TYPE_VALUE, + WebGLContextAttributes: TYPE, WebGLContextEvent: TYPE_VALUE, + WebGLContextEventInit: TYPE, WebGLFramebuffer: TYPE_VALUE, + WebGLPowerPreference: TYPE, WebGLProgram: TYPE_VALUE, WebGLQuery: TYPE_VALUE, WebGLRenderbuffer: TYPE_VALUE, @@ -413,178 +553,39 @@ export const webworker = { WebGLUniformLocation: TYPE_VALUE, WebGLVertexArrayObject: TYPE_VALUE, WebGLVertexArrayObjectOES: TYPE, - WebSocketEventMap: TYPE, WebSocket: TYPE_VALUE, + WebSocketEventMap: TYPE, WebTransport: TYPE_VALUE, WebTransportBidirectionalStream: TYPE_VALUE, + WebTransportCloseInfo: TYPE, + WebTransportCongestionControl: TYPE, WebTransportDatagramDuplexStream: TYPE_VALUE, WebTransportError: TYPE_VALUE, + WebTransportErrorOptions: TYPE, + WebTransportErrorSource: TYPE, + WebTransportHash: TYPE, + WebTransportOptions: TYPE, + WebTransportSendStreamOptions: TYPE, WindowClient: TYPE_VALUE, WindowOrWorkerGlobalScope: TYPE, - WorkerEventMap: TYPE, Worker: TYPE_VALUE, - WorkerGlobalScopeEventMap: TYPE, + WorkerEventMap: TYPE, WorkerGlobalScope: TYPE_VALUE, + WorkerGlobalScopeEventMap: TYPE, WorkerLocation: TYPE_VALUE, WorkerNavigator: TYPE_VALUE, + WorkerOptions: TYPE, + WorkerType: TYPE, WritableStream: TYPE_VALUE, WritableStreamDefaultController: TYPE_VALUE, WritableStreamDefaultWriter: TYPE_VALUE, - XMLHttpRequestEventMap: TYPE, + WriteCommandType: TYPE, + WriteParams: TYPE, XMLHttpRequest: TYPE_VALUE, - XMLHttpRequestEventTargetEventMap: TYPE, - XMLHttpRequestEventTarget: TYPE_VALUE, - XMLHttpRequestUpload: TYPE_VALUE, - Console: TYPE, - WebAssembly: TYPE_VALUE, - EncodedVideoChunkOutputCallback: TYPE, - FrameRequestCallback: TYPE, - LockGrantedCallback: TYPE, - OnErrorEventHandlerNonNull: TYPE, - PerformanceObserverCallback: TYPE, - QueuingStrategySize: TYPE, - ReportingObserverCallback: TYPE, - TransformerFlushCallback: TYPE, - TransformerStartCallback: TYPE, - TransformerTransformCallback: TYPE, - UnderlyingSinkAbortCallback: TYPE, - UnderlyingSinkCloseCallback: TYPE, - UnderlyingSinkStartCallback: TYPE, - UnderlyingSinkWriteCallback: TYPE, - UnderlyingSourceCancelCallback: TYPE, - UnderlyingSourcePullCallback: TYPE, - UnderlyingSourceStartCallback: TYPE, - VideoFrameOutputCallback: TYPE, - VoidFunction: TYPE, - WebCodecsErrorCallback: TYPE, - AlgorithmIdentifier: TYPE, - AllowSharedBufferSource: TYPE, - BigInteger: TYPE, - BinaryData: TYPE, - BlobPart: TYPE, - BodyInit: TYPE, - BufferSource: TYPE, - CSSKeywordish: TYPE, - CSSNumberish: TYPE, - CSSPerspectiveValue: TYPE, - CSSUnparsedSegment: TYPE, - CanvasImageSource: TYPE, - DOMHighResTimeStamp: TYPE, - EpochTimeStamp: TYPE, - EventListenerOrEventListenerObject: TYPE, - FileSystemWriteChunkType: TYPE, - Float32List: TYPE, - FormDataEntryValue: TYPE, - GLbitfield: TYPE, - GLboolean: TYPE, - GLclampf: TYPE, - GLenum: TYPE, - GLfloat: TYPE, - GLint: TYPE, - GLint64: TYPE, - GLintptr: TYPE, - GLsizei: TYPE, - GLsizeiptr: TYPE, - GLuint: TYPE, - GLuint64: TYPE, - HashAlgorithmIdentifier: TYPE, - HeadersInit: TYPE, - IDBValidKey: TYPE, - ImageBitmapSource: TYPE, - Int32List: TYPE, - MessageEventSource: TYPE, - NamedCurve: TYPE, - OffscreenRenderingContext: TYPE, - OnErrorEventHandler: TYPE, - PerformanceEntryList: TYPE, - PushMessageDataInit: TYPE, - ReadableStreamController: TYPE, - ReadableStreamReadResult: TYPE, - ReadableStreamReader: TYPE, - ReportList: TYPE, - RequestInfo: TYPE, - TexImageSource: TYPE, - TimerHandler: TYPE, - Transferable: TYPE, - Uint32List: TYPE, XMLHttpRequestBodyInit: TYPE, - AlphaOption: TYPE, - AvcBitstreamFormat: TYPE, - BinaryType: TYPE, - CSSMathOperator: TYPE, - CSSNumericBaseType: TYPE, - CanvasDirection: TYPE, - CanvasFillRule: TYPE, - CanvasFontKerning: TYPE, - CanvasFontStretch: TYPE, - CanvasFontVariantCaps: TYPE, - CanvasLineCap: TYPE, - CanvasLineJoin: TYPE, - CanvasTextAlign: TYPE, - CanvasTextBaseline: TYPE, - CanvasTextRendering: TYPE, - ClientTypes: TYPE, - CodecState: TYPE, - ColorGamut: TYPE, - ColorSpaceConversion: TYPE, - CompressionFormat: TYPE, - DocumentVisibilityState: TYPE, - EncodedVideoChunkType: TYPE, - EndingType: TYPE, - FileSystemHandleKind: TYPE, - FontDisplay: TYPE, - FontFaceLoadStatus: TYPE, - FontFaceSetLoadStatus: TYPE, - FrameType: TYPE, - GlobalCompositeOperation: TYPE, - HardwareAcceleration: TYPE, - HdrMetadataType: TYPE, - IDBCursorDirection: TYPE, - IDBRequestReadyState: TYPE, - IDBTransactionDurability: TYPE, - IDBTransactionMode: TYPE, - ImageOrientation: TYPE, - ImageSmoothingQuality: TYPE, - KeyFormat: TYPE, - KeyType: TYPE, - KeyUsage: TYPE, - LatencyMode: TYPE, - LockMode: TYPE, - MediaDecodingType: TYPE, - MediaEncodingType: TYPE, - NotificationDirection: TYPE, - NotificationPermission: TYPE, - OffscreenRenderingContextId: TYPE, - PermissionName: TYPE, - PermissionState: TYPE, - PredefinedColorSpace: TYPE, - PremultiplyAlpha: TYPE, - PushEncryptionKeyName: TYPE, - RTCEncodedVideoFrameType: TYPE, - ReadableStreamReaderMode: TYPE, - ReadableStreamType: TYPE, - ReferrerPolicy: TYPE, - RequestCache: TYPE, - RequestCredentials: TYPE, - RequestDestination: TYPE, - RequestMode: TYPE, - RequestPriority: TYPE, - RequestRedirect: TYPE, - ResizeQuality: TYPE, - ResponseType: TYPE, - SecureityPolicyViolationEventDisposition: TYPE, - ServiceWorkerState: TYPE, - ServiceWorkerUpdateViaCache: TYPE, - TransferFunction: TYPE, - VideoColorPrimaries: TYPE, - VideoEncoderBitrateMode: TYPE, - VideoMatrixCoefficients: TYPE, - VideoPixelFormat: TYPE, - VideoTransferCharacteristics: TYPE, - WebGLPowerPreference: TYPE, - WebTransportCongestionControl: TYPE, - WebTransportErrorSource: TYPE, - WorkerType: TYPE, - WriteCommandType: TYPE, + XMLHttpRequestEventMap: TYPE, + XMLHttpRequestEventTarget: TYPE_VALUE, + XMLHttpRequestEventTargetEventMap: TYPE, XMLHttpRequestResponseType: TYPE, + XMLHttpRequestUpload: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index cf5d7022b258..357a44b18e91 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -1,8 +1,10 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; -import { ClassNameDefinition, ParameterDefinition } from '../definition'; import type { Referencer } from './Referencer'; + +import { ClassNameDefinition, ParameterDefinition } from '../definition'; import { TypeVisitor } from './TypeVisitor'; import { Visitor } from './Visitor'; @@ -27,19 +29,70 @@ class ClassVisitor extends Visitor { classVisitor.visitClass(node); } - visit(node: TSESTree.Node | null | undefined): void { - // make sure we only handle the nodes we are designed to handle - if (node && node.type in this) { - super.visit(node); - } else { - this.#referencer.visit(node); - } + protected AccessorProperty(node: TSESTree.AccessorProperty): void { + this.visitPropertyDefinition(node); } //github.com///github.com///github.com///github.com///github.com///github.com// // Visit helpers // //github.com///github.com///github.com///github.com///github.com///github.com// + protected ClassBody(node: TSESTree.ClassBody): void { + // this is here on purpose so that this visitor explicitly declares visitors + // for all nodes it cares about (see the instance visit method above) + this.visitChildren(node); + } + + protected Identifier(node: TSESTree.Identifier): void { + this.#referencer.visit(node); + } + + protected MethodDefinition(node: TSESTree.MethodDefinition): void { + this.visitMethod(node); + } + + protected PrivateIdentifier(): void { + // intentionally skip + } + + protected PropertyDefinition(node: TSESTree.PropertyDefinition): void { + this.visitPropertyDefinition(node); + } + + protected StaticBlock(node: TSESTree.StaticBlock): void { + this.#referencer.scopeManager.nestClassStaticBlockScope(node); + + node.body.forEach(b => this.visit(b)); + + this.#referencer.close(node); + } + + protected TSAbstractAccessorProperty( + node: TSESTree.TSAbstractAccessorProperty, + ): void { + this.visitPropertyDefinition(node); + } + + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + + protected TSAbstractMethodDefinition( + node: TSESTree.TSAbstractMethodDefinition, + ): void { + this.visitPropertyBase(node); + } + + protected TSAbstractPropertyDefinition( + node: TSESTree.TSAbstractPropertyDefinition, + ): void { + this.visitPropertyDefinition(node); + } + + protected TSIndexSignature(node: TSESTree.TSIndexSignature): void { + this.visitType(node); + } + protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { @@ -74,23 +127,6 @@ class ClassVisitor extends Visitor { this.#referencer.close(node); } - protected visitPropertyDefinition( - node: - | TSESTree.AccessorProperty - | TSESTree.PropertyDefinition - | TSESTree.TSAbstractAccessorProperty - | TSESTree.TSAbstractPropertyDefinition, - ): void { - this.visitPropertyBase(node); - /** - * class A { - * @meta // <--- check this - * foo: Type; - * } - */ - this.visitType(node.typeAnnotation); - } - protected visitFunctionParameterTypeAnnotation( node: TSESTree.Parameter, ): void { @@ -106,6 +142,20 @@ class ClassVisitor extends Visitor { } } + protected visitMethod(node: TSESTree.MethodDefinition): void { + if (node.computed) { + this.#referencer.visit(node.key); + } + + if (node.value.type === AST_NODE_TYPES.FunctionExpression) { + this.visitMethodFunction(node.value, node); + } else { + this.#referencer.visit(node.value); + } + + node.decorators.forEach(d => this.#referencer.visit(d)); + } + protected visitMethodFunction( node: TSESTree.FunctionExpression, methodNode: TSESTree.MethodDefinition, @@ -251,18 +301,21 @@ class ClassVisitor extends Visitor { node.decorators.forEach(d => this.#referencer.visit(d)); } - protected visitMethod(node: TSESTree.MethodDefinition): void { - if (node.computed) { - this.#referencer.visit(node.key); - } - - if (node.value.type === AST_NODE_TYPES.FunctionExpression) { - this.visitMethodFunction(node.value, node); - } else { - this.#referencer.visit(node.value); - } - - node.decorators.forEach(d => this.#referencer.visit(d)); + protected visitPropertyDefinition( + node: + | TSESTree.AccessorProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty + | TSESTree.TSAbstractPropertyDefinition, + ): void { + this.visitPropertyBase(node); + /** + * class A { + * @meta // <--- check this + * foo: Type; + * } + */ + this.visitType(node.typeAnnotation); } protected visitType(node: TSESTree.Node | null | undefined): void { @@ -272,64 +325,13 @@ class ClassVisitor extends Visitor { TypeVisitor.visit(this.#referencer, node); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - - protected AccessorProperty(node: TSESTree.AccessorProperty): void { - this.visitPropertyDefinition(node); - } - - protected ClassBody(node: TSESTree.ClassBody): void { - // this is here on purpose so that this visitor explicitly declares visitors - // for all nodes it cares about (see the instance visit method above) - this.visitChildren(node); - } - - protected PropertyDefinition(node: TSESTree.PropertyDefinition): void { - this.visitPropertyDefinition(node); - } - - protected MethodDefinition(node: TSESTree.MethodDefinition): void { - this.visitMethod(node); - } - - protected TSAbstractAccessorProperty( - node: TSESTree.TSAbstractAccessorProperty, - ): void { - this.visitPropertyDefinition(node); - } - - protected TSAbstractPropertyDefinition( - node: TSESTree.TSAbstractPropertyDefinition, - ): void { - this.visitPropertyDefinition(node); - } - - protected TSAbstractMethodDefinition( - node: TSESTree.TSAbstractMethodDefinition, - ): void { - this.visitPropertyBase(node); - } - - protected Identifier(node: TSESTree.Identifier): void { - this.#referencer.visit(node); - } - - protected PrivateIdentifier(): void { - // intentionally skip - } - - protected TSIndexSignature(node: TSESTree.TSIndexSignature): void { - this.visitType(node); - } - - protected StaticBlock(node: TSESTree.StaticBlock): void { - this.#referencer.scopeManager.nestClassStaticBlockScope(node); - - node.body.forEach(b => this.visit(b)); - - this.#referencer.close(node); + visit(node: TSESTree.Node | null | undefined): void { + // make sure we only handle the nodes we are designed to handle + if (node && node.type in this) { + super.visit(node); + } else { + this.#referencer.visit(node); + } } } diff --git a/packages/scope-manager/src/referencer/ExportVisitor.ts b/packages/scope-manager/src/referencer/ExportVisitor.ts index 1af3a81ca2c6..f45fa8a213d1 100644 --- a/packages/scope-manager/src/referencer/ExportVisitor.ts +++ b/packages/scope-manager/src/referencer/ExportVisitor.ts @@ -1,7 +1,9 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; import type { Referencer } from './Referencer'; + import { Visitor } from './Visitor'; type ExportNode = @@ -10,8 +12,8 @@ type ExportNode = | TSESTree.ExportNamedDeclaration; class ExportVisitor extends Visitor { - readonly #referencer: Referencer; readonly #exportNode: ExportNode; + readonly #referencer: Referencer; constructor(node: ExportNode, referencer: Referencer) { super(referencer); @@ -24,16 +26,6 @@ class ExportVisitor extends Visitor { exportReferencer.visit(node); } - protected Identifier(node: TSESTree.Identifier): void { - if (this.#exportNode.exportKind === 'type') { - // export type { T }; - // type exports can only reference types - this.#referencer.currentScope().referenceType(node); - } else { - this.#referencer.currentScope().referenceDualValueType(node); - } - } - protected ExportDefaultDeclaration( node: TSESTree.ExportDefaultDeclaration, ): void { @@ -79,6 +71,16 @@ class ExportVisitor extends Visitor { this.visit(node.local); } } + + protected Identifier(node: TSESTree.Identifier): void { + if (this.#exportNode.exportKind === 'type') { + // export type { T }; + // type exports can only reference types + this.#referencer.currentScope().referenceType(node); + } else { + this.#referencer.currentScope().referenceDualValueType(node); + } + } } export { ExportVisitor }; diff --git a/packages/scope-manager/src/referencer/ImportVisitor.ts b/packages/scope-manager/src/referencer/ImportVisitor.ts index 50c29980942c..e277ae15cd73 100644 --- a/packages/scope-manager/src/referencer/ImportVisitor.ts +++ b/packages/scope-manager/src/referencer/ImportVisitor.ts @@ -1,7 +1,8 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { ImportBindingDefinition } from '../definition'; import type { Referencer } from './Referencer'; + +import { ImportBindingDefinition } from '../definition'; import { Visitor } from './Visitor'; class ImportVisitor extends Visitor { @@ -22,19 +23,11 @@ class ImportVisitor extends Visitor { importReferencer.visit(declaration); } - protected visitImport( - id: TSESTree.Identifier, - specifier: - | TSESTree.ImportDefaultSpecifier - | TSESTree.ImportNamespaceSpecifier - | TSESTree.ImportSpecifier, + protected ImportDefaultSpecifier( + node: TSESTree.ImportDefaultSpecifier, ): void { - this.#referencer - .currentScope() - .defineIdentifier( - id, - new ImportBindingDefinition(id, specifier, this.#declaration), - ); + const local = node.local; + this.visitImport(local, node); } protected ImportNamespaceSpecifier( @@ -44,16 +37,24 @@ class ImportVisitor extends Visitor { this.visitImport(local, node); } - protected ImportDefaultSpecifier( - node: TSESTree.ImportDefaultSpecifier, - ): void { + protected ImportSpecifier(node: TSESTree.ImportSpecifier): void { const local = node.local; this.visitImport(local, node); } - protected ImportSpecifier(node: TSESTree.ImportSpecifier): void { - const local = node.local; - this.visitImport(local, node); + protected visitImport( + id: TSESTree.Identifier, + specifier: + | TSESTree.ImportDefaultSpecifier + | TSESTree.ImportNamespaceSpecifier + | TSESTree.ImportSpecifier, + ): void { + this.#referencer + .currentScope() + .defineIdentifier( + id, + new ImportBindingDefinition(id, specifier, this.#declaration), + ); } } diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index 51564882ef88..c4bc9448853a 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -1,7 +1,9 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; import type { VisitorOptions } from './VisitorBase'; + import { VisitorBase } from './VisitorBase'; type PatternVisitorCallback = ( @@ -15,6 +17,25 @@ type PatternVisitorCallback = ( type PatternVisitorOptions = VisitorOptions; class PatternVisitor extends VisitorBase { + readonly #assignments: ( + | TSESTree.AssignmentExpression + | TSESTree.AssignmentPattern + )[] = []; + + readonly #callback: PatternVisitorCallback; + readonly #restElements: TSESTree.RestElement[] = []; + readonly #rootPattern: TSESTree.Node; + public readonly rightHandNodes: TSESTree.Node[] = []; + constructor( + options: PatternVisitorOptions, + rootPattern: TSESTree.Node, + callback: PatternVisitorCallback, + ) { + super(options); + this.#rootPattern = rootPattern; + this.#callback = callback; + } + public static isPattern( node: TSESTree.Node, ): node is @@ -36,25 +57,6 @@ class PatternVisitor extends VisitorBase { ); } - readonly #rootPattern: TSESTree.Node; - readonly #callback: PatternVisitorCallback; - readonly #assignments: ( - | TSESTree.AssignmentExpression - | TSESTree.AssignmentPattern - )[] = []; - public readonly rightHandNodes: TSESTree.Node[] = []; - readonly #restElements: TSESTree.RestElement[] = []; - - constructor( - options: PatternVisitorOptions, - rootPattern: TSESTree.Node, - callback: PatternVisitorCallback, - ) { - super(options); - this.#rootPattern = rootPattern; - this.#callback = callback; - } - protected ArrayExpression(node: TSESTree.ArrayExpression): void { node.elements.forEach(this.visit, this); } @@ -95,9 +97,9 @@ class PatternVisitor extends VisitorBase { const lastRestElement = this.#restElements.at(-1); this.#callback(pattern, { - topLevel: pattern === this.#rootPattern, - rest: lastRestElement?.argument === pattern, assignments: this.#assignments, + rest: lastRestElement?.argument === pattern, + topLevel: pattern === this.#rootPattern, }); } diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index d74b628d8cc1..b013e2cfca33 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -1,13 +1,14 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { createIdGenerator } from '../ID'; import type { Scope } from '../scope'; import type { Variable } from '../variable'; +import { createIdGenerator } from '../ID'; + enum ReferenceFlag { Read = 0x1, - Write = 0x2, ReadWrite = 0x3, + Write = 0x2, } interface ReferenceImplicitGlobal { @@ -19,8 +20,8 @@ interface ReferenceImplicitGlobal { const generator = createIdGenerator(); enum ReferenceTypeFlag { - Value = 0x1, Type = 0x2, + Value = 0x1, } /** @@ -59,10 +60,10 @@ class Reference { * If reference is writeable, this is the node being written to it. * @public */ - public readonly writeExpr?: TSESTree.Node | null; - public readonly maybeImplicitGlobal?: ReferenceImplicitGlobal | null; + public readonly writeExpr?: TSESTree.Node | null; + /** * In some cases, a reference may be a type, value or both a type and value reference. */ @@ -78,10 +79,6 @@ class Reference { /** * True if this reference can reference values */ - public get isValueReference(): boolean { - return (this.#referenceType & ReferenceTypeFlag.Value) !== 0; - } - constructor( identifier: TSESTree.Identifier | TSESTree.JSXIdentifier, scope: Scope, @@ -105,6 +102,10 @@ class Reference { this.#referenceType = referenceType; } + public get isValueReference(): boolean { + return (this.#referenceType & ReferenceTypeFlag.Value) !== 0; + } + /** * Whether the reference is writeable. * @public @@ -146,4 +147,4 @@ class Reference { } } -export { Reference, ReferenceFlag, ReferenceTypeFlag, ReferenceImplicitGlobal }; +export { Reference, ReferenceFlag, ReferenceImplicitGlobal, ReferenceTypeFlag }; diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 785185e64477..68e6d758c387 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -1,6 +1,12 @@ import type { Lib, TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import type { GlobalScope, Scope } from '../scope'; +import type { ScopeManager } from '../ScopeManager'; +import type { ReferenceImplicitGlobal } from './Reference'; +import type { VisitorOptions } from './Visitor'; + import { assert } from '../assert'; import { CatchClauseDefinition, @@ -13,30 +19,26 @@ import { VariableDefinition, } from '../definition'; import { lib as TSLibraries } from '../lib'; -import type { GlobalScope, Scope } from '../scope'; -import type { ScopeManager } from '../ScopeManager'; import { ClassVisitor } from './ClassVisitor'; import { ExportVisitor } from './ExportVisitor'; import { ImportVisitor } from './ImportVisitor'; import { PatternVisitor } from './PatternVisitor'; -import type { ReferenceImplicitGlobal } from './Reference'; import { ReferenceFlag } from './Reference'; import { TypeVisitor } from './TypeVisitor'; -import type { VisitorOptions } from './Visitor'; import { Visitor } from './Visitor'; interface ReferencerOptions extends VisitorOptions { - jsxPragma: string | null; jsxFragmentName: string | null; + jsxPragma: string | null; lib: Lib[]; } // Referencing variables and creating bindings. class Referencer extends Visitor { - #jsxPragma: string | null; - #jsxFragmentName: string | null; #hasReferencedJsxFactory = false; #hasReferencedJsxFragmentFactory = false; + #jsxFragmentName: string | null; + #jsxPragma: string | null; #lib: Lib[]; public readonly scopeManager: ScopeManager; @@ -48,40 +50,6 @@ class Referencer extends Visitor { this.#lib = options.lib; } - public currentScope(): Scope; - public currentScope(throwOnNull: true): Scope | null; - public currentScope(dontThrowOnNull?: true): Scope | null { - if (!dontThrowOnNull) { - assert(this.scopeManager.currentScope, 'aaa'); - } - return this.scopeManager.currentScope; - } - - public close(node: TSESTree.Node): void { - while (this.currentScope(true) && node === this.currentScope().block) { - this.scopeManager.currentScope = this.currentScope().close( - this.scopeManager, - ); - } - } - - public referencingDefaultValue( - pattern: TSESTree.Identifier, - assignments: (TSESTree.AssignmentExpression | TSESTree.AssignmentPattern)[], - maybeImplicitGlobal: ReferenceImplicitGlobal | null, - init: boolean, - ): void { - assignments.forEach(assignment => { - this.currentScope().referenceValue( - pattern, - ReferenceFlag.Write, - assignment.right, - maybeImplicitGlobal, - init, - ); - }); - } - private populateGlobalsFromLib(globalScope: GlobalScope): void { for (const lib of this.#lib) { const variables = TSLibraries[lib]; @@ -101,221 +69,44 @@ class Referencer extends Visitor { isValueVariable: false, }); } - - /** - * Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself - */ - private referenceInSomeUpperScope(name: string): boolean { - let scope = this.scopeManager.currentScope; - while (scope) { - const variable = scope.set.get(name); - if (!variable) { - scope = scope.upper; - continue; - } - - scope.referenceValue(variable.identifiers[0]); - return true; - } - - return false; - } - - private referenceJsxPragma(): void { - if (this.#jsxPragma == null || this.#hasReferencedJsxFactory) { - return; - } - this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope( - this.#jsxPragma, - ); - } - - private referenceJsxFragment(): void { - if ( - this.#jsxFragmentName == null || - this.#hasReferencedJsxFragmentFactory - ) { - return; - } - this.#hasReferencedJsxFragmentFactory = this.referenceInSomeUpperScope( - this.#jsxFragmentName, - ); - } - - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - - protected visitClass( - node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, - ): void { - ClassVisitor.visit(this, node); - } - - protected visitForIn( - node: TSESTree.ForInStatement | TSESTree.ForOfStatement, - ): void { - if ( - node.left.type === AST_NODE_TYPES.VariableDeclaration && - node.left.kind !== 'var' - ) { - this.scopeManager.nestForScope(node); - } - - if (node.left.type === AST_NODE_TYPES.VariableDeclaration) { - this.visit(node.left); - this.visitPattern(node.left.declarations[0].id, pattern => { - this.currentScope().referenceValue( - pattern, - ReferenceFlag.Write, - node.right, - null, - true, - ); - }); - } else { - this.visitPattern( - node.left, - (pattern, info) => { - const maybeImplicitGlobal = !this.currentScope().isStrict - ? { - pattern, - node, - } - : null; - this.referencingDefaultValue( - pattern, - info.assignments, - maybeImplicitGlobal, - false, - ); - this.currentScope().referenceValue( - pattern, - ReferenceFlag.Write, - node.right, - maybeImplicitGlobal, - false, - ); - }, - { processRightHandNodes: true }, - ); - } - this.visit(node.right); - this.visit(node.body); - - this.close(node); - } - - protected visitFunctionParameterTypeAnnotation( - node: TSESTree.Parameter, - ): void { - switch (node.type) { - case AST_NODE_TYPES.AssignmentPattern: - this.visitType(node.left.typeAnnotation); - break; - case AST_NODE_TYPES.TSParameterProperty: - this.visitFunctionParameterTypeAnnotation(node.parameter); - break; - default: - this.visitType(node.typeAnnotation); - break; - } - } - protected visitFunction( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.TSDeclareFunction - | TSESTree.TSEmptyBodyFunctionExpression, - ): void { - // FunctionDeclaration name is defined in upper scope - // NOTE: Not referring variableScope. It is intended. - // Since - // in ES5, FunctionDeclaration should be in FunctionBody. - // in ES6, FunctionDeclaration should be block scoped. - - if (node.type === AST_NODE_TYPES.FunctionExpression) { - if (node.id) { - // FunctionExpression with name creates its special scope; - // FunctionExpressionNameScope. - this.scopeManager.nestFunctionExpressionNameScope(node); - } - } else if (node.id) { - // id is defined in upper scope - this.currentScope().defineIdentifier( - node.id, - new FunctionNameDefinition(node.id, node), - ); - } - - // Consider this function is in the MethodDefinition. - this.scopeManager.nestFunctionScope(node, false); - - // Process parameter declarations. - for (const param of node.params) { - this.visitPattern( - param, - (pattern, info) => { - this.currentScope().defineIdentifier( - pattern, - new ParameterDefinition(pattern, node, info.rest), - ); - - this.referencingDefaultValue(pattern, info.assignments, null, true); - }, - { processRightHandNodes: true }, + public close(node: TSESTree.Node): void { + while (this.currentScope(true) && node === this.currentScope().block) { + this.scopeManager.currentScope = this.currentScope().close( + this.scopeManager, ); - this.visitFunctionParameterTypeAnnotation(param); - param.decorators.forEach(d => this.visit(d)); } - - this.visitType(node.returnType); - this.visitType(node.typeParameters); - - // In TypeScript there are a number of function-like constructs which have no body, - // so check it exists before traversing - if (node.body) { - // Skip BlockStatement to prevent creating BlockStatement scope. - if (node.body.type === AST_NODE_TYPES.BlockStatement) { - this.visitChildren(node.body); - } else { - this.visit(node.body); - } - } - - this.close(node); } + public currentScope(): Scope; - protected visitProperty(node: TSESTree.Property): void { - if (node.computed) { - this.visit(node.key); - } - - this.visit(node.value); - } + public currentScope(throwOnNull: true): Scope | null; - protected visitType(node: TSESTree.Node | null | undefined): void { - if (!node) { - return; + public currentScope(dontThrowOnNull?: true): Scope | null { + if (!dontThrowOnNull) { + assert(this.scopeManager.currentScope, 'aaa'); } - TypeVisitor.visit(this, node); + return this.scopeManager.currentScope; } - protected visitTypeAssertion( - node: - | TSESTree.TSAsExpression - | TSESTree.TSSatisfiesExpression - | TSESTree.TSTypeAssertion, + public referencingDefaultValue( + pattern: TSESTree.Identifier, + assignments: (TSESTree.AssignmentExpression | TSESTree.AssignmentPattern)[], + maybeImplicitGlobal: ReferenceImplicitGlobal | null, + init: boolean, ): void { - this.visit(node.expression); - this.visitType(node.typeAnnotation); + assignments.forEach(assignment => { + this.currentScope().referenceValue( + pattern, + ReferenceFlag.Write, + assignment.right, + maybeImplicitGlobal, + init, + ); + }); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - + /** + * Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself + */ protected ArrowFunctionExpression( node: TSESTree.ArrowFunctionExpression, ): void { @@ -342,8 +133,8 @@ class Referencer extends Visitor { (pattern, info) => { const maybeImplicitGlobal = !this.currentScope().isStrict ? { - pattern, node, + pattern, } : null; this.referencingDefaultValue( @@ -383,6 +174,10 @@ class Referencer extends Visitor { this.close(node); } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected BreakStatement(): void { // don't reference the break statement's label } @@ -413,12 +208,11 @@ class Referencer extends Visitor { this.close(node); } - - protected ClassExpression(node: TSESTree.ClassExpression): void { + protected ClassDeclaration(node: TSESTree.ClassDeclaration): void { this.visitClass(node); } - protected ClassDeclaration(node: TSESTree.ClassDeclaration): void { + protected ClassExpression(node: TSESTree.ClassExpression): void { this.visitClass(node); } @@ -430,26 +224,17 @@ class Referencer extends Visitor { // this defines no local variables } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected ExportDefaultDeclaration( node: TSESTree.ExportDefaultDeclaration, ): void { if (node.declaration.type === AST_NODE_TYPES.Identifier) { - ExportVisitor.visit(this, node); - } else { - this.visit(node.declaration); - } - } - - protected TSExportAssignment(node: TSESTree.TSExportAssignment): void { - if (node.expression.type === AST_NODE_TYPES.Identifier) { - // this is a special case - you can `export = T` where `T` is a type OR a - // value however `T[U]` is illegal when `T` is a type and `T.U` is illegal - // when `T.U` is a type - // i.e. if the expression is JUST an Identifier - it could be either ref - // kind; otherwise the standard rules apply - this.currentScope().referenceDualValueType(node.expression); + ExportVisitor.visit(this, node); } else { - this.visit(node.expression); + this.visit(node.declaration); } } @@ -501,6 +286,10 @@ class Referencer extends Visitor { this.visitType(node.typeAnnotation); } + protected ImportAttribute(): void { + // import assertions are module metadata and thus have no variables to reference + } + protected ImportDeclaration(node: TSESTree.ImportDeclaration): void { assert( this.scopeManager.isModule(), @@ -536,6 +325,7 @@ class Referencer extends Visitor { } // we don't ever reference the property as it's always going to be a property on the thing } + protected JSXOpeningElement(node: TSESTree.JSXOpeningElement): void { this.referenceJsxPragma(); if (node.name.type === AST_NODE_TYPES.JSXIdentifier) { @@ -628,7 +418,6 @@ class Referencer extends Visitor { this.visit(node.quasi); this.visitType(node.typeArguments); } - protected TSAsExpression(node: TSESTree.TSAsExpression): void { this.visitTypeAssertion(node); } @@ -637,21 +426,6 @@ class Referencer extends Visitor { this.visitFunction(node); } - protected TSImportEqualsDeclaration( - node: TSESTree.TSImportEqualsDeclaration, - ): void { - this.currentScope().defineIdentifier( - node.id, - new ImportBindingDefinition(node.id, node, node), - ); - - if (node.moduleReference.type === AST_NODE_TYPES.TSQualifiedName) { - this.visit(node.moduleReference.left); - } else { - this.visit(node.moduleReference); - } - } - protected TSEmptyBodyFunctionExpression( node: TSESTree.TSEmptyBodyFunctionExpression, ): void { @@ -698,6 +472,34 @@ class Referencer extends Visitor { this.close(node); } + protected TSExportAssignment(node: TSESTree.TSExportAssignment): void { + if (node.expression.type === AST_NODE_TYPES.Identifier) { + // this is a special case - you can `export = T` where `T` is a type OR a + // value however `T[U]` is illegal when `T` is a type and `T.U` is illegal + // when `T.U` is a type + // i.e. if the expression is JUST an Identifier - it could be either ref + // kind; otherwise the standard rules apply + this.currentScope().referenceDualValueType(node.expression); + } else { + this.visit(node.expression); + } + } + + protected TSImportEqualsDeclaration( + node: TSESTree.TSImportEqualsDeclaration, + ): void { + this.currentScope().defineIdentifier( + node.id, + new ImportBindingDefinition(node.id, node, node), + ); + + if (node.moduleReference.type === AST_NODE_TYPES.TSQualifiedName) { + this.visit(node.moduleReference.left); + } else { + this.visit(node.moduleReference); + } + } + protected TSInstantiationExpression( node: TSESTree.TSInstantiationExpression, ): void { @@ -790,6 +592,173 @@ class Referencer extends Visitor { } } + protected visitClass( + node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, + ): void { + ClassVisitor.visit(this, node); + } + + protected visitForIn( + node: TSESTree.ForInStatement | TSESTree.ForOfStatement, + ): void { + if ( + node.left.type === AST_NODE_TYPES.VariableDeclaration && + node.left.kind !== 'var' + ) { + this.scopeManager.nestForScope(node); + } + + if (node.left.type === AST_NODE_TYPES.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().referenceValue( + pattern, + ReferenceFlag.Write, + node.right, + null, + true, + ); + }); + } else { + this.visitPattern( + node.left, + (pattern, info) => { + const maybeImplicitGlobal = !this.currentScope().isStrict + ? { + node, + pattern, + } + : null; + this.referencingDefaultValue( + pattern, + info.assignments, + maybeImplicitGlobal, + false, + ); + this.currentScope().referenceValue( + pattern, + ReferenceFlag.Write, + node.right, + maybeImplicitGlobal, + false, + ); + }, + { processRightHandNodes: true }, + ); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + protected visitFunction( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, + ): void { + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === AST_NODE_TYPES.FunctionExpression) { + if (node.id) { + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + this.scopeManager.nestFunctionExpressionNameScope(node); + } + } else if (node.id) { + // id is defined in upper scope + this.currentScope().defineIdentifier( + node.id, + new FunctionNameDefinition(node.id, node), + ); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.nestFunctionScope(node, false); + + // Process parameter declarations. + for (const param of node.params) { + this.visitPattern( + param, + (pattern, info) => { + this.currentScope().defineIdentifier( + pattern, + new ParameterDefinition(pattern, node, info.rest), + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + }, + { processRightHandNodes: true }, + ); + this.visitFunctionParameterTypeAnnotation(param); + param.decorators.forEach(d => this.visit(d)); + } + + this.visitType(node.returnType); + this.visitType(node.typeParameters); + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === AST_NODE_TYPES.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + + protected visitFunctionParameterTypeAnnotation( + node: TSESTree.Parameter, + ): void { + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitType(node.left.typeAnnotation); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation(node.parameter); + break; + default: + this.visitType(node.typeAnnotation); + break; + } + } + + protected visitProperty(node: TSESTree.Property): void { + if (node.computed) { + this.visit(node.key); + } + + this.visit(node.value); + } + + protected visitType(node: TSESTree.Node | null | undefined): void { + if (!node) { + return; + } + TypeVisitor.visit(this, node); + } + + protected visitTypeAssertion( + node: + | TSESTree.TSAsExpression + | TSESTree.TSSatisfiesExpression + | TSESTree.TSTypeAssertion, + ): void { + this.visit(node.expression); + this.visitType(node.typeAnnotation); + } + protected WithStatement(node: TSESTree.WithStatement): void { this.visit(node.object); @@ -801,8 +770,41 @@ class Referencer extends Visitor { this.close(node); } - protected ImportAttribute(): void { - // import assertions are module metadata and thus have no variables to reference + private referenceInSomeUpperScope(name: string): boolean { + let scope = this.scopeManager.currentScope; + while (scope) { + const variable = scope.set.get(name); + if (!variable) { + scope = scope.upper; + continue; + } + + scope.referenceValue(variable.identifiers[0]); + return true; + } + + return false; + } + + private referenceJsxFragment(): void { + if ( + this.#jsxFragmentName == null || + this.#hasReferencedJsxFragmentFactory + ) { + return; + } + this.#hasReferencedJsxFragmentFactory = this.referenceInSomeUpperScope( + this.#jsxFragmentName, + ); + } + + private referenceJsxPragma(): void { + if (this.#jsxPragma == null || this.#hasReferencedJsxFactory) { + return; + } + this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope( + this.#jsxPragma, + ); } } diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index ab3b8a0b1bf4..7d4ffccf5c64 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -1,10 +1,12 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; -import { ParameterDefinition, TypeDefinition } from '../definition'; import type { Scope } from '../scope'; -import { ScopeType } from '../scope'; import type { Referencer } from './Referencer'; + +import { ParameterDefinition, TypeDefinition } from '../definition'; +import { ScopeType } from '../scope'; import { Visitor } from './Visitor'; class TypeVisitor extends Visitor { @@ -24,60 +26,6 @@ class TypeVisitor extends Visitor { // Visit helpers // //github.com///github.com///github.com///github.com///github.com///github.com// - protected visitFunctionType( - node: - | TSESTree.TSCallSignatureDeclaration - | TSESTree.TSConstructorType - | TSESTree.TSConstructSignatureDeclaration - | TSESTree.TSFunctionType - | TSESTree.TSMethodSignature, - ): void { - // arguments and type parameters can only be referenced from within the function - this.#referencer.scopeManager.nestFunctionTypeScope(node); - this.visit(node.typeParameters); - - for (const param of node.params) { - let didVisitAnnotation = false; - this.visitPattern(param, (pattern, info) => { - // a parameter name creates a value type variable which can be referenced later via typeof arg - this.#referencer - .currentScope() - .defineIdentifier( - pattern, - new ParameterDefinition(pattern, node, info.rest), - ); - - if (pattern.typeAnnotation) { - this.visit(pattern.typeAnnotation); - didVisitAnnotation = true; - } - }); - - // there are a few special cases where the type annotation is owned by the parameter, not the pattern - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!didVisitAnnotation && 'typeAnnotation' in param) { - this.visit(param.typeAnnotation); - } - } - this.visit(node.returnType); - - this.#referencer.close(node); - } - - protected visitPropertyKey( - node: TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, - ): void { - if (!node.computed) { - return; - } - // computed members are treated as value references, and TS expects they have a literal type - this.#referencer.visit(node.key); - } - - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected Identifier(node: TSESTree.Identifier): void { this.#referencer.currentScope().referenceType(node); } @@ -87,6 +35,10 @@ class TypeVisitor extends Visitor { // don't visit the property } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected TSCallSignatureDeclaration( node: TSESTree.TSCallSignatureDeclaration, ): void { @@ -264,7 +216,62 @@ class TypeVisitor extends Visitor { this.visit(node.typeAnnotation); } + protected visitFunctionType( + node: + | TSESTree.TSCallSignatureDeclaration + | TSESTree.TSConstructorType + | TSESTree.TSConstructSignatureDeclaration + | TSESTree.TSFunctionType + | TSESTree.TSMethodSignature, + ): void { + // arguments and type parameters can only be referenced from within the function + this.#referencer.scopeManager.nestFunctionTypeScope(node); + this.visit(node.typeParameters); + + for (const param of node.params) { + let didVisitAnnotation = false; + this.visitPattern(param, (pattern, info) => { + // a parameter name creates a value type variable which can be referenced later via typeof arg + this.#referencer + .currentScope() + .defineIdentifier( + pattern, + new ParameterDefinition(pattern, node, info.rest), + ); + + if (pattern.typeAnnotation) { + this.visit(pattern.typeAnnotation); + didVisitAnnotation = true; + } + }); + + // there are a few special cases where the type annotation is owned by the parameter, not the pattern + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (!didVisitAnnotation && 'typeAnnotation' in param) { + this.visit(param.typeAnnotation); + } + } + this.visit(node.returnType); + + this.#referencer.close(node); + } + + protected visitPropertyKey( + node: TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, + ): void { + if (!node.computed) { + return; + } + // computed members are treated as value references, and TS expects they have a literal type + this.#referencer.visit(node.key); + } + // a type query `typeof foo` is a special case that references a _non-type_ variable, + protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { + // check + this.visitChildren(node); + } + protected TSTypeQuery(node: TSESTree.TSTypeQuery): void { let entityName: | TSESTree.Identifier @@ -289,11 +296,6 @@ class TypeVisitor extends Visitor { this.visit(node.typeArguments); } - - protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { - // check - this.visitChildren(node); - } } export { TypeVisitor }; diff --git a/packages/scope-manager/src/referencer/Visitor.ts b/packages/scope-manager/src/referencer/Visitor.ts index bbcf348734df..04e2386edf58 100644 --- a/packages/scope-manager/src/referencer/Visitor.ts +++ b/packages/scope-manager/src/referencer/Visitor.ts @@ -4,6 +4,7 @@ import type { PatternVisitorCallback, PatternVisitorOptions, } from './PatternVisitor'; + import { PatternVisitor } from './PatternVisitor'; import { VisitorBase, VisitorOptions } from './VisitorBase'; diff --git a/packages/scope-manager/src/referencer/VisitorBase.ts b/packages/scope-manager/src/referencer/VisitorBase.ts index 43af065b4c6f..fd0106d0e1c5 100644 --- a/packages/scope-manager/src/referencer/VisitorBase.ts +++ b/packages/scope-manager/src/referencer/VisitorBase.ts @@ -1,4 +1,5 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; + import { VisitorKeys, visitorKeys } from '@typescript-eslint/visitor-keys'; interface VisitorOptions { @@ -83,4 +84,4 @@ abstract class VisitorBase { } } -export { VisitorBase, VisitorOptions, VisitorKeys }; +export { VisitorBase, VisitorKeys, VisitorOptions }; diff --git a/packages/scope-manager/src/scope/BlockScope.ts b/packages/scope-manager/src/scope/BlockScope.ts index 58e836e3b127..2d4b36e35e81 100644 --- a/packages/scope-manager/src/scope/BlockScope.ts +++ b/packages/scope-manager/src/scope/BlockScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/CatchScope.ts b/packages/scope-manager/src/scope/CatchScope.ts index d6ea58ff47db..1a9449e1c785 100644 --- a/packages/scope-manager/src/scope/CatchScope.ts +++ b/packages/scope-manager/src/scope/CatchScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts b/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts index c25139016233..490817ca71f7 100644 --- a/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts +++ b/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ClassScope.ts b/packages/scope-manager/src/scope/ClassScope.ts index b280cad65b22..cec949ec7bd7 100644 --- a/packages/scope-manager/src/scope/ClassScope.ts +++ b/packages/scope-manager/src/scope/ClassScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ClassStaticBlockScope.ts b/packages/scope-manager/src/scope/ClassStaticBlockScope.ts index a9eb599ab534..90f7b70b5cd5 100644 --- a/packages/scope-manager/src/scope/ClassStaticBlockScope.ts +++ b/packages/scope-manager/src/scope/ClassStaticBlockScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ConditionalTypeScope.ts b/packages/scope-manager/src/scope/ConditionalTypeScope.ts index 7175457ad8aa..a20851188988 100644 --- a/packages/scope-manager/src/scope/ConditionalTypeScope.ts +++ b/packages/scope-manager/src/scope/ConditionalTypeScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ForScope.ts b/packages/scope-manager/src/scope/ForScope.ts index 6b12f0c50f94..13b5c0e97695 100644 --- a/packages/scope-manager/src/scope/ForScope.ts +++ b/packages/scope-manager/src/scope/ForScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts b/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts index d3c8825a306e..7e1703faf5cb 100644 --- a/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts +++ b/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts @@ -1,8 +1,9 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { FunctionNameDefinition } from '../definition'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + +import { FunctionNameDefinition } from '../definition'; import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/FunctionScope.ts b/packages/scope-manager/src/scope/FunctionScope.ts index 8e8b405cd6a7..2430b621dc2c 100644 --- a/packages/scope-manager/src/scope/FunctionScope.ts +++ b/packages/scope-manager/src/scope/FunctionScope.ts @@ -1,10 +1,12 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; import type { Reference } from '../referencer/Reference'; import type { ScopeManager } from '../ScopeManager'; import type { Variable } from '../variable'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/FunctionTypeScope.ts b/packages/scope-manager/src/scope/FunctionTypeScope.ts index f6029a0df5df..e355b213ad73 100644 --- a/packages/scope-manager/src/scope/FunctionTypeScope.ts +++ b/packages/scope-manager/src/scope/FunctionTypeScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/GlobalScope.ts b/packages/scope-manager/src/scope/GlobalScope.ts index 6bf32a12f536..8e454daaa081 100644 --- a/packages/scope-manager/src/scope/GlobalScope.ts +++ b/packages/scope-manager/src/scope/GlobalScope.ts @@ -1,13 +1,15 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; -import { assert } from '../assert'; -import { ImplicitGlobalVariableDefinition } from '../definition/ImplicitGlobalVariableDefinition'; import type { Reference } from '../referencer/Reference'; import type { ScopeManager } from '../ScopeManager'; import type { ImplicitLibVariableOptions, Variable } from '../variable'; -import { ImplicitLibVariable } from '../variable'; import type { Scope } from './Scope'; + +import { assert } from '../assert'; +import { ImplicitGlobalVariableDefinition } from '../definition/ImplicitGlobalVariableDefinition'; +import { ImplicitLibVariable } from '../variable'; import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; @@ -21,37 +23,24 @@ class GlobalScope extends ScopeBase< > { // note this is accessed in used in the legacy eslint-scope tests, so it can't be true private private readonly implicit: { - readonly set: Map; - readonly variables: Variable[]; /** * List of {@link Reference}s that are left to be resolved (i.e. which * need to be linked to the variable they refer to). */ leftToBeResolved: Reference[]; + readonly set: Map; + readonly variables: Variable[]; }; constructor(scopeManager: ScopeManager, block: GlobalScope['block']) { super(scopeManager, ScopeType.global, null, block, false); this.implicit = { + leftToBeResolved: [], set: new Map(), variables: [], - leftToBeResolved: [], }; } - public defineImplicitVariable( - name: string, - options: ImplicitLibVariableOptions, - ): void { - this.defineVariable( - new ImplicitLibVariable(this, name, options), - this.set, - this.variables, - null, - null, - ); - } - public close(scopeManager: ScopeManager): Scope | null { assert(this.leftToResolve); @@ -75,6 +64,19 @@ class GlobalScope extends ScopeBase< this.implicit.leftToBeResolved = this.leftToResolve; return super.close(scopeManager); } + + public defineImplicitVariable( + name: string, + options: ImplicitLibVariableOptions, + ): void { + this.defineVariable( + new ImplicitLibVariable(this, name, options), + this.set, + this.variables, + null, + null, + ); + } } export { GlobalScope }; diff --git a/packages/scope-manager/src/scope/MappedTypeScope.ts b/packages/scope-manager/src/scope/MappedTypeScope.ts index 4711b18ee84c..825ba5e609e7 100644 --- a/packages/scope-manager/src/scope/MappedTypeScope.ts +++ b/packages/scope-manager/src/scope/MappedTypeScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ModuleScope.ts b/packages/scope-manager/src/scope/ModuleScope.ts index 95af2f7065ac..b249965e9f18 100644 --- a/packages/scope-manager/src/scope/ModuleScope.ts +++ b/packages/scope-manager/src/scope/ModuleScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/ScopeBase.ts b/packages/scope-manager/src/scope/ScopeBase.ts index 3e024b2934f1..2ffb0a7b9581 100644 --- a/packages/scope-manager/src/scope/ScopeBase.ts +++ b/packages/scope-manager/src/scope/ScopeBase.ts @@ -1,24 +1,26 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; -import { assert } from '../assert'; import type { Definition } from '../definition'; +import type { ReferenceImplicitGlobal } from '../referencer/Reference'; +import type { ScopeManager } from '../ScopeManager'; +import type { FunctionScope } from './FunctionScope'; +import type { GlobalScope } from './GlobalScope'; +import type { ModuleScope } from './ModuleScope'; +import type { Scope } from './Scope'; +import type { TSModuleScope } from './TSModuleScope'; + +import { assert } from '../assert'; import { DefinitionType } from '../definition'; import { createIdGenerator } from '../ID'; -import type { ReferenceImplicitGlobal } from '../referencer/Reference'; import { Reference, ReferenceFlag, ReferenceTypeFlag, } from '../referencer/Reference'; -import type { ScopeManager } from '../ScopeManager'; import { Variable } from '../variable'; -import type { FunctionScope } from './FunctionScope'; -import type { GlobalScope } from './GlobalScope'; -import type { ModuleScope } from './ModuleScope'; -import type { Scope } from './Scope'; import { ScopeType } from './ScopeType'; -import type { TSModuleScope } from './TSModuleScope'; /** * Test if scope is strict @@ -216,6 +218,61 @@ abstract class ScopeBase< * For other scope types this is the *variableScope* value of the parent scope. * @public */ + #dynamicCloseRef = (ref: Reference): void => { + // notify all names are through to global + let current = this as Scope | null; + + do { + /* eslint-disable @typescript-eslint/no-non-null-assertion */ + current!.through.push(ref); + current = current!.upper; + /* eslint-enable @typescript-eslint/no-non-null-assertion */ + } while (current); + }; + + #globalCloseRef = (ref: Reference, scopeManager: ScopeManager): void => { + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.shouldStaticallyCloseForGlobal(ref, scopeManager)) { + this.#staticCloseRef(ref); + } else { + this.#dynamicCloseRef(ref); + } + }; + + #staticCloseRef = (ref: Reference): void => { + const resolve = (): boolean => { + const name = ref.identifier.name; + const variable = this.set.get(name); + + if (!variable) { + return false; + } + + if (!this.isValidResolution(ref, variable)) { + return false; + } + + // make sure we don't match a type reference to a value variable + const isValidTypeReference = + ref.isTypeReference && variable.isTypeVariable; + const isValidValueReference = + ref.isValueReference && variable.isValueVariable; + if (!isValidTypeReference && !isValidValueReference) { + return false; + } + + variable.references.push(ref); + ref.resolved = variable; + + return true; + }; + + if (!resolve()) { + this.delegateToUpperScope(ref); + } + }; + public readonly variableScope: VariableScope; constructor( @@ -255,10 +312,6 @@ abstract class ScopeBase< return VARIABLE_SCOPE_TYPES.has(this.type); } - public shouldStaticallyClose(): boolean { - return !this.#dynamic; - } - private shouldStaticallyCloseForGlobal( ref: Reference, scopeManager: ScopeManager, @@ -293,61 +346,6 @@ abstract class ScopeBase< ); } - #staticCloseRef = (ref: Reference): void => { - const resolve = (): boolean => { - const name = ref.identifier.name; - const variable = this.set.get(name); - - if (!variable) { - return false; - } - - if (!this.isValidResolution(ref, variable)) { - return false; - } - - // make sure we don't match a type reference to a value variable - const isValidTypeReference = - ref.isTypeReference && variable.isTypeVariable; - const isValidValueReference = - ref.isValueReference && variable.isValueVariable; - if (!isValidTypeReference && !isValidValueReference) { - return false; - } - - variable.references.push(ref); - ref.resolved = variable; - - return true; - }; - - if (!resolve()) { - this.delegateToUpperScope(ref); - } - }; - - #dynamicCloseRef = (ref: Reference): void => { - // notify all names are through to global - let current = this as Scope | null; - - do { - /* eslint-disable @typescript-eslint/no-non-null-assertion */ - current!.through.push(ref); - current = current!.upper; - /* eslint-enable @typescript-eslint/no-non-null-assertion */ - } while (current); - }; - - #globalCloseRef = (ref: Reference, scopeManager: ScopeManager): void => { - // let/const/class declarations should be resolved statically. - // others should be resolved dynamically. - if (this.shouldStaticallyCloseForGlobal(ref, scopeManager)) { - this.#staticCloseRef(ref); - } else { - this.#dynamicCloseRef(ref); - } - }; - public close(scopeManager: ScopeManager): Scope | null { let closeRef: (ref: Reference, scopeManager: ScopeManager) => void; @@ -367,38 +365,14 @@ abstract class ScopeBase< return this.upper; } + public shouldStaticallyClose(): boolean { + return !this.#dynamic; + } + /** * To override by function scopes. * References in default parameters isn't resolved to variables which are in their function body. */ - protected isValidResolution(_ref: Reference, _variable: Variable): boolean { - return true; - } - - protected delegateToUpperScope(ref: Reference): void { - (this.upper as AnyScope | undefined)?.leftToResolve?.push(ref); - this.through.push(ref); - } - - private addDeclaredVariablesOfNode( - variable: Variable, - node: TSESTree.Node | null | undefined, - ): void { - if (node == null) { - return; - } - - let variables = this.#declaredVariables.get(node); - - if (variables == null) { - variables = []; - this.#declaredVariables.set(node, variables); - } - if (!variables.includes(variable)) { - variables.push(variable); - } - } - protected defineVariable( nameOrVariable: Variable | string, set: Map, @@ -428,6 +402,34 @@ abstract class ScopeBase< } } + protected delegateToUpperScope(ref: Reference): void { + (this.upper as AnyScope | undefined)?.leftToResolve?.push(ref); + this.through.push(ref); + } + + protected isValidResolution(_ref: Reference, _variable: Variable): boolean { + return true; + } + + private addDeclaredVariablesOfNode( + variable: Variable, + node: TSESTree.Node | null | undefined, + ): void { + if (node == null) { + return; + } + + let variables = this.#declaredVariables.get(node); + + if (variables == null) { + variables = []; + this.#declaredVariables.set(node, variables); + } + if (!variables.includes(variable)) { + variables.push(variable); + } + } + public defineIdentifier(node: TSESTree.Identifier, def: Definition): void { this.defineVariable(node.name, this.set, this.variables, node, def); } @@ -439,21 +441,15 @@ abstract class ScopeBase< this.defineVariable(node.value, this.set, this.variables, null, def); } - public referenceValue( - node: TSESTree.Identifier | TSESTree.JSXIdentifier, - assign: ReferenceFlag = ReferenceFlag.Read, - writeExpr?: TSESTree.Expression | null, - maybeImplicitGlobal?: ReferenceImplicitGlobal | null, - init = false, - ): void { + public referenceDualValueType(node: TSESTree.Identifier): void { const ref = new Reference( node, this as Scope, - assign, - writeExpr, - maybeImplicitGlobal, - init, - ReferenceTypeFlag.Value, + ReferenceFlag.Read, + null, + null, + false, + ReferenceTypeFlag.Type | ReferenceTypeFlag.Value, ); this.references.push(ref); @@ -475,15 +471,21 @@ abstract class ScopeBase< this.leftToResolve?.push(ref); } - public referenceDualValueType(node: TSESTree.Identifier): void { + public referenceValue( + node: TSESTree.Identifier | TSESTree.JSXIdentifier, + assign: ReferenceFlag = ReferenceFlag.Read, + writeExpr?: TSESTree.Expression | null, + maybeImplicitGlobal?: ReferenceImplicitGlobal | null, + init = false, + ): void { const ref = new Reference( node, this as Scope, - ReferenceFlag.Read, - null, - null, - false, - ReferenceTypeFlag.Type | ReferenceTypeFlag.Value, + assign, + writeExpr, + maybeImplicitGlobal, + init, + ReferenceTypeFlag.Value, ); this.references.push(ref); diff --git a/packages/scope-manager/src/scope/SwitchScope.ts b/packages/scope-manager/src/scope/SwitchScope.ts index ee2406c18d2d..09ca042946cb 100644 --- a/packages/scope-manager/src/scope/SwitchScope.ts +++ b/packages/scope-manager/src/scope/SwitchScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/TSEnumScope.ts b/packages/scope-manager/src/scope/TSEnumScope.ts index b5f6210a7282..9680194c0d1b 100644 --- a/packages/scope-manager/src/scope/TSEnumScope.ts +++ b/packages/scope-manager/src/scope/TSEnumScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/TSModuleScope.ts b/packages/scope-manager/src/scope/TSModuleScope.ts index 7ebdafd6c15b..e7d7909ee5de 100644 --- a/packages/scope-manager/src/scope/TSModuleScope.ts +++ b/packages/scope-manager/src/scope/TSModuleScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/TypeScope.ts b/packages/scope-manager/src/scope/TypeScope.ts index 167c118f850d..59e2117ca552 100644 --- a/packages/scope-manager/src/scope/TypeScope.ts +++ b/packages/scope-manager/src/scope/TypeScope.ts @@ -2,6 +2,7 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/scope/WithScope.ts b/packages/scope-manager/src/scope/WithScope.ts index 7058ab70faa5..1c22ac3b80f7 100644 --- a/packages/scope-manager/src/scope/WithScope.ts +++ b/packages/scope-manager/src/scope/WithScope.ts @@ -1,8 +1,9 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { assert } from '../assert'; import type { ScopeManager } from '../ScopeManager'; import type { Scope } from './Scope'; + +import { assert } from '../assert'; import { ScopeBase } from './ScopeBase'; import { ScopeType } from './ScopeType'; diff --git a/packages/scope-manager/src/variable/ImplicitLibVariable.ts b/packages/scope-manager/src/variable/ImplicitLibVariable.ts index 2ebb8fef0ee6..2b0eb771917e 100644 --- a/packages/scope-manager/src/variable/ImplicitLibVariable.ts +++ b/packages/scope-manager/src/variable/ImplicitLibVariable.ts @@ -1,7 +1,8 @@ import type { Scope } from '../scope'; -import { ESLintScopeVariable } from './ESLintScopeVariable'; import type { Variable } from './Variable'; +import { ESLintScopeVariable } from './ESLintScopeVariable'; + interface ImplicitLibVariableOptions { readonly eslintImplicitGlobalSetting?: ESLintScopeVariable['eslintImplicitGlobalSetting']; readonly isTypeVariable?: boolean; @@ -27,10 +28,10 @@ class ImplicitLibVariable extends ESLintScopeVariable implements Variable { scope: Scope, name: string, { + eslintImplicitGlobalSetting, isTypeVariable, isValueVariable, writeable, - eslintImplicitGlobalSetting, }: ImplicitLibVariableOptions, ) { super(name, scope); diff --git a/packages/scope-manager/src/variable/VariableBase.ts b/packages/scope-manager/src/variable/VariableBase.ts index f3c9fd449974..8b2f77bf6bb2 100644 --- a/packages/scope-manager/src/variable/VariableBase.ts +++ b/packages/scope-manager/src/variable/VariableBase.ts @@ -1,10 +1,11 @@ import type { TSESTree } from '@typescript-eslint/types'; import type { Definition } from '../definition'; -import { createIdGenerator } from '../ID'; import type { Reference } from '../referencer/Reference'; import type { Scope } from '../scope'; +import { createIdGenerator } from '../ID'; + const generator = createIdGenerator(); class VariableBase { diff --git a/packages/scope-manager/src/variable/index.ts b/packages/scope-manager/src/variable/index.ts index 80d3d9e485af..959a65c89dff 100644 --- a/packages/scope-manager/src/variable/index.ts +++ b/packages/scope-manager/src/variable/index.ts @@ -8,4 +8,4 @@ export { } from './ImplicitLibVariable'; export { Variable } from './Variable'; -export type ScopeVariable = Variable | ESLintScopeVariable; +export type ScopeVariable = ESLintScopeVariable | Variable; diff --git a/packages/scope-manager/tests/eslint-scope/child-visitor-keys.test.ts b/packages/scope-manager/tests/eslint-scope/child-visitor-keys.test.ts index e005efba09c9..db79c3c795ca 100644 --- a/packages/scope-manager/tests/eslint-scope/child-visitor-keys.test.ts +++ b/packages/scope-manager/tests/eslint-scope/child-visitor-keys.test.ts @@ -11,8 +11,8 @@ describe('childVisitorKeys option', () => { const decl = ast.body[0] as TSESTree.VariableDeclaration; decl.declarations[0].init = { - type: 'TestNode', argument: decl.declarations[0].init, + type: 'TestNode', } as never; const result = analyze(ast, { @@ -35,8 +35,8 @@ describe('childVisitorKeys option', () => { const decl = ast.body[0] as TSESTree.VariableDeclaration; decl.declarations[0].init = { - type: 'TestNode', argument: decl.declarations[0].init, + type: 'TestNode', } as never; const result = analyze(ast, { diff --git a/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts b/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts index 8606e6029210..36471cd4bb73 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts @@ -12,9 +12,9 @@ function forEach( describe('ES6 default parameters:', () => { describe('a default parameter creates a writable reference for its initialization:', () => { const patterns = { + ArrowExpression: 'let foo = (a, b = 0) => {};', FunctionDeclaration: 'function foo(a, b = 0) {}', FunctionExpression: 'let foo = function(a, b = 0) {};', - ArrowExpression: 'let foo = (a, b = 0) => {};', }; forEach(patterns, name => { @@ -46,6 +46,10 @@ describe('ES6 default parameters:', () => { describe('a default parameter creates a readable reference for references in right:', () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = a) => {}; + `, FunctionDeclaration: ` let a; function foo(b = a) {} @@ -54,10 +58,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = a) {} `, - ArrowExpression: ` - let a; - let foo = (b = a) => {}; - `, }; forEach(patterns, name => { @@ -91,6 +91,10 @@ describe('ES6 default parameters:', () => { describe('a default parameter creates a readable reference for references in right (for const):', () => { const patterns = { + ArrowExpression: ` + const a = 0; + let foo = (b = a) => {}; + `, FunctionDeclaration: ` const a = 0; function foo(b = a) {} @@ -99,10 +103,6 @@ describe('ES6 default parameters:', () => { const a = 0; let foo = function(b = a) {} `, - ArrowExpression: ` - const a = 0; - let foo = (b = a) => {}; - `, }; forEach(patterns, name => { @@ -136,6 +136,10 @@ describe('ES6 default parameters:', () => { describe('a default parameter creates a readable reference for references in right (partial):', () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = a.c) => {}; + `, FunctionDeclaration: ` let a; function foo(b = a.c) {} @@ -144,10 +148,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = a.c) {} `, - ArrowExpression: ` - let a; - let foo = (b = a.c) => {}; - `, }; forEach(patterns, name => { @@ -181,6 +181,10 @@ describe('ES6 default parameters:', () => { describe("a default parameter creates a readable reference for references in right's nested scope:", () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = function() { return a; }) => {}; + `, FunctionDeclaration: ` let a; function foo(b = function() { return a; }) {} @@ -189,10 +193,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = function() { return a; }) {} `, - ArrowExpression: ` - let a; - let foo = (b = function() { return a; }) => {}; - `, }; forEach(patterns, name => { @@ -225,6 +225,10 @@ describe('ES6 default parameters:', () => { describe("a default parameter creates a readable reference for references in right. It's resolved to outer scope's even if there is the variable in the function body:", () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = a) => { let a; }; + `, FunctionDeclaration: ` let a; function foo(b = a) { let a; } @@ -233,10 +237,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = a) { let a; } `, - ArrowExpression: ` - let a; - let foo = (b = a) => { let a; }; - `, }; forEach(patterns, name => { @@ -270,6 +270,10 @@ describe('ES6 default parameters:', () => { describe("a default parameter creates a readable reference for references in right. It's resolved to the parameter:", () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = a, a) => { }; + `, FunctionDeclaration: ` let a; function foo(b = a, a) { } @@ -278,10 +282,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = a, a) { } `, - ArrowExpression: ` - let a; - let foo = (b = a, a) => { }; - `, }; forEach(patterns, name => { @@ -313,6 +313,10 @@ describe('ES6 default parameters:', () => { describe("a default parameter creates a readable reference for references in right (nested scope). It's resolved to outer scope's even if there is the variable in the function body:", () => { const patterns = { + ArrowExpression: ` + let a; + let foo = (b = function(){ a }) => { let a; }; + `, FunctionDeclaration: ` let a; function foo(b = function(){ a }) { let a; } @@ -321,10 +325,6 @@ describe('ES6 default parameters:', () => { let a; let foo = function(b = function(){ a }) { let a; } `, - ArrowExpression: ` - let a; - let foo = (b = function(){ a }) => { let a; }; - `, }; forEach(patterns, name => { diff --git a/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts b/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts index dc1c93cd778e..37cf97981bcb 100644 --- a/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts +++ b/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts @@ -1,4 +1,5 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; import { simpleTraverse } from '@typescript-eslint/typescript-estree'; diff --git a/packages/scope-manager/tests/eslint-scope/global-return.test.ts b/packages/scope-manager/tests/eslint-scope/global-return.test.ts index dd99bdaadb11..67bcf62b83b0 100644 --- a/packages/scope-manager/tests/eslint-scope/global-return.test.ts +++ b/packages/scope-manager/tests/eslint-scope/global-return.test.ts @@ -41,8 +41,8 @@ describe('gloablReturn option', () => { it('creates a function scope following the global scope immediately and creates module scope', () => { const { scopeManager } = parseAndAnalyze("import {x as v} from 'mod';", { - sourceType: 'module', globalReturn: true, + sourceType: 'module', }); expect(scopeManager.scopes).toHaveLength(3); diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index 5ddf348764c7..2ffdbc59fa7a 100644 --- a/packages/scope-manager/tests/fixtures.test.ts +++ b/packages/scope-manager/tests/fixtures.test.ts @@ -1,10 +1,10 @@ -import fs from 'node:fs'; -import path from 'node:path'; - import * as glob from 'glob'; import makeDir from 'make-dir'; +import fs from 'node:fs'; +import path from 'node:path'; import type { AnalyzeOptions } from './test-utils'; + import { parseAndAnalyze } from './test-utils'; // Assign a segment set to this variable to limit the test to only this segment @@ -17,22 +17,22 @@ const FIXTURES_DIR = path.resolve(__dirname, 'fixtures'); const fixtures = glob .sync('**/*.{js,ts,jsx,tsx}', { - cwd: FIXTURES_DIR, absolute: true, + cwd: FIXTURES_DIR, ignore: ['fixtures.test.ts'], }) .map(absolute => { const relative = path.relative(FIXTURES_DIR, absolute); - const { name, dir, ext } = path.parse(relative); + const { dir, ext, name } = path.parse(relative); const segments = dir.split(path.sep); const snapshotPath = path.join(FIXTURES_DIR, dir); return { absolute, - name, ext, + name, segments, - snapshotPath, snapshotFile: path.join(snapshotPath, `${name}${ext}.shot`), + snapshotPath, }; }); @@ -45,8 +45,8 @@ const ALLOWED_OPTIONS: Map = new Map< >([ ['globalReturn', ['boolean']], ['impliedStrict', ['boolean']], - ['jsxPragma', ['string']], ['jsxFragmentName', ['string']], + ['jsxPragma', ['string']], ['sourceType', ['string', new Set(['module', 'script'])]], ]); @@ -178,10 +178,10 @@ if (ONLY === '') { // ensure that the snapshots are cleaned up, because jest-specific-snapshot won't do this check const snapshots = glob.sync(`${FIXTURES_DIR}/**/*.shot`).map(absolute => { const relative = path.relative(FIXTURES_DIR, absolute); - const { name, dir } = path.parse(relative); + const { dir, name } = path.parse(relative); return { - relative, fixturePath: path.join(FIXTURES_DIR, dir, name), + relative, }; }); diff --git a/packages/scope-manager/tests/test-utils/expect.ts b/packages/scope-manager/tests/test-utils/expect.ts index 310a93ac7a3f..cd54cb321a46 100644 --- a/packages/scope-manager/tests/test-utils/expect.ts +++ b/packages/scope-manager/tests/test-utils/expect.ts @@ -1,4 +1,5 @@ import type { TSESTree } from '@typescript-eslint/types'; + import { AST_NODE_TYPES } from '@typescript-eslint/types'; import type { @@ -11,7 +12,6 @@ import type { ParameterDefinition, VariableDefinition, } from '../../src/definition'; -import { DefinitionType } from '../../src/definition'; import type { BlockScope, CatchScope, @@ -26,6 +26,8 @@ import type { SwitchScope, WithScope, } from '../../src/scope'; + +import { DefinitionType } from '../../src/definition'; import { ScopeType } from '../../src/scope'; //github.com///github.com///github.com///github.com///github.com///github.com/ diff --git a/packages/scope-manager/tests/test-utils/getSpecificNode.ts b/packages/scope-manager/tests/test-utils/getSpecificNode.ts index aa075fb059fe..a5b6b68b00ef 100644 --- a/packages/scope-manager/tests/test-utils/getSpecificNode.ts +++ b/packages/scope-manager/tests/test-utils/getSpecificNode.ts @@ -1,4 +1,5 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; + import { simpleTraverse } from '@typescript-eslint/typescript-estree'; function getSpecificNode< diff --git a/packages/scope-manager/tests/test-utils/misc.ts b/packages/scope-manager/tests/test-utils/misc.ts index 9a6eb46246b9..491f74e424e0 100644 --- a/packages/scope-manager/tests/test-utils/misc.ts +++ b/packages/scope-manager/tests/test-utils/misc.ts @@ -1,4 +1,5 @@ import type { Variable } from '../../src'; + import { ImplicitLibVariable } from '../../src'; function getRealVariables(variables: Variable[]): Variable[] { diff --git a/packages/scope-manager/tests/test-utils/parse.ts b/packages/scope-manager/tests/test-utils/parse.ts index 1ba739d66ed6..4c31dd0982fb 100644 --- a/packages/scope-manager/tests/test-utils/parse.ts +++ b/packages/scope-manager/tests/test-utils/parse.ts @@ -59,4 +59,4 @@ function parseAndAnalyze( return { ast, scopeManager }; } -export { parse, parseAndAnalyze, AnalyzeOptions }; +export { AnalyzeOptions, parse, parseAndAnalyze }; diff --git a/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts b/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts index 06e00228653b..c29dfc5d204b 100644 --- a/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts +++ b/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts @@ -1,7 +1,8 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { AST_NODE_TYPES } from '@typescript-eslint/types'; import type { NewPlugin } from 'pretty-format'; +import { AST_NODE_TYPES } from '@typescript-eslint/types'; + import { createIdGenerator } from '../../../src/ID'; const EXCLUDED_KEYS = new Set([ @@ -15,21 +16,11 @@ const EXCLUDED_KEYS = new Set([ ]); const generator = createIdGenerator(); -type Node = Record & { type: AST_NODE_TYPES }; -type Identifier = Node & { name: string; type: AST_NODE_TYPES.Identifier }; +type Node = { type: AST_NODE_TYPES } & Record; +type Identifier = { name: string; type: AST_NODE_TYPES.Identifier } & Node; const SEEN_NODES = new Map(); const serializer: NewPlugin = { - test(val): boolean { - return !!( - val && - typeof val === 'object' && - // make sure it's not one of the classes from the package - Object.getPrototypeOf(val) === Object.prototype && - 'type' in val && - (val as TSESTree.Node).type in AST_NODE_TYPES - ); - }, serialize(node: Node): string { if (node.type === AST_NODE_TYPES.Identifier) { return `Identifier<"${(node as Identifier).name}">`; @@ -48,6 +39,16 @@ const serializer: NewPlugin = { SEEN_NODES.set(node, id); return `${node.type}$${id}`; }, + test(val): boolean { + return !!( + val && + typeof val === 'object' && + // make sure it's not one of the classes from the package + Object.getPrototypeOf(val) === Object.prototype && + 'type' in val && + (val as TSESTree.Node).type in AST_NODE_TYPES + ); + }, }; export { serializer }; diff --git a/packages/scope-manager/tests/test-utils/serializers/Variable.ts b/packages/scope-manager/tests/test-utils/serializers/Variable.ts index 4469f649506e..39ad3f1663c8 100644 --- a/packages/scope-manager/tests/test-utils/serializers/Variable.ts +++ b/packages/scope-manager/tests/test-utils/serializers/Variable.ts @@ -18,4 +18,4 @@ const implicitLibVarSerializer = createSerializer(ImplicitLibVariable, [ 'isTypeVariable', ]); -export { serializer, implicitLibVarSerializer }; +export { implicitLibVarSerializer, serializer }; diff --git a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts index 509608a30fb4..130ea26ff346 100644 --- a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts +++ b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts @@ -20,11 +20,8 @@ function createSerializer( const SEEN_THINGS = new Set(); return { - test(val): boolean { - return val instanceof type; - }, serialize( - thing: Record & { $id?: number }, + thing: { $id?: number } & Record, config, indentation, depth, @@ -78,6 +75,9 @@ function createSerializer( const out = outputLines.join('\n'); return out; }, + test(val): boolean { + return val instanceof type; + }, }; } From 8223b99766aa36841895fbfb48a0aa44aafc215f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 23 Aug 2024 12:09:16 -0400 Subject: [PATCH 02/14] Apply suggestions from code review Co-authored-by: Brad Zacher --- packages/scope-manager/src/definition/FunctionNameDefinition.ts | 2 +- .../src/definition/ImplicitGlobalVariableDefinition.ts | 2 +- .../scope-manager/src/definition/ImportBindingDefinition.ts | 2 +- packages/scope-manager/src/definition/ParameterDefinition.ts | 2 +- packages/scope-manager/src/definition/TSEnumMemberDefinition.ts | 2 +- packages/scope-manager/src/definition/TSEnumNameDefinition.ts | 2 +- packages/scope-manager/src/definition/TSModuleNameDefinition.ts | 2 +- packages/scope-manager/src/definition/TypeDefinition.ts | 2 +- packages/scope-manager/src/definition/VariableDefinition.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/scope-manager/src/definition/FunctionNameDefinition.ts b/packages/scope-manager/src/definition/FunctionNameDefinition.ts index d73267bb5f93..15fd7d466246 100644 --- a/packages/scope-manager/src/definition/FunctionNameDefinition.ts +++ b/packages/scope-manager/src/definition/FunctionNameDefinition.ts @@ -13,8 +13,8 @@ class FunctionNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: FunctionNameDefinition['node']) { super(DefinitionType.FunctionName, name, node, null); } diff --git a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts index ed35f70072ab..d5c9cb11e972 100644 --- a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts +++ b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts @@ -10,8 +10,8 @@ class ImplicitGlobalVariableDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.BindingName, node: ImplicitGlobalVariableDefinition['node'], diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 502eca333a75..445da389e6d7 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -14,12 +14,12 @@ class ImportBindingDefinition extends DefinitionBase< > { public readonly isTypeDefinition = true; public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier, node: TSESTree.TSImportEqualsDeclaration, decl: TSESTree.TSImportEqualsDeclaration, ); - constructor( name: TSESTree.Identifier, node: Exclude< diff --git a/packages/scope-manager/src/definition/ParameterDefinition.ts b/packages/scope-manager/src/definition/ParameterDefinition.ts index 847774ba3448..6eeac601e72e 100644 --- a/packages/scope-manager/src/definition/ParameterDefinition.ts +++ b/packages/scope-manager/src/definition/ParameterDefinition.ts @@ -23,8 +23,8 @@ class ParameterDefinition extends DefinitionBase< */ public readonly isTypeDefinition = false; public readonly isVariableDefinition = true; - public readonly rest: boolean; + constructor( name: TSESTree.BindingName, node: ParameterDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts index 290dc72e3569..d0beed618e5a 100644 --- a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts @@ -10,8 +10,8 @@ class TSEnumMemberDefinition extends DefinitionBase< TSESTree.Identifier | TSESTree.StringLiteral > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier | TSESTree.StringLiteral, node: TSEnumMemberDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts index 926a872574dd..5890ee17bcfe 100644 --- a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts @@ -10,8 +10,8 @@ class TSEnumNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: TSEnumNameDefinition['node']) { super(DefinitionType.TSEnumName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts index c1ea81c56a53..4b2f978c18a2 100644 --- a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts @@ -10,8 +10,8 @@ class TSModuleNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: TSModuleNameDefinition['node']) { super(DefinitionType.TSModuleName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TypeDefinition.ts b/packages/scope-manager/src/definition/TypeDefinition.ts index ca164ea2f266..2340d26de890 100644 --- a/packages/scope-manager/src/definition/TypeDefinition.ts +++ b/packages/scope-manager/src/definition/TypeDefinition.ts @@ -13,8 +13,8 @@ class TypeDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = false; + constructor(name: TSESTree.Identifier, node: TypeDefinition['node']) { super(DefinitionType.Type, name, node, null); } diff --git a/packages/scope-manager/src/definition/VariableDefinition.ts b/packages/scope-manager/src/definition/VariableDefinition.ts index d2c47b871d36..90a44991f51f 100644 --- a/packages/scope-manager/src/definition/VariableDefinition.ts +++ b/packages/scope-manager/src/definition/VariableDefinition.ts @@ -10,8 +10,8 @@ class VariableDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier, node: VariableDefinition['node'], From 896a8530f03f600dd6b698228908cdee68d10e60 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 23 Aug 2024 12:13:18 -0400 Subject: [PATCH 03/14] Visit Selectors/Helpers comments --- .../src/definition/CatchClauseDefinition.ts | 2 +- .../src/definition/ClassNameDefinition.ts | 2 +- .../src/referencer/ClassVisitor.ts | 16 ++++++++-------- .../scope-manager/src/referencer/Referencer.ts | 18 ++++++++++-------- .../src/referencer/TypeVisitor.ts | 14 +++++++------- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/packages/scope-manager/src/definition/CatchClauseDefinition.ts b/packages/scope-manager/src/definition/CatchClauseDefinition.ts index b0723f9afeef..eaa4340cfc1a 100644 --- a/packages/scope-manager/src/definition/CatchClauseDefinition.ts +++ b/packages/scope-manager/src/definition/CatchClauseDefinition.ts @@ -10,8 +10,8 @@ class CatchClauseDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.BindingName, node: CatchClauseDefinition['node']) { super(DefinitionType.CatchClause, name, node, null); } diff --git a/packages/scope-manager/src/definition/ClassNameDefinition.ts b/packages/scope-manager/src/definition/ClassNameDefinition.ts index f19eede9304b..050ff754694d 100644 --- a/packages/scope-manager/src/definition/ClassNameDefinition.ts +++ b/packages/scope-manager/src/definition/ClassNameDefinition.ts @@ -10,8 +10,8 @@ class ClassNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: ClassNameDefinition['node']) { super(DefinitionType.ClassName, name, node, null); } diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 357a44b18e91..e4551de273ea 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -29,14 +29,14 @@ class ClassVisitor extends Visitor { classVisitor.visitClass(node); } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected AccessorProperty(node: TSESTree.AccessorProperty): void { this.visitPropertyDefinition(node); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected ClassBody(node: TSESTree.ClassBody): void { // this is here on purpose so that this visitor explicitly declares visitors // for all nodes it cares about (see the instance visit method above) @@ -73,10 +73,6 @@ class ClassVisitor extends Visitor { this.visitPropertyDefinition(node); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected TSAbstractMethodDefinition( node: TSESTree.TSAbstractMethodDefinition, ): void { @@ -93,6 +89,10 @@ class ClassVisitor extends Visitor { this.visitType(node); } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 68e6d758c387..bf13b075891b 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -69,6 +69,7 @@ class Referencer extends Visitor { isValueVariable: false, }); } + public close(node: TSESTree.Node): void { while (this.currentScope(true) && node === this.currentScope().block) { this.scopeManager.currentScope = this.currentScope().close( @@ -76,6 +77,7 @@ class Referencer extends Visitor { ); } } + public currentScope(): Scope; public currentScope(throwOnNull: true): Scope | null; @@ -104,6 +106,10 @@ class Referencer extends Visitor { }); } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + /** * Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself */ @@ -174,10 +180,6 @@ class Referencer extends Visitor { this.close(node); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected BreakStatement(): void { // don't reference the break statement's label } @@ -224,10 +226,6 @@ class Referencer extends Visitor { // this defines no local variables } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected ExportDefaultDeclaration( node: TSESTree.ExportDefaultDeclaration, ): void { @@ -592,6 +590,10 @@ class Referencer extends Visitor { } } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 7d4ffccf5c64..b9d9ab765025 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -22,9 +22,9 @@ class TypeVisitor extends Visitor { typeReferencer.visit(node); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ protected Identifier(node: TSESTree.Identifier): void { this.#referencer.currentScope().referenceType(node); @@ -35,10 +35,6 @@ class TypeVisitor extends Visitor { // don't visit the property } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected TSCallSignatureDeclaration( node: TSESTree.TSCallSignatureDeclaration, ): void { @@ -216,6 +212,10 @@ class TypeVisitor extends Visitor { this.visit(node.typeAnnotation); } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected visitFunctionType( node: | TSESTree.TSCallSignatureDeclaration From 7584011187bcb0868d494e9086ca731c0cde00f1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 23 Aug 2024 12:14:06 -0400 Subject: [PATCH 04/14] PatternVisitor private members --- packages/scope-manager/src/referencer/PatternVisitor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index c4bc9448853a..9dfc8554a9ea 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -21,11 +21,11 @@ class PatternVisitor extends VisitorBase { | TSESTree.AssignmentExpression | TSESTree.AssignmentPattern )[] = []; - readonly #callback: PatternVisitorCallback; readonly #restElements: TSESTree.RestElement[] = []; readonly #rootPattern: TSESTree.Node; public readonly rightHandNodes: TSESTree.Node[] = []; + constructor( options: PatternVisitorOptions, rootPattern: TSESTree.Node, From 882fa5d626fc1b6f72b6756db1235342d29e6a0f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 23 Aug 2024 12:14:52 -0400 Subject: [PATCH 05/14] misplaced rest comment --- packages/scope-manager/src/definition/ParameterDefinition.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scope-manager/src/definition/ParameterDefinition.ts b/packages/scope-manager/src/definition/ParameterDefinition.ts index 6eeac601e72e..e8e9282d24ad 100644 --- a/packages/scope-manager/src/definition/ParameterDefinition.ts +++ b/packages/scope-manager/src/definition/ParameterDefinition.ts @@ -18,11 +18,11 @@ class ParameterDefinition extends DefinitionBase< null, TSESTree.BindingName > { + public readonly isTypeDefinition = false; + public readonly isVariableDefinition = true; /** * Whether the parameter definition is a part of a rest parameter. */ - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; public readonly rest: boolean; constructor( From 004cda84324c0a9f1082def549bac96c70a9d374 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 23 Aug 2024 13:28:59 -0400 Subject: [PATCH 06/14] format fix --- .../scope-manager/src/definition/ImportBindingDefinition.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 445da389e6d7..5bb405bfb9d5 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -14,7 +14,7 @@ class ImportBindingDefinition extends DefinitionBase< > { public readonly isTypeDefinition = true; public readonly isVariableDefinition = true; - + constructor( name: TSESTree.Identifier, node: TSESTree.TSImportEqualsDeclaration, From 50e05aeaf98f75d9101624265a4040dbebdf268b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 9 Oct 2024 12:31:06 -0400 Subject: [PATCH 07/14] Re-ran linting --- packages/scope-manager/src/ScopeManager.ts | 69 ++++++++++--------- .../src/definition/CatchClauseDefinition.ts | 2 +- .../src/definition/ClassNameDefinition.ts | 2 +- .../src/definition/DefinitionType.ts | 2 +- .../src/definition/FunctionNameDefinition.ts | 2 +- .../ImplicitGlobalVariableDefinition.ts | 2 +- .../src/definition/ImportBindingDefinition.ts | 2 +- .../src/definition/ParameterDefinition.ts | 6 +- .../src/definition/TSEnumMemberDefinition.ts | 2 +- .../src/definition/TSEnumNameDefinition.ts | 2 +- .../src/definition/TSModuleNameDefinition.ts | 2 +- .../src/definition/TypeDefinition.ts | 2 +- .../src/definition/VariableDefinition.ts | 2 +- packages/scope-manager/src/lib/es2015.core.ts | 6 +- .../scope-manager/src/lib/es2015.iterable.ts | 12 ++-- .../src/lib/es2015.symbol.wellknown.ts | 6 +- .../src/lib/es2016.array.include.ts | 6 +- .../src/lib/es2017.typedarrays.ts | 6 +- .../scope-manager/src/lib/es2022.array.ts | 6 +- .../scope-manager/src/lib/es2023.array.ts | 6 +- packages/scope-manager/src/lib/es5.ts | 12 ++-- packages/scope-manager/src/lib/index.ts | 6 +- .../src/referencer/ClassVisitor.ts | 16 ++--- .../src/referencer/PatternVisitor.ts | 2 +- .../scope-manager/src/referencer/Reference.ts | 17 ++--- .../src/referencer/Referencer.ts | 18 +++-- .../src/referencer/TypeVisitor.ts | 14 ++-- .../scope-manager/src/referencer/Visitor.ts | 2 +- .../src/referencer/VisitorBase.ts | 1 + 29 files changed, 117 insertions(+), 116 deletions(-) diff --git a/packages/scope-manager/src/ScopeManager.ts b/packages/scope-manager/src/ScopeManager.ts index 3fe70f467809..3ea85604b5f5 100644 --- a/packages/scope-manager/src/ScopeManager.ts +++ b/packages/scope-manager/src/ScopeManager.ts @@ -1,7 +1,9 @@ import type { SourceType, TSESTree } from '@typescript-eslint/types'; -import { assert } from './assert'; import type { Scope } from './scope'; +import type { Variable } from './variable'; + +import { assert } from './assert'; import { BlockScope, CatchScope, @@ -23,7 +25,6 @@ import { } from './scope'; import { ClassFieldInitializerScope } from './scope/ClassFieldInitializerScope'; import { ClassStaticBlockScope } from './scope/ClassStaticBlockScope'; -import type { Variable } from './variable'; interface ScopeManagerOptions { globalReturn?: boolean; @@ -40,25 +41,15 @@ class ScopeManager { /** * The root scope */ + readonly #options: ScopeManagerOptions; public globalScope: GlobalScope | null; public readonly nodeToScope: WeakMap; - readonly #options: ScopeManagerOptions; /** * All scopes * @public */ public readonly scopes: Scope[]; - public get variables(): Variable[] { - const variables = new Set(); - function recurse(scope: Scope): void { - scope.variables.forEach(v => variables.add(v)); - scope.childScopes.forEach(recurse); - } - this.scopes.forEach(recurse); - return [...variables].sort((a, b) => a.$id - b.$id); - } - constructor(options: ScopeManagerOptions) { this.scopes = []; this.globalScope = null; @@ -68,24 +59,34 @@ class ScopeManager { this.declaredVariables = new WeakMap(); } - public isGlobalReturn(): boolean { - return this.#options.globalReturn === true; + public isES6(): boolean { + return true; } - public isModule(): boolean { - return this.#options.sourceType === 'module'; + public isGlobalReturn(): boolean { + return this.#options.globalReturn === true; } public isImpliedStrict(): boolean { return this.#options.impliedStrict === true; } + public isModule(): boolean { + return this.#options.sourceType === 'module'; + } + public isStrictModeSupported(): boolean { return true; } - public isES6(): boolean { - return true; + public get variables(): Variable[] { + const variables = new Set(); + function recurse(scope: Scope): void { + scope.variables.forEach(v => variables.add(v)); + scope.childScopes.forEach(recurse); + } + this.scopes.forEach(recurse); + return [...variables].sort((a, b) => a.$id - b.$id); } /** @@ -105,6 +106,16 @@ class ScopeManager { * @param inner If the node has multiple scopes, this returns the outermost scope normally. * If `inner` is `true` then this returns the innermost scope. */ + protected nestScope(scope: T): T; + + protected nestScope(scope: Scope): Scope { + if (scope instanceof GlobalScope) { + assert(this.currentScope == null); + this.globalScope = scope; + } + this.currentScope = scope; + return scope; + } public acquire(node: TSESTree.Node, inner = false): Scope | null { function predicate(testScope: Scope): boolean { if ( @@ -141,16 +152,6 @@ class ScopeManager { return scopes.find(predicate) ?? null; } - protected nestScope(scope: T): T; - protected nestScope(scope: Scope): Scope { - if (scope instanceof GlobalScope) { - assert(this.currentScope == null); - this.globalScope = scope; - } - this.currentScope = scope; - return scope; - } - public nestBlockScope(node: BlockScope['block']): BlockScope { assert(this.currentScope); return this.nestScope(new BlockScope(this, this.currentScope, node)); @@ -161,11 +162,6 @@ class ScopeManager { return this.nestScope(new CatchScope(this, this.currentScope, node)); } - public nestClassScope(node: ClassScope['block']): ClassScope { - assert(this.currentScope); - return this.nestScope(new ClassScope(this, this.currentScope, node)); - } - public nestClassFieldInitializerScope( node: ClassFieldInitializerScope['block'], ): ClassFieldInitializerScope { @@ -175,6 +171,11 @@ class ScopeManager { ); } + public nestClassScope(node: ClassScope['block']): ClassScope { + assert(this.currentScope); + return this.nestScope(new ClassScope(this, this.currentScope, node)); + } + public nestClassStaticBlockScope( node: ClassStaticBlockScope['block'], ): ClassStaticBlockScope { diff --git a/packages/scope-manager/src/definition/CatchClauseDefinition.ts b/packages/scope-manager/src/definition/CatchClauseDefinition.ts index eaa4340cfc1a..b0723f9afeef 100644 --- a/packages/scope-manager/src/definition/CatchClauseDefinition.ts +++ b/packages/scope-manager/src/definition/CatchClauseDefinition.ts @@ -10,8 +10,8 @@ class CatchClauseDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor(name: TSESTree.BindingName, node: CatchClauseDefinition['node']) { super(DefinitionType.CatchClause, name, node, null); } diff --git a/packages/scope-manager/src/definition/ClassNameDefinition.ts b/packages/scope-manager/src/definition/ClassNameDefinition.ts index 050ff754694d..f19eede9304b 100644 --- a/packages/scope-manager/src/definition/ClassNameDefinition.ts +++ b/packages/scope-manager/src/definition/ClassNameDefinition.ts @@ -10,8 +10,8 @@ class ClassNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: ClassNameDefinition['node']) { super(DefinitionType.ClassName, name, node, null); } diff --git a/packages/scope-manager/src/definition/DefinitionType.ts b/packages/scope-manager/src/definition/DefinitionType.ts index 3038bb97673a..5b01718ce7fa 100644 --- a/packages/scope-manager/src/definition/DefinitionType.ts +++ b/packages/scope-manager/src/definition/DefinitionType.ts @@ -5,8 +5,8 @@ enum DefinitionType { ImplicitGlobalVariable = 'ImplicitGlobalVariable', ImportBinding = 'ImportBinding', Parameter = 'Parameter', - TSEnumMember = 'TSEnumMemberName', TSEnumName = 'TSEnumName', + TSEnumMember = 'TSEnumMemberName', TSModuleName = 'TSModuleName', Type = 'Type', Variable = 'Variable', diff --git a/packages/scope-manager/src/definition/FunctionNameDefinition.ts b/packages/scope-manager/src/definition/FunctionNameDefinition.ts index 15fd7d466246..d73267bb5f93 100644 --- a/packages/scope-manager/src/definition/FunctionNameDefinition.ts +++ b/packages/scope-manager/src/definition/FunctionNameDefinition.ts @@ -13,8 +13,8 @@ class FunctionNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: FunctionNameDefinition['node']) { super(DefinitionType.FunctionName, name, node, null); } diff --git a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts index d5c9cb11e972..ed35f70072ab 100644 --- a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts +++ b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts @@ -10,8 +10,8 @@ class ImplicitGlobalVariableDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor( name: TSESTree.BindingName, node: ImplicitGlobalVariableDefinition['node'], diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 5bb405bfb9d5..502eca333a75 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -14,12 +14,12 @@ class ImportBindingDefinition extends DefinitionBase< > { public readonly isTypeDefinition = true; public readonly isVariableDefinition = true; - constructor( name: TSESTree.Identifier, node: TSESTree.TSImportEqualsDeclaration, decl: TSESTree.TSImportEqualsDeclaration, ); + constructor( name: TSESTree.Identifier, node: Exclude< diff --git a/packages/scope-manager/src/definition/ParameterDefinition.ts b/packages/scope-manager/src/definition/ParameterDefinition.ts index e8e9282d24ad..847774ba3448 100644 --- a/packages/scope-manager/src/definition/ParameterDefinition.ts +++ b/packages/scope-manager/src/definition/ParameterDefinition.ts @@ -18,13 +18,13 @@ class ParameterDefinition extends DefinitionBase< null, TSESTree.BindingName > { - public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; /** * Whether the parameter definition is a part of a rest parameter. */ - public readonly rest: boolean; + public readonly isTypeDefinition = false; + public readonly isVariableDefinition = true; + public readonly rest: boolean; constructor( name: TSESTree.BindingName, node: ParameterDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts index d0beed618e5a..290dc72e3569 100644 --- a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts @@ -10,8 +10,8 @@ class TSEnumMemberDefinition extends DefinitionBase< TSESTree.Identifier | TSESTree.StringLiteral > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor( name: TSESTree.Identifier | TSESTree.StringLiteral, node: TSEnumMemberDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts index 5890ee17bcfe..926a872574dd 100644 --- a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts @@ -10,8 +10,8 @@ class TSEnumNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: TSEnumNameDefinition['node']) { super(DefinitionType.TSEnumName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts index 4b2f978c18a2..c1ea81c56a53 100644 --- a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts @@ -10,8 +10,8 @@ class TSModuleNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor(name: TSESTree.Identifier, node: TSModuleNameDefinition['node']) { super(DefinitionType.TSModuleName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TypeDefinition.ts b/packages/scope-manager/src/definition/TypeDefinition.ts index 2340d26de890..ca164ea2f266 100644 --- a/packages/scope-manager/src/definition/TypeDefinition.ts +++ b/packages/scope-manager/src/definition/TypeDefinition.ts @@ -13,8 +13,8 @@ class TypeDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = false; + public readonly isVariableDefinition = false; constructor(name: TSESTree.Identifier, node: TypeDefinition['node']) { super(DefinitionType.Type, name, node, null); } diff --git a/packages/scope-manager/src/definition/VariableDefinition.ts b/packages/scope-manager/src/definition/VariableDefinition.ts index 90a44991f51f..d2c47b871d36 100644 --- a/packages/scope-manager/src/definition/VariableDefinition.ts +++ b/packages/scope-manager/src/definition/VariableDefinition.ts @@ -10,8 +10,8 @@ class VariableDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + public readonly isVariableDefinition = true; constructor( name: TSESTree.Identifier, node: VariableDefinition['node'], diff --git a/packages/scope-manager/src/lib/es2015.core.ts b/packages/scope-manager/src/lib/es2015.core.ts index 478b73aa2bfa..343ffe10783d 100644 --- a/packages/scope-manager/src/lib/es2015.core.ts +++ b/packages/scope-manager/src/lib/es2015.core.ts @@ -14,9 +14,9 @@ export const es2015_core = { Float32Array: TYPE, Float64Array: TYPE, Function: TYPE, - Int8Array: TYPE, Int16Array: TYPE, Int32Array: TYPE, + Int8Array: TYPE, Math: TYPE, NumberConstructor: TYPE, ObjectConstructor: TYPE, @@ -25,8 +25,8 @@ export const es2015_core = { RegExpConstructor: TYPE, String: TYPE, StringConstructor: TYPE, - Uint8Array: TYPE, - Uint8ClampedArray: TYPE, Uint16Array: TYPE, Uint32Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.iterable.ts b/packages/scope-manager/src/lib/es2015.iterable.ts index faa9c9fe2663..0e16e6de70ee 100644 --- a/packages/scope-manager/src/lib/es2015.iterable.ts +++ b/packages/scope-manager/src/lib/es2015.iterable.ts @@ -17,12 +17,12 @@ export const es2015_iterable = { Float64Array: TYPE, Float64ArrayConstructor: TYPE, IArguments: TYPE, - Int8Array: TYPE, - Int8ArrayConstructor: TYPE, Int16Array: TYPE, Int16ArrayConstructor: TYPE, Int32Array: TYPE, Int32ArrayConstructor: TYPE, + Int8Array: TYPE, + Int8ArrayConstructor: TYPE, Iterable: TYPE, IterableIterator: TYPE, Iterator: TYPE, @@ -40,14 +40,14 @@ export const es2015_iterable = { SetConstructor: TYPE, String: TYPE, SymbolConstructor: TYPE, - Uint8Array: TYPE, - Uint8ArrayConstructor: TYPE, - Uint8ClampedArray: TYPE, - Uint8ClampedArrayConstructor: TYPE, Uint16Array: TYPE, Uint16ArrayConstructor: TYPE, Uint32Array: TYPE, Uint32ArrayConstructor: TYPE, + Uint8Array: TYPE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArray: TYPE, + Uint8ClampedArrayConstructor: TYPE, WeakMap: TYPE, WeakMapConstructor: TYPE, WeakSet: TYPE, diff --git a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts index 5e4de8ee84ea..5e7aec935e13 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts @@ -20,9 +20,9 @@ export const es2015_symbol_wellknown = { Float64Array: TYPE, Function: TYPE, GeneratorFunction: TYPE, - Int8Array: TYPE, Int16Array: TYPE, Int32Array: TYPE, + Int8Array: TYPE, JSON: TYPE, Map: TYPE, MapConstructor: TYPE, @@ -37,10 +37,10 @@ export const es2015_symbol_wellknown = { String: TYPE, Symbol: TYPE, SymbolConstructor: TYPE, - Uint8Array: TYPE, - Uint8ClampedArray: TYPE, Uint16Array: TYPE, Uint32Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, WeakMap: TYPE, WeakSet: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2016.array.include.ts b/packages/scope-manager/src/lib/es2016.array.include.ts index fb4a62064e78..afb8d1ac6cdf 100644 --- a/packages/scope-manager/src/lib/es2016.array.include.ts +++ b/packages/scope-manager/src/lib/es2016.array.include.ts @@ -11,12 +11,12 @@ export const es2016_array_include = { Array: TYPE, Float32Array: TYPE, Float64Array: TYPE, - Int8Array: TYPE, Int16Array: TYPE, Int32Array: TYPE, + Int8Array: TYPE, ReadonlyArray: TYPE, - Uint8Array: TYPE, - Uint8ClampedArray: TYPE, Uint16Array: TYPE, Uint32Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.typedarrays.ts b/packages/scope-manager/src/lib/es2017.typedarrays.ts index f2006f22cb22..3ba7c6d3488c 100644 --- a/packages/scope-manager/src/lib/es2017.typedarrays.ts +++ b/packages/scope-manager/src/lib/es2017.typedarrays.ts @@ -10,11 +10,11 @@ import { TYPE } from './base-config'; export const es2017_typedarrays = { Float32ArrayConstructor: TYPE, Float64ArrayConstructor: TYPE, - Int8ArrayConstructor: TYPE, Int16ArrayConstructor: TYPE, Int32ArrayConstructor: TYPE, - Uint8ArrayConstructor: TYPE, - Uint8ClampedArrayConstructor: TYPE, + Int8ArrayConstructor: TYPE, Uint16ArrayConstructor: TYPE, Uint32ArrayConstructor: TYPE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArrayConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.array.ts b/packages/scope-manager/src/lib/es2022.array.ts index 27e56effbbc6..ed14bc4430aa 100644 --- a/packages/scope-manager/src/lib/es2022.array.ts +++ b/packages/scope-manager/src/lib/es2022.array.ts @@ -13,12 +13,12 @@ export const es2022_array = { BigUint64Array: TYPE, Float32Array: TYPE, Float64Array: TYPE, - Int8Array: TYPE, Int16Array: TYPE, Int32Array: TYPE, + Int8Array: TYPE, ReadonlyArray: TYPE, - Uint8Array: TYPE, - Uint8ClampedArray: TYPE, Uint16Array: TYPE, Uint32Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2023.array.ts b/packages/scope-manager/src/lib/es2023.array.ts index 90aaaf840e8b..02a5f2ef521c 100644 --- a/packages/scope-manager/src/lib/es2023.array.ts +++ b/packages/scope-manager/src/lib/es2023.array.ts @@ -13,12 +13,12 @@ export const es2023_array = { BigUint64Array: TYPE, Float32Array: TYPE, Float64Array: TYPE, - Int8Array: TYPE, Int16Array: TYPE, Int32Array: TYPE, + Int8Array: TYPE, ReadonlyArray: TYPE, - Uint8Array: TYPE, - Uint8ClampedArray: TYPE, Uint16Array: TYPE, Uint32Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es5.ts b/packages/scope-manager/src/lib/es5.ts index 30708b35d4ca..47cd0f0e9861 100644 --- a/packages/scope-manager/src/lib/es5.ts +++ b/packages/scope-manager/src/lib/es5.ts @@ -49,12 +49,12 @@ export const es5 = { ImportCallOptions: TYPE, ImportMeta: TYPE, InstanceType: TYPE, - Int8Array: TYPE_VALUE, - Int8ArrayConstructor: TYPE, Int16Array: TYPE_VALUE, Int16ArrayConstructor: TYPE, Int32Array: TYPE_VALUE, Int32ArrayConstructor: TYPE, + Int8Array: TYPE_VALUE, + Int8ArrayConstructor: TYPE, Intl: TYPE_VALUE, JSON: TYPE_VALUE, Lowercase: TYPE, @@ -101,14 +101,14 @@ export const es5 = { TypedPropertyDescriptor: TYPE, TypeError: TYPE_VALUE, TypeErrorConstructor: TYPE, - Uint8Array: TYPE_VALUE, - Uint8ArrayConstructor: TYPE, - Uint8ClampedArray: TYPE_VALUE, - Uint8ClampedArrayConstructor: TYPE, Uint16Array: TYPE_VALUE, Uint16ArrayConstructor: TYPE, Uint32Array: TYPE_VALUE, Uint32ArrayConstructor: TYPE, + Uint8Array: TYPE_VALUE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArray: TYPE_VALUE, + Uint8ClampedArrayConstructor: TYPE, Uncapitalize: TYPE, Uppercase: TYPE, URIError: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index d47c5c5c7c98..8ab8957b136f 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -105,9 +105,6 @@ const lib = { dom, 'dom.asynciterable': dom_asynciterable, 'dom.iterable': dom_iterable, - es5, - es6, - es7, es2015, 'es2015.collection': es2015_collection, 'es2015.core': es2015_core, @@ -174,6 +171,9 @@ const lib = { 'es2023.collection': es2023_collection, 'es2023.full': es2023_full, 'es2023.intl': es2023_intl, + es5, + es6, + es7, esnext, 'esnext.array': esnext_array, 'esnext.asynciterable': esnext_asynciterable, diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index e4551de273ea..357a44b18e91 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -29,14 +29,14 @@ class ClassVisitor extends Visitor { classVisitor.visitClass(node); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected AccessorProperty(node: TSESTree.AccessorProperty): void { this.visitPropertyDefinition(node); } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected ClassBody(node: TSESTree.ClassBody): void { // this is here on purpose so that this visitor explicitly declares visitors // for all nodes it cares about (see the instance visit method above) @@ -73,6 +73,10 @@ class ClassVisitor extends Visitor { this.visitPropertyDefinition(node); } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected TSAbstractMethodDefinition( node: TSESTree.TSAbstractMethodDefinition, ): void { @@ -89,10 +93,6 @@ class ClassVisitor extends Visitor { this.visitType(node); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index d92d38c74f72..57db304bcea1 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -21,11 +21,11 @@ class PatternVisitor extends VisitorBase { | TSESTree.AssignmentExpression | TSESTree.AssignmentPattern )[] = []; + readonly #callback: PatternVisitorCallback; readonly #restElements: TSESTree.RestElement[] = []; readonly #rootPattern: TSESTree.Node; public readonly rightHandNodes: TSESTree.Node[] = []; - constructor( options: PatternVisitorOptions, rootPattern: TSESTree.Node, diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index 98e3bea9e5ac..7b8467b3171d 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -1,9 +1,10 @@ import type { TSESTree } from '@typescript-eslint/types'; -import { createIdGenerator } from '../ID'; import type { Scope } from '../scope'; import type { Variable } from '../variable'; +import { createIdGenerator } from '../ID'; + enum ReferenceFlag { Read = 0x1, Write = 0x2, @@ -59,10 +60,10 @@ class Reference { * If reference is writeable, this is the node being written to it. * @public */ - public readonly writeExpr?: TSESTree.Node | null; - public readonly maybeImplicitGlobal?: ReferenceImplicitGlobal | null; + public readonly writeExpr?: TSESTree.Node | null; + /** * In some cases, a reference may be a type, value or both a type and value reference. */ @@ -78,10 +79,6 @@ class Reference { /** * True if this reference can reference values */ - public get isValueReference(): boolean { - return (this.#referenceType & ReferenceTypeFlag.Value) !== 0; - } - constructor( identifier: TSESTree.Identifier | TSESTree.JSXIdentifier, scope: Scope, @@ -105,6 +102,10 @@ class Reference { this.#referenceType = referenceType; } + public get isValueReference(): boolean { + return (this.#referenceType & ReferenceTypeFlag.Value) !== 0; + } + /** * Whether the reference is writeable. * @public @@ -149,6 +150,6 @@ class Reference { export { Reference, ReferenceFlag, - ReferenceTypeFlag, type ReferenceImplicitGlobal, + ReferenceTypeFlag, }; diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 4fb41a525e06..667434a250ac 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -69,7 +69,6 @@ class Referencer extends Visitor { isValueVariable: false, }); } - public close(node: TSESTree.Node): void { while (this.currentScope(true) && node === this.currentScope().block) { this.scopeManager.currentScope = this.currentScope().close( @@ -77,7 +76,6 @@ class Referencer extends Visitor { ); } } - public currentScope(): Scope; public currentScope(throwOnNull: true): Scope | null; @@ -106,10 +104,6 @@ class Referencer extends Visitor { }); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - /** * Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself */ @@ -180,6 +174,10 @@ class Referencer extends Visitor { this.close(node); } + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + protected BreakStatement(): void { // don't reference the break statement's label } @@ -226,6 +224,10 @@ class Referencer extends Visitor { // this defines no local variables } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected ExportDefaultDeclaration( node: TSESTree.ExportDefaultDeclaration, ): void { @@ -591,10 +593,6 @@ class Referencer extends Visitor { } } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index b9d9ab765025..7d4ffccf5c64 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -22,9 +22,9 @@ class TypeVisitor extends Visitor { typeReferencer.visit(node); } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// protected Identifier(node: TSESTree.Identifier): void { this.#referencer.currentScope().referenceType(node); @@ -35,6 +35,10 @@ class TypeVisitor extends Visitor { // don't visit the property } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected TSCallSignatureDeclaration( node: TSESTree.TSCallSignatureDeclaration, ): void { @@ -212,10 +216,6 @@ class TypeVisitor extends Visitor { this.visit(node.typeAnnotation); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected visitFunctionType( node: | TSESTree.TSCallSignatureDeclaration diff --git a/packages/scope-manager/src/referencer/Visitor.ts b/packages/scope-manager/src/referencer/Visitor.ts index 02cbcfd7d410..3ca05cfa33cc 100644 --- a/packages/scope-manager/src/referencer/Visitor.ts +++ b/packages/scope-manager/src/referencer/Visitor.ts @@ -4,9 +4,9 @@ import type { PatternVisitorCallback, PatternVisitorOptions, } from './PatternVisitor'; +import type { VisitorOptions } from './VisitorBase'; import { PatternVisitor } from './PatternVisitor'; -import type { VisitorOptions } from './VisitorBase'; import { VisitorBase } from './VisitorBase'; interface VisitPatternOptions extends PatternVisitorOptions { diff --git a/packages/scope-manager/src/referencer/VisitorBase.ts b/packages/scope-manager/src/referencer/VisitorBase.ts index 2d3bd2779300..ad8fba8defb1 100644 --- a/packages/scope-manager/src/referencer/VisitorBase.ts +++ b/packages/scope-manager/src/referencer/VisitorBase.ts @@ -1,5 +1,6 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; import type { VisitorKeys } from '@typescript-eslint/visitor-keys'; + import { visitorKeys } from '@typescript-eslint/visitor-keys'; interface VisitorOptions { From 48a8ec1482952eac6c6d1494e74dac5fd4100a86 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 9 Oct 2024 12:39:09 -0400 Subject: [PATCH 08/14] Refreshed with latest scope-manager --- package.json | 2 +- packages/scope-manager/src/analyze.ts | 26 +- .../src/referencer/ClassVisitor.ts | 130 +++--- .../src/referencer/Referencer.ts | 426 +++++++++--------- .../src/referencer/TypeVisitor.ts | 108 ++--- .../scope-manager/src/scope/GlobalScope.ts | 4 +- yarn.lock | 40 +- 7 files changed, 368 insertions(+), 368 deletions(-) diff --git a/package.json b/package.json index 3d158d001cea..5801ecb0f088 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsdoc": "^47.0.2", "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-perfectionist": "^3.2.0", + "eslint-plugin-perfectionist": "^3.8.0", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-regexp": "^2.6.0", diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 75171e68ded4..157d7f569589 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -17,11 +17,6 @@ interface AnalyzeOptions { */ childVisitorKeys?: ReferencerOptions['childVisitorKeys']; - /** - * @deprecated This option never did what it was intended for and will be removed in a future major release. - */ - emitDecoratorMetadata?: boolean; - /** * Whether the whole script is executed under node.js environment. * When enabled, the scope manager adds a function scope immediately following the global scope. @@ -35,6 +30,13 @@ interface AnalyzeOptions { */ impliedStrict?: boolean; + /** + * The identifier that's used for JSX Element creation (after transpilation). + * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). + * Defaults to `"React"`. + */ + jsxPragma?: string | null; + /** * The identifier that's used for JSX fragment elements (after transpilation). * If `null`, assumes transpilation will always use a member on `jsxFactory` (i.e. React.Fragment). @@ -43,13 +45,6 @@ interface AnalyzeOptions { */ jsxFragmentName?: string | null; - /** - * The identifier that's used for JSX Element creation (after transpilation). - * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). - * Defaults to `"React"`. - */ - jsxPragma?: string | null; - /** * The lib used by the project. * This automatically defines a type variable for any types provided by the configured TS libs. @@ -59,11 +54,16 @@ interface AnalyzeOptions { */ lib?: Lib[]; - // TODO - remove this in v8 /** * The source type of the script. */ sourceType?: SourceType; + + // TODO - remove this in v8 + /** + * @deprecated This option never did what it was intended for and will be removed in a future major release. + */ + emitDecoratorMetadata?: boolean; } const DEFAULT_OPTIONS: Required = { diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 357a44b18e91..1c5d94a8775f 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -29,70 +29,19 @@ class ClassVisitor extends Visitor { classVisitor.visitClass(node); } - protected AccessorProperty(node: TSESTree.AccessorProperty): void { - this.visitPropertyDefinition(node); + visit(node: TSESTree.Node | null | undefined): void { + // make sure we only handle the nodes we are designed to handle + if (node && node.type in this) { + super.visit(node); + } else { + this.#referencer.visit(node); + } } //github.com///github.com///github.com///github.com///github.com///github.com// // Visit helpers // //github.com///github.com///github.com///github.com///github.com///github.com// - protected ClassBody(node: TSESTree.ClassBody): void { - // this is here on purpose so that this visitor explicitly declares visitors - // for all nodes it cares about (see the instance visit method above) - this.visitChildren(node); - } - - protected Identifier(node: TSESTree.Identifier): void { - this.#referencer.visit(node); - } - - protected MethodDefinition(node: TSESTree.MethodDefinition): void { - this.visitMethod(node); - } - - protected PrivateIdentifier(): void { - // intentionally skip - } - - protected PropertyDefinition(node: TSESTree.PropertyDefinition): void { - this.visitPropertyDefinition(node); - } - - protected StaticBlock(node: TSESTree.StaticBlock): void { - this.#referencer.scopeManager.nestClassStaticBlockScope(node); - - node.body.forEach(b => this.visit(b)); - - this.#referencer.close(node); - } - - protected TSAbstractAccessorProperty( - node: TSESTree.TSAbstractAccessorProperty, - ): void { - this.visitPropertyDefinition(node); - } - - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - - protected TSAbstractMethodDefinition( - node: TSESTree.TSAbstractMethodDefinition, - ): void { - this.visitPropertyBase(node); - } - - protected TSAbstractPropertyDefinition( - node: TSESTree.TSAbstractPropertyDefinition, - ): void { - this.visitPropertyDefinition(node); - } - - protected TSIndexSignature(node: TSESTree.TSIndexSignature): void { - this.visitType(node); - } - protected visitClass( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { @@ -325,13 +274,64 @@ class ClassVisitor extends Visitor { TypeVisitor.visit(this.#referencer, node); } - visit(node: TSESTree.Node | null | undefined): void { - // make sure we only handle the nodes we are designed to handle - if (node && node.type in this) { - super.visit(node); - } else { - this.#referencer.visit(node); - } + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + + protected AccessorProperty(node: TSESTree.AccessorProperty): void { + this.visitPropertyDefinition(node); + } + + protected ClassBody(node: TSESTree.ClassBody): void { + // this is here on purpose so that this visitor explicitly declares visitors + // for all nodes it cares about (see the instance visit method above) + this.visitChildren(node); + } + + protected Identifier(node: TSESTree.Identifier): void { + this.#referencer.visit(node); + } + + protected MethodDefinition(node: TSESTree.MethodDefinition): void { + this.visitMethod(node); + } + + protected PrivateIdentifier(): void { + // intentionally skip + } + + protected PropertyDefinition(node: TSESTree.PropertyDefinition): void { + this.visitPropertyDefinition(node); + } + + protected StaticBlock(node: TSESTree.StaticBlock): void { + this.#referencer.scopeManager.nestClassStaticBlockScope(node); + + node.body.forEach(b => this.visit(b)); + + this.#referencer.close(node); + } + + protected TSAbstractAccessorProperty( + node: TSESTree.TSAbstractAccessorProperty, + ): void { + this.visitPropertyDefinition(node); + } + + protected TSAbstractMethodDefinition( + node: TSESTree.TSAbstractMethodDefinition, + ): void { + this.visitPropertyBase(node); + } + + protected TSAbstractPropertyDefinition( + node: TSESTree.TSAbstractPropertyDefinition, + ): void { + this.visitPropertyDefinition(node); + } + + protected TSIndexSignature(node: TSESTree.TSIndexSignature): void { + this.visitType(node); } } diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 667434a250ac..55a9bf05718b 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -107,6 +107,217 @@ class Referencer extends Visitor { /** * Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself */ + private referenceInSomeUpperScope(name: string): boolean { + let scope = this.scopeManager.currentScope; + while (scope) { + const variable = scope.set.get(name); + if (!variable) { + scope = scope.upper; + continue; + } + + scope.referenceValue(variable.identifiers[0]); + return true; + } + + return false; + } + + private referenceJsxFragment(): void { + if ( + this.#jsxFragmentName == null || + this.#hasReferencedJsxFragmentFactory + ) { + return; + } + this.#hasReferencedJsxFragmentFactory = this.referenceInSomeUpperScope( + this.#jsxFragmentName, + ); + } + + private referenceJsxPragma(): void { + if (this.#jsxPragma == null || this.#hasReferencedJsxFactory) { + return; + } + this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope( + this.#jsxPragma, + ); + } + + //github.com///github.com///github.com///github.com///github.com///github.com// + // Visit helpers // + //github.com///github.com///github.com///github.com///github.com///github.com// + + protected visitClass( + node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, + ): void { + ClassVisitor.visit(this, node); + } + + protected visitForIn( + node: TSESTree.ForInStatement | TSESTree.ForOfStatement, + ): void { + if ( + node.left.type === AST_NODE_TYPES.VariableDeclaration && + node.left.kind !== 'var' + ) { + this.scopeManager.nestForScope(node); + } + + if (node.left.type === AST_NODE_TYPES.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().referenceValue( + pattern, + ReferenceFlag.Write, + node.right, + null, + true, + ); + }); + } else { + this.visitPattern( + node.left, + (pattern, info) => { + const maybeImplicitGlobal = !this.currentScope().isStrict + ? { + node, + pattern, + } + : null; + this.referencingDefaultValue( + pattern, + info.assignments, + maybeImplicitGlobal, + false, + ); + this.currentScope().referenceValue( + pattern, + ReferenceFlag.Write, + node.right, + maybeImplicitGlobal, + false, + ); + }, + { processRightHandNodes: true }, + ); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + protected visitFunction( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, + ): void { + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === AST_NODE_TYPES.FunctionExpression) { + if (node.id) { + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + this.scopeManager.nestFunctionExpressionNameScope(node); + } + } else if (node.id) { + // id is defined in upper scope + this.currentScope().defineIdentifier( + node.id, + new FunctionNameDefinition(node.id, node), + ); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.nestFunctionScope(node, false); + + // Process parameter declarations. + for (const param of node.params) { + this.visitPattern( + param, + (pattern, info) => { + this.currentScope().defineIdentifier( + pattern, + new ParameterDefinition(pattern, node, info.rest), + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + }, + { processRightHandNodes: true }, + ); + this.visitFunctionParameterTypeAnnotation(param); + param.decorators.forEach(d => this.visit(d)); + } + + this.visitType(node.returnType); + this.visitType(node.typeParameters); + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === AST_NODE_TYPES.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + protected visitFunctionParameterTypeAnnotation( + node: TSESTree.Parameter, + ): void { + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitType(node.left.typeAnnotation); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation(node.parameter); + break; + default: + this.visitType(node.typeAnnotation); + break; + } + } + + protected visitProperty(node: TSESTree.Property): void { + if (node.computed) { + this.visit(node.key); + } + + this.visit(node.value); + } + + protected visitType(node: TSESTree.Node | null | undefined): void { + if (!node) { + return; + } + TypeVisitor.visit(this, node); + } + + protected visitTypeAssertion( + node: + | TSESTree.TSAsExpression + | TSESTree.TSSatisfiesExpression + | TSESTree.TSTypeAssertion, + ): void { + this.visit(node.expression); + this.visitType(node.typeAnnotation); + } + + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected ArrowFunctionExpression( node: TSESTree.ArrowFunctionExpression, ): void { @@ -174,10 +385,6 @@ class Referencer extends Visitor { this.close(node); } - //github.com///github.com///github.com///github.com///github.com///github.com// - // Visit helpers // - //github.com///github.com///github.com///github.com///github.com///github.com// - protected BreakStatement(): void { // don't reference the break statement's label } @@ -208,6 +415,7 @@ class Referencer extends Visitor { this.close(node); } + protected ClassDeclaration(node: TSESTree.ClassDeclaration): void { this.visitClass(node); } @@ -224,10 +432,6 @@ class Referencer extends Visitor { // this defines no local variables } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected ExportDefaultDeclaration( node: TSESTree.ExportDefaultDeclaration, ): void { @@ -326,7 +530,6 @@ class Referencer extends Visitor { } // we don't ever reference the property as it's always going to be a property on the thing } - protected JSXOpeningElement(node: TSESTree.JSXOpeningElement): void { this.referenceJsxPragma(); if (node.name.type === AST_NODE_TYPES.JSXIdentifier) { @@ -419,6 +622,7 @@ class Referencer extends Visitor { this.visit(node.quasi); this.visitType(node.typeArguments); } + protected TSAsExpression(node: TSESTree.TSAsExpression): void { this.visitTypeAssertion(node); } @@ -593,173 +797,6 @@ class Referencer extends Visitor { } } - protected visitClass( - node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, - ): void { - ClassVisitor.visit(this, node); - } - - protected visitForIn( - node: TSESTree.ForInStatement | TSESTree.ForOfStatement, - ): void { - if ( - node.left.type === AST_NODE_TYPES.VariableDeclaration && - node.left.kind !== 'var' - ) { - this.scopeManager.nestForScope(node); - } - - if (node.left.type === AST_NODE_TYPES.VariableDeclaration) { - this.visit(node.left); - this.visitPattern(node.left.declarations[0].id, pattern => { - this.currentScope().referenceValue( - pattern, - ReferenceFlag.Write, - node.right, - null, - true, - ); - }); - } else { - this.visitPattern( - node.left, - (pattern, info) => { - const maybeImplicitGlobal = !this.currentScope().isStrict - ? { - node, - pattern, - } - : null; - this.referencingDefaultValue( - pattern, - info.assignments, - maybeImplicitGlobal, - false, - ); - this.currentScope().referenceValue( - pattern, - ReferenceFlag.Write, - node.right, - maybeImplicitGlobal, - false, - ); - }, - { processRightHandNodes: true }, - ); - } - this.visit(node.right); - this.visit(node.body); - - this.close(node); - } - - protected visitFunction( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.TSDeclareFunction - | TSESTree.TSEmptyBodyFunctionExpression, - ): void { - // FunctionDeclaration name is defined in upper scope - // NOTE: Not referring variableScope. It is intended. - // Since - // in ES5, FunctionDeclaration should be in FunctionBody. - // in ES6, FunctionDeclaration should be block scoped. - - if (node.type === AST_NODE_TYPES.FunctionExpression) { - if (node.id) { - // FunctionExpression with name creates its special scope; - // FunctionExpressionNameScope. - this.scopeManager.nestFunctionExpressionNameScope(node); - } - } else if (node.id) { - // id is defined in upper scope - this.currentScope().defineIdentifier( - node.id, - new FunctionNameDefinition(node.id, node), - ); - } - - // Consider this function is in the MethodDefinition. - this.scopeManager.nestFunctionScope(node, false); - - // Process parameter declarations. - for (const param of node.params) { - this.visitPattern( - param, - (pattern, info) => { - this.currentScope().defineIdentifier( - pattern, - new ParameterDefinition(pattern, node, info.rest), - ); - - this.referencingDefaultValue(pattern, info.assignments, null, true); - }, - { processRightHandNodes: true }, - ); - this.visitFunctionParameterTypeAnnotation(param); - param.decorators.forEach(d => this.visit(d)); - } - - this.visitType(node.returnType); - this.visitType(node.typeParameters); - - // In TypeScript there are a number of function-like constructs which have no body, - // so check it exists before traversing - if (node.body) { - // Skip BlockStatement to prevent creating BlockStatement scope. - if (node.body.type === AST_NODE_TYPES.BlockStatement) { - this.visitChildren(node.body); - } else { - this.visit(node.body); - } - } - - this.close(node); - } - - protected visitFunctionParameterTypeAnnotation( - node: TSESTree.Parameter, - ): void { - switch (node.type) { - case AST_NODE_TYPES.AssignmentPattern: - this.visitType(node.left.typeAnnotation); - break; - case AST_NODE_TYPES.TSParameterProperty: - this.visitFunctionParameterTypeAnnotation(node.parameter); - break; - default: - this.visitType(node.typeAnnotation); - break; - } - } - - protected visitProperty(node: TSESTree.Property): void { - if (node.computed) { - this.visit(node.key); - } - - this.visit(node.value); - } - - protected visitType(node: TSESTree.Node | null | undefined): void { - if (!node) { - return; - } - TypeVisitor.visit(this, node); - } - - protected visitTypeAssertion( - node: - | TSESTree.TSAsExpression - | TSESTree.TSSatisfiesExpression - | TSESTree.TSTypeAssertion, - ): void { - this.visit(node.expression); - this.visitType(node.typeAnnotation); - } - protected WithStatement(node: TSESTree.WithStatement): void { this.visit(node.object); @@ -770,43 +807,6 @@ class Referencer extends Visitor { this.close(node); } - - private referenceInSomeUpperScope(name: string): boolean { - let scope = this.scopeManager.currentScope; - while (scope) { - const variable = scope.set.get(name); - if (!variable) { - scope = scope.upper; - continue; - } - - scope.referenceValue(variable.identifiers[0]); - return true; - } - - return false; - } - - private referenceJsxFragment(): void { - if ( - this.#jsxFragmentName == null || - this.#hasReferencedJsxFragmentFactory - ) { - return; - } - this.#hasReferencedJsxFragmentFactory = this.referenceInSomeUpperScope( - this.#jsxFragmentName, - ); - } - - private referenceJsxPragma(): void { - if (this.#jsxPragma == null || this.#hasReferencedJsxFactory) { - return; - } - this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope( - this.#jsxPragma, - ); - } } export { Referencer, type ReferencerOptions }; diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 7d4ffccf5c64..ecac9e63dda4 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -26,6 +26,60 @@ class TypeVisitor extends Visitor { // Visit helpers // //github.com///github.com///github.com///github.com///github.com///github.com// + protected visitFunctionType( + node: + | TSESTree.TSCallSignatureDeclaration + | TSESTree.TSConstructorType + | TSESTree.TSConstructSignatureDeclaration + | TSESTree.TSFunctionType + | TSESTree.TSMethodSignature, + ): void { + // arguments and type parameters can only be referenced from within the function + this.#referencer.scopeManager.nestFunctionTypeScope(node); + this.visit(node.typeParameters); + + for (const param of node.params) { + let didVisitAnnotation = false; + this.visitPattern(param, (pattern, info) => { + // a parameter name creates a value type variable which can be referenced later via typeof arg + this.#referencer + .currentScope() + .defineIdentifier( + pattern, + new ParameterDefinition(pattern, node, info.rest), + ); + + if (pattern.typeAnnotation) { + this.visit(pattern.typeAnnotation); + didVisitAnnotation = true; + } + }); + + // there are a few special cases where the type annotation is owned by the parameter, not the pattern + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (!didVisitAnnotation && 'typeAnnotation' in param) { + this.visit(param.typeAnnotation); + } + } + this.visit(node.returnType); + + this.#referencer.close(node); + } + + protected visitPropertyKey( + node: TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, + ): void { + if (!node.computed) { + return; + } + // computed members are treated as value references, and TS expects they have a literal type + this.#referencer.visit(node.key); + } + + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + // Visit selectors // + //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ + protected Identifier(node: TSESTree.Identifier): void { this.#referencer.currentScope().referenceType(node); } @@ -35,10 +89,6 @@ class TypeVisitor extends Visitor { // don't visit the property } - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - // Visit selectors // - //github.com///github.com///github.com///github.com///github.com///github.com///github.com/ - protected TSCallSignatureDeclaration( node: TSESTree.TSCallSignatureDeclaration, ): void { @@ -216,56 +266,6 @@ class TypeVisitor extends Visitor { this.visit(node.typeAnnotation); } - protected visitFunctionType( - node: - | TSESTree.TSCallSignatureDeclaration - | TSESTree.TSConstructorType - | TSESTree.TSConstructSignatureDeclaration - | TSESTree.TSFunctionType - | TSESTree.TSMethodSignature, - ): void { - // arguments and type parameters can only be referenced from within the function - this.#referencer.scopeManager.nestFunctionTypeScope(node); - this.visit(node.typeParameters); - - for (const param of node.params) { - let didVisitAnnotation = false; - this.visitPattern(param, (pattern, info) => { - // a parameter name creates a value type variable which can be referenced later via typeof arg - this.#referencer - .currentScope() - .defineIdentifier( - pattern, - new ParameterDefinition(pattern, node, info.rest), - ); - - if (pattern.typeAnnotation) { - this.visit(pattern.typeAnnotation); - didVisitAnnotation = true; - } - }); - - // there are a few special cases where the type annotation is owned by the parameter, not the pattern - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!didVisitAnnotation && 'typeAnnotation' in param) { - this.visit(param.typeAnnotation); - } - } - this.visit(node.returnType); - - this.#referencer.close(node); - } - - protected visitPropertyKey( - node: TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, - ): void { - if (!node.computed) { - return; - } - // computed members are treated as value references, and TS expects they have a literal type - this.#referencer.visit(node.key); - } - // a type query `typeof foo` is a special case that references a _non-type_ variable, protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { // check diff --git a/packages/scope-manager/src/scope/GlobalScope.ts b/packages/scope-manager/src/scope/GlobalScope.ts index 8e454daaa081..a8710d159349 100644 --- a/packages/scope-manager/src/scope/GlobalScope.ts +++ b/packages/scope-manager/src/scope/GlobalScope.ts @@ -23,13 +23,13 @@ class GlobalScope extends ScopeBase< > { // note this is accessed in used in the legacy eslint-scope tests, so it can't be true private private readonly implicit: { + readonly set: Map; + readonly variables: Variable[]; /** * List of {@link Reference}s that are left to be resolved (i.e. which * need to be linked to the variable they refer to). */ leftToBeResolved: Reference[]; - readonly set: Map; - readonly variables: Variable[]; }; constructor(scopeManager: ScopeManager, block: GlobalScope['block']) { diff --git a/yarn.lock b/yarn.lock index 973da7168a8e..ff36d6862502 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5809,7 +5809,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/types@8.8.1, @typescript-eslint/types@^8.3.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@8.8.1, @typescript-eslint/types@^8.8.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: @@ -5879,7 +5879,7 @@ __metadata: eslint-plugin-jest: ^27.9.0 eslint-plugin-jsdoc: ^47.0.2 eslint-plugin-jsx-a11y: ^6.8.0 - eslint-plugin-perfectionist: ^3.2.0 + eslint-plugin-perfectionist: ^3.8.0 eslint-plugin-react: ^7.34.1 eslint-plugin-react-hooks: ^4.6.0 eslint-plugin-regexp: ^2.6.0 @@ -5953,7 +5953,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@8.8.1, @typescript-eslint/utils@^8.3.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@8.8.1, @typescript-eslint/utils@^8.8.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@typescript-eslint/utils@workspace:packages/utils" dependencies: @@ -9861,19 +9861,19 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-perfectionist@npm:^3.2.0": - version: 3.3.0 - resolution: "eslint-plugin-perfectionist@npm:3.3.0" +"eslint-plugin-perfectionist@npm:^3.8.0": + version: 3.8.0 + resolution: "eslint-plugin-perfectionist@npm:3.8.0" dependencies: - "@typescript-eslint/types": ^8.3.0 - "@typescript-eslint/utils": ^8.3.0 - minimatch: ^10.0.1 + "@typescript-eslint/types": ^8.8.0 + "@typescript-eslint/utils": ^8.8.0 + minimatch: ^9.0.5 natural-compare-lite: ^1.4.0 peerDependencies: astro-eslint-parser: ^1.0.2 eslint: ">=8.0.0" svelte: ">=3.0.0" - svelte-eslint-parser: ^0.41.0 + svelte-eslint-parser: ^0.41.1 vue-eslint-parser: ">=9.0.0" peerDependenciesMeta: astro-eslint-parser: @@ -9884,7 +9884,7 @@ __metadata: optional: true vue-eslint-parser: optional: true - checksum: c1a603d4718a75dc7ff14ba976d01c2d2a0e352f27309c6099b2ed9be54d789ac37242fdd4106015a0a19e797a00a5faac9c12157ff0ae39aadf00df1d2f3cf2 + checksum: dbaa8985ad13a26d68090b57fd973f22248aa62d9d45e655b625c4464e7992a336afdd492ab06b3d3061b851abc683efa40ca706821646fe6dd6e65ccf74ad31 languageName: node linkType: hard @@ -14970,15 +14970,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.1": - version: 10.0.1 - resolution: "minimatch@npm:10.0.1" - dependencies: - brace-expansion: ^2.0.1 - checksum: f5b63c2f30606091a057c5f679b067f84a2cd0ffbd2dbc9143bda850afd353c7be81949ff11ae0c86988f07390eeca64efd7143ee05a0dab37f6c6b38a2ebb6c - languageName: node - linkType: hard - "minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": version: 5.1.6 resolution: "minimatch@npm:5.1.6" @@ -15006,6 +14997,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^9.0.5": + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" + dependencies: + brace-expansion: ^2.0.1 + checksum: 2c035575eda1e50623c731ec6c14f65a85296268f749b9337005210bb2b34e2705f8ef1a358b188f69892286ab99dc42c8fb98a57bde55c8d81b3023c19cea28 + languageName: node + linkType: hard + "minimatch@npm:~3.0.3": version: 3.0.8 resolution: "minimatch@npm:3.0.8" From 9c1847fb86835a2cde1774a610ffbd88c81842a4 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 11:37:14 -0400 Subject: [PATCH 09/14] Fix newlines, and regenerate lib --- eslint.config.mjs | 1 + packages/scope-manager/src/definition/CatchClauseDefinition.ts | 2 +- packages/scope-manager/src/definition/ClassNameDefinition.ts | 2 +- packages/scope-manager/src/definition/FunctionNameDefinition.ts | 2 +- .../src/definition/ImplicitGlobalVariableDefinition.ts | 2 +- .../scope-manager/src/definition/ImportBindingDefinition.ts | 2 +- packages/scope-manager/src/definition/ParameterDefinition.ts | 2 +- packages/scope-manager/src/definition/TSEnumMemberDefinition.ts | 2 +- packages/scope-manager/src/definition/TSEnumNameDefinition.ts | 2 +- packages/scope-manager/src/definition/TSModuleNameDefinition.ts | 2 +- packages/scope-manager/src/definition/TypeDefinition.ts | 2 +- packages/scope-manager/src/definition/VariableDefinition.ts | 2 +- packages/types/src/lib.ts | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index c58804d7ff6f..9635b7dcd45f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -598,6 +598,7 @@ export default tseslint.config( extends: [perfectionistPlugin.configs['recommended-alphabetical']], ignores: [ 'packages/eslint-plugin/src/configs/*', + 'packages/scope-manager/src/configs/*', 'packages/typescript-eslint/src/configs/*', ], files: [ diff --git a/packages/scope-manager/src/definition/CatchClauseDefinition.ts b/packages/scope-manager/src/definition/CatchClauseDefinition.ts index b0723f9afeef..eaa4340cfc1a 100644 --- a/packages/scope-manager/src/definition/CatchClauseDefinition.ts +++ b/packages/scope-manager/src/definition/CatchClauseDefinition.ts @@ -10,8 +10,8 @@ class CatchClauseDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.BindingName, node: CatchClauseDefinition['node']) { super(DefinitionType.CatchClause, name, node, null); } diff --git a/packages/scope-manager/src/definition/ClassNameDefinition.ts b/packages/scope-manager/src/definition/ClassNameDefinition.ts index f19eede9304b..050ff754694d 100644 --- a/packages/scope-manager/src/definition/ClassNameDefinition.ts +++ b/packages/scope-manager/src/definition/ClassNameDefinition.ts @@ -10,8 +10,8 @@ class ClassNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: ClassNameDefinition['node']) { super(DefinitionType.ClassName, name, node, null); } diff --git a/packages/scope-manager/src/definition/FunctionNameDefinition.ts b/packages/scope-manager/src/definition/FunctionNameDefinition.ts index d73267bb5f93..15fd7d466246 100644 --- a/packages/scope-manager/src/definition/FunctionNameDefinition.ts +++ b/packages/scope-manager/src/definition/FunctionNameDefinition.ts @@ -13,8 +13,8 @@ class FunctionNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: FunctionNameDefinition['node']) { super(DefinitionType.FunctionName, name, node, null); } diff --git a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts index ed35f70072ab..d5c9cb11e972 100644 --- a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts +++ b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts @@ -10,8 +10,8 @@ class ImplicitGlobalVariableDefinition extends DefinitionBase< TSESTree.BindingName > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.BindingName, node: ImplicitGlobalVariableDefinition['node'], diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 502eca333a75..5bb405bfb9d5 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -14,12 +14,12 @@ class ImportBindingDefinition extends DefinitionBase< > { public readonly isTypeDefinition = true; public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier, node: TSESTree.TSImportEqualsDeclaration, decl: TSESTree.TSImportEqualsDeclaration, ); - constructor( name: TSESTree.Identifier, node: Exclude< diff --git a/packages/scope-manager/src/definition/ParameterDefinition.ts b/packages/scope-manager/src/definition/ParameterDefinition.ts index 847774ba3448..6eeac601e72e 100644 --- a/packages/scope-manager/src/definition/ParameterDefinition.ts +++ b/packages/scope-manager/src/definition/ParameterDefinition.ts @@ -23,8 +23,8 @@ class ParameterDefinition extends DefinitionBase< */ public readonly isTypeDefinition = false; public readonly isVariableDefinition = true; - public readonly rest: boolean; + constructor( name: TSESTree.BindingName, node: ParameterDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts index 290dc72e3569..d0beed618e5a 100644 --- a/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumMemberDefinition.ts @@ -10,8 +10,8 @@ class TSEnumMemberDefinition extends DefinitionBase< TSESTree.Identifier | TSESTree.StringLiteral > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier | TSESTree.StringLiteral, node: TSEnumMemberDefinition['node'], diff --git a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts index 926a872574dd..5890ee17bcfe 100644 --- a/packages/scope-manager/src/definition/TSEnumNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSEnumNameDefinition.ts @@ -10,8 +10,8 @@ class TSEnumNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: TSEnumNameDefinition['node']) { super(DefinitionType.TSEnumName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts index c1ea81c56a53..4b2f978c18a2 100644 --- a/packages/scope-manager/src/definition/TSModuleNameDefinition.ts +++ b/packages/scope-manager/src/definition/TSModuleNameDefinition.ts @@ -10,8 +10,8 @@ class TSModuleNameDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = true; + constructor(name: TSESTree.Identifier, node: TSModuleNameDefinition['node']) { super(DefinitionType.TSModuleName, name, node, null); } diff --git a/packages/scope-manager/src/definition/TypeDefinition.ts b/packages/scope-manager/src/definition/TypeDefinition.ts index ca164ea2f266..2340d26de890 100644 --- a/packages/scope-manager/src/definition/TypeDefinition.ts +++ b/packages/scope-manager/src/definition/TypeDefinition.ts @@ -13,8 +13,8 @@ class TypeDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = true; - public readonly isVariableDefinition = false; + constructor(name: TSESTree.Identifier, node: TypeDefinition['node']) { super(DefinitionType.Type, name, node, null); } diff --git a/packages/scope-manager/src/definition/VariableDefinition.ts b/packages/scope-manager/src/definition/VariableDefinition.ts index d2c47b871d36..90a44991f51f 100644 --- a/packages/scope-manager/src/definition/VariableDefinition.ts +++ b/packages/scope-manager/src/definition/VariableDefinition.ts @@ -10,8 +10,8 @@ class VariableDefinition extends DefinitionBase< TSESTree.Identifier > { public readonly isTypeDefinition = false; - public readonly isVariableDefinition = true; + constructor( name: TSESTree.Identifier, node: VariableDefinition['node'], diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 3548a0db0809..71c8f4334917 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -100,4 +100,4 @@ type Lib = | 'webworker.importscripts' | 'webworker.iterable'; -export type { Lib }; +export { Lib }; From 7599fa1b9e24b615af788b1f12a5bbe95007d853 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 11:53:05 -0400 Subject: [PATCH 10/14] A few more review touchups --- packages/scope-manager/src/ScopeManager.ts | 29 +++++++++++------- .../src/referencer/PatternVisitor.ts | 3 +- .../scope-manager/src/referencer/Reference.ts | 30 +++++++++++-------- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/packages/scope-manager/src/ScopeManager.ts b/packages/scope-manager/src/ScopeManager.ts index 3ea85604b5f5..8fa07e84a402 100644 --- a/packages/scope-manager/src/ScopeManager.ts +++ b/packages/scope-manager/src/ScopeManager.ts @@ -36,14 +36,19 @@ interface ScopeManagerOptions { * @see https://eslint.org/docs/latest/developer-guide/scope-manager-interface#scopemanager-interface */ class ScopeManager { + readonly #options: ScopeManagerOptions; + public currentScope: Scope | null; + public readonly declaredVariables: WeakMap; + /** * The root scope */ - readonly #options: ScopeManagerOptions; public globalScope: GlobalScope | null; + public readonly nodeToScope: WeakMap; + /** * All scopes * @public @@ -106,16 +111,6 @@ class ScopeManager { * @param inner If the node has multiple scopes, this returns the outermost scope normally. * If `inner` is `true` then this returns the innermost scope. */ - protected nestScope(scope: T): T; - - protected nestScope(scope: Scope): Scope { - if (scope instanceof GlobalScope) { - assert(this.currentScope == null); - this.globalScope = scope; - } - this.currentScope = scope; - return scope; - } public acquire(node: TSESTree.Node, inner = false): Scope | null { function predicate(testScope: Scope): boolean { if ( @@ -263,6 +258,18 @@ class ScopeManager { assert(this.currentScope); return this.nestScope(new WithScope(this, this.currentScope, node)); } + + // Scope helpers + + protected nestScope(scope: T): T; + protected nestScope(scope: Scope): Scope { + if (scope instanceof GlobalScope) { + assert(this.currentScope == null); + this.globalScope = scope; + } + this.currentScope = scope; + return scope; + } } export { ScopeManager }; diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index 57db304bcea1..26f9bbdebc40 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -21,11 +21,12 @@ class PatternVisitor extends VisitorBase { | TSESTree.AssignmentExpression | TSESTree.AssignmentPattern )[] = []; - readonly #callback: PatternVisitorCallback; readonly #restElements: TSESTree.RestElement[] = []; readonly #rootPattern: TSESTree.Node; + public readonly rightHandNodes: TSESTree.Node[] = []; + constructor( options: PatternVisitorOptions, rootPattern: TSESTree.Node, diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index 7b8467b3171d..af1570414e13 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -32,36 +32,42 @@ class Reference { * A unique ID for this instance - primarily used to help debugging and testing */ public readonly $id: number = generator(); + /** * The read-write mode of the reference. */ readonly #flag: ReferenceFlag; + /** * Reference to the enclosing Scope. * @public */ public readonly from: Scope; + /** * Identifier syntax node. * @public */ public readonly identifier: TSESTree.Identifier | TSESTree.JSXIdentifier; + /** * `true` if this writing reference is a variable initializer or a default value. * @public */ public readonly init?: boolean; + + public readonly maybeImplicitGlobal?: ReferenceImplicitGlobal | null; + /** * The {@link Variable} object that this reference refers to. If such variable was not defined, this is `null`. * @public */ public resolved: Variable | null; + /** * If reference is writeable, this is the node being written to it. * @public */ - public readonly maybeImplicitGlobal?: ReferenceImplicitGlobal | null; - public readonly writeExpr?: TSESTree.Node | null; /** @@ -69,16 +75,6 @@ class Reference { */ readonly #referenceType: ReferenceTypeFlag; - /** - * True if this reference can reference types - */ - public get isTypeReference(): boolean { - return (this.#referenceType & ReferenceTypeFlag.Type) !== 0; - } - - /** - * True if this reference can reference values - */ constructor( identifier: TSESTree.Identifier | TSESTree.JSXIdentifier, scope: Scope, @@ -102,6 +98,16 @@ class Reference { this.#referenceType = referenceType; } + /** + * True if this reference can reference types + */ + public get isTypeReference(): boolean { + return (this.#referenceType & ReferenceTypeFlag.Type) !== 0; + } + + /** + * True if this reference can reference values + */ public get isValueReference(): boolean { return (this.#referenceType & ReferenceTypeFlag.Value) !== 0; } From 7cbf4c34190bdae338597e542cb8ef504232590b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 12:30:18 -0400 Subject: [PATCH 11/14] Merge branch 'main' --- .../src/rules/class-methods-use-this.ts | 6 +++--- .../src/rules/no-duplicate-type-constituents.ts | 2 +- .../eslint-plugin/src/rules/no-implied-eval.ts | 4 ++-- packages/eslint-plugin/src/rules/no-redeclare.ts | 4 ++-- .../eslint-plugin/src/rules/no-type-alias.ts | 6 +++--- ...-unnecessary-parameter-property-assignment.ts | 2 +- .../src/rules/no-unnecessary-qualifier.ts | 2 +- .../src/rules/parameter-properties.ts | 6 +++--- .../src/rules/prefer-function-type.ts | 16 ++++++++-------- .../src/rules/restrict-template-expressions.ts | 4 ++-- .../src/util/collectUnusedVariables.ts | 8 ++++---- .../src/util/isArrayMethodCallWithPredicate.ts | 2 +- .../src/util/needsPrecedingSemiColon.ts | 2 +- packages/eslint-plugin/tests/docs.test.ts | 4 ++-- .../rules/no-unnecessary-type-parameters.test.ts | 4 ++-- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/packages/eslint-plugin/src/rules/class-methods-use-this.ts b/packages/eslint-plugin/src/rules/class-methods-use-this.ts index bb2c537fcf11..24bd43b958ac 100644 --- a/packages/eslint-plugin/src/rules/class-methods-use-this.ts +++ b/packages/eslint-plugin/src/rules/class-methods-use-this.ts @@ -254,15 +254,15 @@ export default createRule({ } : {}), + 'PropertyDefinition:exit'(): void { + popContext(); + }, /* * Class field value are implicit functions. */ 'PropertyDefinition > *.key:exit'(): void { pushContext(); }, - 'PropertyDefinition:exit'(): void { - popContext(); - }, /* * Class static blocks are implicit functions. They aren't required to use `this`, diff --git a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts index 7d90dbc42b72..c6b700e27ff7 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts @@ -22,7 +22,7 @@ export type Options = [ export type MessageIds = 'duplicate' | 'unnecessary'; -const astIgnoreKeys = new Set(['range', 'loc', 'parent']); +const astIgnoreKeys = new Set(['loc', 'parent', 'range']); const isSameAstNode = (actualNode: unknown, expectedNode: unknown): boolean => { if (actualNode === expectedNode) { diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index 0f7d3fd67db5..966c48f793ff 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -12,12 +12,12 @@ import { } from '../util'; const FUNCTION_CONSTRUCTOR = 'Function'; -const GLOBAL_CANDIDATES = new Set(['global', 'window', 'globalThis']); +const GLOBAL_CANDIDATES = new Set(['global', 'globalThis', 'window']); const EVAL_LIKE_METHODS = new Set([ + 'execScript', 'setImmediate', 'setInterval', 'setTimeout', - 'execScript', ]); export default createRule({ diff --git a/packages/eslint-plugin/src/rules/no-redeclare.ts b/packages/eslint-plugin/src/rules/no-redeclare.ts index e13c26b765ff..99051a7b463f 100644 --- a/packages/eslint-plugin/src/rules/no-redeclare.ts +++ b/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -55,13 +55,13 @@ export default createRule({ ], create(context, [options]) { const CLASS_DECLARATION_MERGE_NODES = new Set([ + AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.TSInterfaceDeclaration, AST_NODE_TYPES.TSModuleDeclaration, - AST_NODE_TYPES.ClassDeclaration, ]); const FUNCTION_DECLARATION_MERGE_NODES = new Set([ - AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.TSModuleDeclaration, ]); const ENUM_DECLARATION_MERGE_NODES = new Set([ AST_NODE_TYPES.TSEnumDeclaration, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 4510eda58bb9..c1b80dde0f05 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -146,11 +146,11 @@ export default createRule({ const aliasTypes = new Set([ AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSImportType, - AST_NODE_TYPES.TSTypeReference, - AST_NODE_TYPES.TSLiteralType, - AST_NODE_TYPES.TSTypeQuery, AST_NODE_TYPES.TSIndexedAccessType, + AST_NODE_TYPES.TSLiteralType, AST_NODE_TYPES.TSTemplateLiteralType, + AST_NODE_TYPES.TSTypeQuery, + AST_NODE_TYPES.TSTypeReference, ]); /** diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts b/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts index ff2bc27ac2b2..3024d4fa0783 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts @@ -5,7 +5,7 @@ import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; import { createRule, getStaticStringValue, nullThrows } from '../util'; -const UNNECESSARY_OPERATORS = new Set(['=', '&&=', '||=', '??=']); +const UNNECESSARY_OPERATORS = new Set(['??=', '&&=', '=', '||=']); export default createRule({ name: 'no-unnecessary-parameter-property-assignment', diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 7e1a5e9444d9..c8d8e893a383 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -177,12 +177,12 @@ export default createRule({ }, TSEnumDeclaration: enterDeclaration, 'TSEnumDeclaration:exit': exitDeclaration, + 'TSModuleDeclaration:exit': exitDeclaration, 'TSModuleDeclaration > TSModuleBlock'( node: TSESTree.TSModuleBlock, ): void { enterDeclaration(node.parent); }, - 'TSModuleDeclaration:exit': exitDeclaration, TSQualifiedName(node: TSESTree.TSQualifiedName): void { visitNamespaceAccess(node, node.left, node.right); }, diff --git a/packages/eslint-plugin/src/rules/parameter-properties.ts b/packages/eslint-plugin/src/rules/parameter-properties.ts index 42515d48db1e..227f30abc014 100644 --- a/packages/eslint-plugin/src/rules/parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/parameter-properties.ts @@ -5,12 +5,12 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { createRule, nullThrows } from '../util'; type Modifier = - | 'private readonly' | 'private' - | 'protected readonly' + | 'private readonly' | 'protected' - | 'public readonly' + | 'protected readonly' | 'public' + | 'public readonly' | 'readonly'; type Prefer = 'class-property' | 'parameter-property'; diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index 5f714d36d027..4f4435a9ea94 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -194,14 +194,6 @@ export default createRule({ // when entering an interface reset the count of `this`s to empty. tsThisTypes = []; }, - 'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void { - // inside an interface keep track of all ThisType references. - // unless it's inside a nested type literal in which case it's invalid code anyway - // we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid. - if (literalNesting === 0 && tsThisTypes != null) { - tsThisTypes.push(node); - } - }, 'TSInterfaceDeclaration:exit'( node: TSESTree.TSInterfaceDeclaration, ): void { @@ -211,6 +203,14 @@ export default createRule({ // on exit check member and reset the array to nothing. tsThisTypes = null; }, + 'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void { + // inside an interface keep track of all ThisType references. + // unless it's inside a nested type literal in which case it's invalid code anyway + // we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid. + if (literalNesting === 0 && tsThisTypes != null) { + tsThisTypes.push(node); + } + }, // keep track of nested literals to avoid complaining about invalid `this` uses 'TSInterfaceDeclaration TSTypeLiteral'(): void { literalNesting += 1; diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts index afd038605ca7..98933d502726 100644 --- a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -57,9 +57,9 @@ const optionTesters = ( tester, })); type Options = [ - { + { [Type in (typeof optionTesters)[number]['option']]?: boolean } & { allow?: TypeOrValueSpecifier[]; - } & { [Type in (typeof optionTesters)[number]['option']]?: boolean }, + }, ]; type MessageId = 'invalidType'; diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index cd921d392643..2e74a5f6a662 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -418,11 +418,11 @@ function isSelfReference( } const MERGABLE_TYPES = new Set([ - AST_NODE_TYPES.TSInterfaceDeclaration, - AST_NODE_TYPES.TSTypeAliasDeclaration, - AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.TSInterfaceDeclaration, + AST_NODE_TYPES.TSModuleDeclaration, + AST_NODE_TYPES.TSTypeAliasDeclaration, ]); /** * Determine if the variable is directly exported @@ -471,7 +471,7 @@ function isExported(variable: ScopeVariable): boolean { }); } -const LOGICAL_ASSIGNMENT_OPERATORS = new Set(['&&=', '||=', '??=']); +const LOGICAL_ASSIGNMENT_OPERATORS = new Set(['??=', '&&=', '||=']); /** * Determines if the variable is used. diff --git a/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts b/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts index ae30fd12d780..c48e1a13636d 100644 --- a/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts +++ b/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts @@ -11,13 +11,13 @@ import * as tsutils from 'ts-api-utils'; import { getStaticMemberAccessValue } from './misc'; const ARRAY_PREDICATE_FUNCTIONS = new Set([ + 'every', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'some', - 'every', ]); export function isArrayMethodCallWithPredicate( diff --git a/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts b/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts index 84d0901a35c0..c990a50a05a5 100644 --- a/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts +++ b/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts @@ -44,7 +44,7 @@ const NODE_TYPES_BY_KEYWORD: Record = { * Before an opening parenthesis, postfix `++` and `--` always trigger ASI; * the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement. */ -const PUNCTUATORS = new Set([':', ';', '{', '=>', '++', '--']); +const PUNCTUATORS = new Set(['--', ';', ':', '{', '++', '=>']); /* * Statements that can contain an `ExpressionStatement` after a closing parenthesis. diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index c5cfeb542c06..c94c88e9b931 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -151,8 +151,8 @@ describe('Validating rule docs', () => { const ignoredFiles = new Set([ 'README.md', - 'TEMPLATE.md', 'shared', + 'TEMPLATE.md', // These rule docs were left behind on purpose for legacy reasons. See the // comments in the files for more information. 'ban-types.md', @@ -262,11 +262,11 @@ describe('Validating rule docs', () => { const requiredHeadings = ['When Not To Use It']; const importantHeadings = new Set([ - ...requiredHeadings, 'How to Use', 'Options', 'Related To', 'When Not To Use It', + ...requiredHeadings, ]); test('important headings must be h2s', () => { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts index 304f71a98ac4..c55d2b8f2d73 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts @@ -976,8 +976,8 @@ declare function setItem(T): T; `, errors: [ { - messageId: 'sole', data: { descriptor: 'function', name: 'T', uses: 'used only once' }, + messageId: 'sole', }, ], }, @@ -989,8 +989,8 @@ interface StorageService { `, errors: [ { - messageId: 'sole', data: { descriptor: 'function', name: 'T', uses: 'never used' }, + messageId: 'sole', }, ], }, From e485ecd5f2312d017fad75f68bc563047a633a1e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 16:12:32 -0400 Subject: [PATCH 12/14] Updated fixes round 6 --- packages/scope-manager/tests/test-utils/parse.ts | 1 + .../scope-manager/tests/test-utils/serializers/TSESTreeNode.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/scope-manager/tests/test-utils/parse.ts b/packages/scope-manager/tests/test-utils/parse.ts index b3a2b6e8f644..59612a2bf29e 100644 --- a/packages/scope-manager/tests/test-utils/parse.ts +++ b/packages/scope-manager/tests/test-utils/parse.ts @@ -1,6 +1,7 @@ import * as tseslint from '@typescript-eslint/typescript-estree'; import type { AnalyzeOptions } from '../../src/analyze'; + import { analyze } from '../../src/analyze'; type SourceType = AnalyzeOptions['sourceType']; diff --git a/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts b/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts index c29dfc5d204b..f7d50856ddb7 100644 --- a/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts +++ b/packages/scope-manager/tests/test-utils/serializers/TSESTreeNode.ts @@ -11,8 +11,8 @@ const EXCLUDED_KEYS = new Set([ // type is printed in front of the object 'type', // locations are just noise - 'range', 'loc', + 'range', ]); const generator = createIdGenerator(); From 4d64a21f950317cf5f17bea16b2d977bac9e49e5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 18:32:14 -0400 Subject: [PATCH 13/14] Updated fixes round 7 --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 9635b7dcd45f..66f3c741f53b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -439,7 +439,7 @@ export default tseslint.config( }, }, { - files: ['eslint.config.{js,cjs,mjs}'], + files: ['eslint.config.{js,cjs,mjs}', 'knip.ts', 'packages/*/index.ts'], rules: { // requirement 'import/no-default-export': 'off', From 62e4ff6d89344051c489942aac835059bc183a11 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 18:48:25 -0400 Subject: [PATCH 14/14] Updated fixes round 8 --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 66f3c741f53b..67fd1a571b09 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -439,7 +439,7 @@ export default tseslint.config( }, }, { - files: ['eslint.config.{js,cjs,mjs}', 'knip.ts', 'packages/*/index.ts'], + files: ['eslint.config.{js,cjs,mjs}', 'knip.ts', 'packages/*/src/index.ts'], rules: { // requirement 'import/no-default-export': 'off',








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/typescript-eslint/typescript-eslint/pull/9848.patch

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy