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

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

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

关注前端布道师,专注分享前端最新技术、大厂面试题、聊点程序员轶事、职场感情,做前端技术的传播者.

关注 前端布道师

热爱前端开发,专注分享前端最新技术、大厂面试题、聊点程序员轶事、职场感悟,做前端技术的传播者

LeetCode题解 | 每日一题