Skip to content

Commit e9129e0

Browse files
mdjermanovicnzakas
andauthored
docs: add global scope's implicit field to Scope Manager docs (#19770)
* docs: add global scope's `implicit` field to Scope Manager docs * Update docs/src/extend/scope-manager-interface.md Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com> --------- Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
1 parent bc3c331 commit e9129e0

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/src/extend/scope-manager-interface.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,26 @@ Those members are defined but not used in ESLint.
133133
- **Type:** `boolean`
134134
- **Description:** `true` if this scope is `"function-expression-name"` scope.
135135

136+
#### implicit
137+
138+
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`.
139+
140+
The value of the `implicit` field is an object with two properties.
141+
142+
##### variables
143+
144+
- **Type:** `Variable[]`
145+
- **Description:** The array of all implicit global variables.
146+
147+
##### set
148+
149+
- **Type:** `Map<string, Variable>`
150+
- **Description:** The map from variable names to variable objects for implicit global variables.
151+
152+
::: tip
153+
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.
154+
:::
155+
136156
### Deprecated members
137157

138158
Those members are defined but not used in ESLint.
@@ -354,7 +374,7 @@ Those members are defined but not used in ESLint.
354374
| `"CatchClause"` | `CatchClause` |
355375
| `"ClassName"` | `ClassDeclaration` or `ClassExpression` |
356376
| `"FunctionName"` | `FunctionDeclaration` or `FunctionExpression` |
357-
| `"ImplicitGlobalVariable"` | `Program` |
377+
| `"ImplicitGlobalVariable"` | `AssignmentExpression` |
358378
| `"ImportBinding"` | `ImportSpecifier`, `ImportDefaultSpecifier`, or `ImportNamespaceSpecifier` |
359379
| `"Parameter"` | `FunctionDeclaration`, `FunctionExpression`, or `ArrowFunctionExpression` |
360380
| `"Variable"` | `VariableDeclarator` |

0 commit comments

Comments
 (0)