Skip to content

Commit 26e70a5

Browse files
committed
set (updated 07:04)
1 parent ea09c9e commit 26e70a5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

rules/isolated-functions.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@ const create = context => {
3333
};
3434

3535
options.comments = options.comments.map(comment => comment.toLowerCase());
36-
/** @type {string[]} */
37-
let allowedGlobals = [];
38-
if (options.globals === true) {
39-
allowedGlobals = Object.keys(context.languageOptions.globals);
40-
} else if (Array.isArray(options.globals)) {
41-
allowedGlobals = options.globals;
42-
}
36+
const allowedGlobals = options.globals === true
37+
? new Set(Object.keys(context.languageOptions.globals))
38+
: new Set(options.globals || []);
4339

4440
/** @param {import('estree').Node} node */
4541
const checkForExternallyScopedVariables = node => {
@@ -53,7 +49,7 @@ const create = context => {
5349
for (const reference of nodeScope.through) {
5450
const {identifier} = reference;
5551

56-
if (allowedGlobals.includes(identifier.name)) {
52+
if (allowedGlobals.has(identifier.name)) {
5753
continue;
5854
}
5955

0 commit comments

Comments
 (0)