ScopeManager

This document was written based on the implementation of eslint-scope, a fork of escope, and deprecates some members ESLint is not using.


ScopeManager interface

ScopeManager object has all variable scopes.

Fields

scopes

globalScope

Methods

acquire(node, inner = false)

getDeclaredVariables(node)

Deprecated members

Those members are defined but not used in ESLint.

isModule()

isImpliedStrict()

isStrictModeSupported()

acquireAll(node)


Scope interface

Scope object has all variables and references in the scope.

Fields

type

isStrict

upper

childScopes

variableScope

This 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 name variableScope.

block

variables

set

I hope to rename set field or replace by a method.

references

through

functionExpressionScope

I hope to deprecate functionExpressionScope field as replacing by scope.type === "function-expression-name".

Deprecated members

Those members are defined but not used in ESLint.

taints

dynamic

directCallToEvalScope

thisFound

resolve(node)

isStatic()

isArgumentsMaterialized()

isThisMaterialized()

isUsedName(name)


Variable interface

Variable object is variable's information.

Fields

name

scope

identifiers

I hope to deprecate identifiers field as replacing by defs[].name field.

references

defs

Deprecated members

Those members are defined but not used in ESLint.

tainted

stack


Reference interface

Reference object is reference's information.

Fields

identifier

from

resolved

writeExpr

init

Methods

isWrite()

isRead()

isWriteOnly()

isReadOnly()

isReadWrite()

Deprecated members

Those members are defined but not used in ESLint.

tainted

flag

partial

isStatic()


Definition interface

Definition object is variable definition's information.

Fields

type

name

node

typenode
"CatchClause"CatchClause
"ClassName"ClassDeclaration or ClassExpression
"FunctionName"FunctionDeclaration or FunctionExpression
"ImplicitGlobalVariable"Program
"ImportBinding"ImportSpecifier, ImportDefaultSpecifier, or ImportNamespaceSpecifier
"Parameter"FunctionDeclaration, FunctionExpression, or ArrowFunctionExpression
"Variable"VariableDeclarator

parent

typeparent
"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.

index

kind