1
- /**
2
- * @author Toru Nagashima
3
- * @copyright 2015 Toru Nagashima. All rights reserved.
4
- * See LICENSE file in root directory for full license.
5
- */
6
1
"use strict"
7
2
3
+ const { getDeclaredVariables } = require ( "../eslint-compat" )
4
+
8
5
//------------------------------------------------------------------------------
9
6
// Helpers
10
7
//------------------------------------------------------------------------------
@@ -15,7 +12,7 @@ const containerNodeType =
15
12
/ ^ (?: F o r (?: I n | O f ) ? S t a t e m e n t | (?: A r r o w ) ? F u n c t i o n (?: D e c l a r a t i o n | E x p r e s s i o n ) ) $ / u
16
13
17
14
/**
18
- * Checks whether or not a given definition should be skipped.
15
+ * Checks whether a given definition should be skipped.
19
16
* @param {escope.Variable.DefEntry } def - A definition to check.
20
17
* @param {escope.Variable.DefEntry[] } defs - A definition list which includes `def`.
21
18
* @param {escope.Variable } variable - A variable which is defined by the definition.
@@ -180,7 +177,7 @@ class PseudoScope {
180
177
}
181
178
182
179
/**
183
- * Turns an used flag on.
180
+ * Turns a used flag on.
184
181
* @returns {void }
185
182
*/
186
183
markAsUsed ( ) {
@@ -213,12 +210,12 @@ module.exports = {
213
210
} ,
214
211
create ( context ) {
215
212
/**
216
- * Finds and reports references which are outside of valid scopes.
213
+ * Finds and reports references which are outside valid scopes.
217
214
* @param {ASTNode } node - A node to get variables.
218
215
* @returns {void }
219
216
*/
220
217
function checkForVariables ( node ) {
221
- const variables = context . getDeclaredVariables ( node )
218
+ const variables = getDeclaredVariables ( context , node )
222
219
for ( const variable of variables ) {
223
220
const defs = variable . defs
224
221
const lastDef = defs [ defs . length - 1 ]
@@ -235,7 +232,7 @@ module.exports = {
235
232
continue
236
233
}
237
234
238
- // Check whether or not any reading reference exists.
235
+ // Check whether any reading reference exists.
239
236
// And while it does, warn references which does not belong to any
240
237
// scope.
241
238
let hasReadRef = false
0 commit comments