@@ -38,8 +38,14 @@ import {
3838} from "./scope.js" ;
3939import { assert } from "./assert.js" ;
4040
41+ /** @import * as types from "eslint-scope" */
42+ /** @import ESTree from "estree" */
43+ /** @import { Scope } from "./scope.js" */
44+ /** @import Variable from "./variable.js" */
45+
4146/**
4247 * @constructor ScopeManager
48+ * @implements {types.ScopeManager}
4349 */
4450class ScopeManager {
4551 constructor ( options ) {
@@ -72,10 +78,12 @@ class ScopeManager {
7278 }
7379
7480 isImpliedStrict ( ) {
75- return this . __options . impliedStrict ;
81+ return ! ! this . __options . impliedStrict ;
7682 }
7783
7884 isStrictModeSupported ( ) {
85+
86+ // @ts -ignore -- if ecmaVersion is undefined, the comparison returns false.
7987 return this . __options . ecmaVersion >= 5 ;
8088 }
8189
@@ -90,7 +98,7 @@ class ScopeManager {
9098 * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
9199 * If the node declares nothing, this method returns an empty array.
92100 * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
93- * @param {Espree .Node } node a node to get.
101+ * @param {ESTree .Node } node a node to get.
94102 * @returns {Variable[] } variables that declared by the node.
95103 */
96104 getDeclaredVariables ( node ) {
@@ -100,7 +108,7 @@ class ScopeManager {
100108 /**
101109 * acquire scope from node.
102110 * @function ScopeManager#acquire
103- * @param {Espree .Node } node node for the acquired scope.
111+ * @param {ESTree .Node } node node for the acquired scope.
104112 * @param {?boolean } [inner=false] look up the most inner scope, default value is false.
105113 * @returns {Scope? } Scope from node
106114 */
@@ -154,8 +162,8 @@ class ScopeManager {
154162 /**
155163 * acquire all scopes from node.
156164 * @function ScopeManager#acquireAll
157- * @param {Espree .Node } node node for the acquired scope.
158- * @returns {Scopes ? } Scope array
165+ * @param {ESTree .Node } node node for the acquired scope.
166+ * @returns {Scope[] ? } Scope array
159167 */
160168 acquireAll ( node ) {
161169 return this . __get ( node ) ;
@@ -164,7 +172,7 @@ class ScopeManager {
164172 /**
165173 * release the node.
166174 * @function ScopeManager#release
167- * @param {Espree .Node } node releasing node.
175+ * @param {ESTree .Node } node releasing node.
168176 * @param {?boolean } [inner=false] look up the most inner scope, default value is false.
169177 * @returns {Scope? } upper scope for the node.
170178 */
@@ -189,6 +197,8 @@ class ScopeManager {
189197 * @returns {void }
190198 */
191199 addGlobals ( names ) {
200+
201+ // @ts -ignore -- globalScope must be set before this method is called.
192202 this . globalScope . __addVariables ( names ) ;
193203 }
194204
@@ -254,6 +264,8 @@ class ScopeManager {
254264 }
255265
256266 __isES6 ( ) {
267+
268+ // @ts -ignore -- if ecmaVersion is undefined, the comparison returns false.
257269 return this . __options . ecmaVersion >= 6 ;
258270 }
259271}
0 commit comments