@typescript-eslint/scope-manager
Advanced tools
Comparing version 4.0.2-alpha.18 to 4.0.2-alpha.19
@@ -11,2 +11,4 @@ import { TSESTree } from '@typescript-eslint/types'; | ||
import { Variable } from '../variable'; | ||
import { TSModuleScope } from './TSModuleScope'; | ||
declare type VariableScope = GlobalScope | FunctionScope | ModuleScope | TSModuleScope; | ||
declare abstract class ScopeBase<TType extends ScopeType, TBlock extends TSESTree.Node, TUpper extends Scope | null> { | ||
@@ -80,8 +82,9 @@ #private; | ||
/** | ||
* For 'global', 'function', and 'module' scopes, this is a self-reference. | ||
* For scopes that can contain variable declarations, this is a self-reference. | ||
* For other scope types this is the *variableScope* value of the parent scope. | ||
* @public | ||
*/ | ||
readonly variableScope: GlobalScope | FunctionScope | ModuleScope; | ||
readonly variableScope: VariableScope; | ||
constructor(scopeManager: ScopeManager, type: TType, upperScope: TUpper, block: TBlock, isMethodDefinition: boolean); | ||
private isVariableScope; | ||
shouldStaticallyClose(): boolean; | ||
@@ -88,0 +91,0 @@ private shouldStaticallyCloseForGlobal; |
@@ -114,2 +114,8 @@ "use strict"; | ||
const generator = ID_1.createIdGenerator(); | ||
const VARIABLE_SCOPE_TYPES = new Set([ | ||
ScopeType_1.ScopeType.global, | ||
ScopeType_1.ScopeType.function, | ||
ScopeType_1.ScopeType.module, | ||
ScopeType_1.ScopeType.tsModule, | ||
]); | ||
class ScopeBase { | ||
@@ -220,8 +226,5 @@ constructor(scopeManager, type, upperScope, block, isMethodDefinition) { | ||
this.block = block; | ||
this.variableScope = | ||
this.type === 'global' || | ||
this.type === 'function' || | ||
this.type === 'module' | ||
? this | ||
: upperScopeAsScopeBase.variableScope; | ||
this.variableScope = this.isVariableScope() | ||
? this | ||
: upperScopeAsScopeBase.variableScope; | ||
this.upper = upperScope; | ||
@@ -240,2 +243,5 @@ /** | ||
} | ||
isVariableScope() { | ||
return VARIABLE_SCOPE_TYPES.has(this.type); | ||
} | ||
shouldStaticallyClose() { | ||
@@ -242,0 +248,0 @@ return !__classPrivateFieldGet(this, _dynamic); |
{ | ||
"name": "@typescript-eslint/scope-manager", | ||
"version": "4.0.2-alpha.18+2ada5aff", | ||
"version": "4.0.2-alpha.19+3d07a99f", | ||
"description": "TypeScript scope analyser for ESLint", | ||
@@ -42,8 +42,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@typescript-eslint/types": "4.0.2-alpha.18+2ada5aff", | ||
"@typescript-eslint/visitor-keys": "4.0.2-alpha.18+2ada5aff" | ||
"@typescript-eslint/types": "4.0.2-alpha.19+3d07a99f", | ||
"@typescript-eslint/visitor-keys": "4.0.2-alpha.19+3d07a99f" | ||
}, | ||
"devDependencies": { | ||
"@types/glob": "*", | ||
"@typescript-eslint/typescript-estree": "4.0.2-alpha.18+2ada5aff", | ||
"@typescript-eslint/typescript-estree": "4.0.2-alpha.19+3d07a99f", | ||
"glob": "*", | ||
@@ -68,3 +68,3 @@ "jest-specific-snapshot": "*", | ||
}, | ||
"gitHead": "2ada5aff1ef37bc260d7a0eaafe9ff04f8a08fe4" | ||
"gitHead": "3d07a99faa0a5fc1b44acdb43ddbfc90a5105833" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
947390
16778