You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/eslint-scope/README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ In order to analyze scope, you'll need to have an [ESTree](https://github.com/es
37
37
*`sourceType` (default: `"script"`) - The type of JavaScript file to evaluate. Change to `"module"` for ECMAScript module code.
38
38
*`childVisitorKeys` (default: `null`) - An object with visitor key information (like [`eslint-visitor-keys`](https://github.com/eslint/js/tree/main/packages/eslint-visitor-keys)). Without this, `eslint-scope` finds child nodes to visit algorithmically. Providing this option is a performance enhancement.
39
39
*`fallback` (default: `"iteration"`) - The strategy to use when `childVisitorKeys` is not specified. May be a function.
40
+
*`optimistic` (default: `false`) - Set to `true` to enable optimistic scope analysis.
40
41
*`jsx` (default: `false`) - Enables the tracking of JSX components as variable references.
41
42
42
43
Example:
@@ -100,7 +101,7 @@ The `ScopeManager` class is at the core of eslint-scope and is returned when you
100
101
-`inner` - Optional boolean. When `true`, returns the innermost scope, otherwise returns the outermost scope. Default is `false`.
101
102
- Returns: The acquired scope or `null` if no scope is found.
102
103
103
-
-**`acquireAll(node)`**
104
+
-**`acquireAll(node)` (Deprecated)**
104
105
Acquires all scopes for a given node.
105
106
-`node` - The AST node to acquire scopes from.
106
107
- Returns: An array of scopes or `undefined` if none are found.
@@ -120,27 +121,29 @@ The `ScopeManager` class is at the core of eslint-scope and is returned when you
120
121
Determines if the global return statement should be allowed.
121
122
- Returns: `true` if the global return is enabled.
122
123
123
-
-**`isModule()`**
124
+
-**`isModule()` (Deprecated)**
124
125
Checks if the code should be handled as an ECMAScript module.
125
126
- Returns: `true` if the sourceType is "module".
126
127
127
-
-**`isImpliedStrict()`**
128
+
-**`isImpliedStrict()` (Deprecated)**
128
129
Checks if implied strict mode is enabled.
129
130
- Returns: `true` if implied strict mode is enabled.
130
131
131
-
-**`isStrictModeSupported()`**
132
+
-**`isStrictModeSupported()` (Deprecated)**
132
133
Checks if strict mode is supported based on ECMAScript version.
133
134
- Returns: `true` if the ECMAScript version supports strict mode.
134
135
135
136
### Scope Objects
136
137
137
138
Scopes returned by the ScopeManager methods have the following properties:
138
139
139
-
-`type` - The type of scope (e.g., "function", "block", "global").
140
+
-`type` - The type of scope (e.g., `"function"`, `"block"`, `"global"`).
141
+
-`isStrict` - `true` if this scope is in strict mode.
140
142
-`variables` - Array of variables declared in this scope.
141
143
-`set` - A Map of variable names to Variable objects for variables declared in this scope.
142
144
-`references` - Array of references in this scope.
143
145
-`through` - Array of references in this scope and its child scopes that aren't resolved in this scope or its child scopes.
146
+
-`functionExpressionScope` - `true` if this is a `"function-expression-name"` scope.
144
147
-`variableScope` - Reference to the closest variable scope.
0 commit comments