This document was written based on the implementation of eslint-scope, a fork of escope, and deprecates some members ESLint is not using.
ScopeManager interfaceScopeManager
object has all variable scopes.
Scope[]
Scope
node
(ASTNode
) … An AST node to get their scope.inner
(boolean
) … If the node has multiple scope, this returns the outermost scope normally. If inner
is true
then this returns the innermost scope. Default is false
.Scope | null
block
property is the node. This method never returns function-expression-name
scope. If the node does not have their scope, this returns null
.node
(ASTNode
) … An AST node to get their variables.Variable[]
def[].node
/def[].parent
property is the node. If the node does not define any variable, this returns an empty array.Those members are defined but not used in ESLint.
isModule()boolean
true
if this program is module.boolean
true
if this program is strict mode implicitly. I.e., options.impliedStrict === true
.boolean
true
if this program supports strict mode. I.e., options.ecmaVersion >= 5
.node
(ASTNode
) … An AST node to get their scope.Scope[] | null
block
property is the node. If the node does not have their scope, this returns null
.Scope
object has all variables and references in the scope.
string
"block"
, "catch"
, "class"
, "class-field-initializer"
, "class-static-block"
, "for"
, "function"
, "function-expression-name"
, "global"
, "module"
, "switch"
, "with"
.boolean
true
if this scope is strict mode.Scope | null
null
.Scope[]
Scope
type
is one of "class-field-initializer"
, "class-static-block"
, "function"
, "global"
, or "module"
. For the aforementioned scopes this is a self-reference.blockThis represents the lowest enclosing function or top-level scope. Class field initializers and class static blocks are implicit functions. Historically, this was the scope which hosts variables that are defined by
var
declarations, and thus the namevariableScope
.
ASTNode
Variable[]
Map<string, Variable>
Reference[]
Reference[]
boolean
true
if this scope is "function-expression-name"
scope.This field exists only in the root Scope
object (the global scope). It provides information about implicit global variables. Implicit global variables are variables that are neither built-in nor explicitly declared, but created implicitly by assigning values to undeclared variables in non-strict code. Variable
objects for these variables are not present in the root Scope
object’s fields variables
and set
.
The value of the implicit
field is an object with two properties.
Variable[]
Map<string, Variable>
In Variable
objects that represent implicit global variables, references
is always an empty array. You can find references to these variables in the through
field of the root Scope
object (the global scope), among other unresolved references.
Those members are defined but not used in ESLint.
taintsMap<string, boolean>
tainted
flag.boolean
true
if this scope is dynamic. I.e., the type of this scope is "global"
or "with"
.boolean
true
if this scope contains eval()
invocations.boolean
true
if this scope contains this
.node
(ASTNode
) … An AST node to get their reference object. The type of the node must be "Identifier"
.Reference | null
this.references.find(r => r.identifier === node)
.boolean
!this.dynamic
.boolean
true
if this is a "function"
scope which has used arguments
variable.boolean
this.thisFound
.name
(string
) … The name to check.boolean
true
if a given name is used in variable names or reference names.Variable
object is variable’s information.
string
Scope
ASTNode[]
Identifier
nodes which define this variable. If this variable is redeclared, this array includes two or more nodes.Reference[]
Definition[]
Those members are defined but not used in ESLint.
taintedboolean
tainted
flag. (always false
)boolean
stack
flag. (I’m not sure what this means.)Reference
object is reference’s information.
ASTNode
Identifier
node of this reference.Scope
Scope
object that this reference is on.Variable | null
Variable
object that this reference refers. If such variable was not defined, this is null
.ASTNode | null
boolean
true
if this writing reference is a variable initializer or a default value.boolean
true
if this reference is writing.boolean
true
if this reference is reading.boolean
true
if this reference is writing but not reading.boolean
true
if this reference is reading but not writing.boolean
true
if this reference is reading and writing.Those members are defined but not used in ESLint.
taintedboolean
tainted
flag. (always false
)number
1
is reading, 2
is writing, 3
is reading/writing.boolean
partial
flag.boolean
true
if this reference is resolved statically.Definition
object is variable definition’s information.
string
"CatchClause"
, "ClassName"
, "FunctionName"
, "ImplicitGlobalVariable"
, "ImportBinding"
, "Parameter"
, and "Variable"
.ASTNode
Identifier
node of this definition.ASTNode
"CatchClause"
CatchClause
"ClassName"
ClassDeclaration
or ClassExpression
"FunctionName"
FunctionDeclaration
or FunctionExpression
"ImplicitGlobalVariable"
AssignmentExpression
or ForInStatement
or ForOfStatement
"ImportBinding"
ImportSpecifier
, ImportDefaultSpecifier
, or ImportNamespaceSpecifier
"Parameter"
FunctionDeclaration
, FunctionExpression
, or ArrowFunctionExpression
"Variable"
VariableDeclarator
parent
ASTNode | undefined | null
"CatchClause"
null
"ClassName"
null
"FunctionName"
null
"ImplicitGlobalVariable"
null
"ImportBinding"
ImportDeclaration
"Parameter"
null
"Variable"
VariableDeclaration
Deprecated members
Those members are defined but not used in ESLint.
indexnumber | undefined | null
string | undefined | null
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4