Skip to content

Commit

Permalink
declare globals for eslint-plugin-n>=16.5.0
Browse files Browse the repository at this point in the history
eslint-community/eslint-plugin-n#154 removed
many global variables from eslint-plugin-n in favor of enabling the node
and es2021 environments.  Since we disable the node environment (since
our code may not be running in node) we need to declare those variables
for linting.  Do so as necessary.

Bump the required version of eslint-plugin-n to ^16.5.0 to avoid
warnings about redeclaring globals when using previous versions.

Signed-off-by: Kevin Locke <[email protected]>
  • Loading branch information
kevinoid committed Dec 31, 2023
1 parent 9c22971 commit 8a3ba38
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

'use strict';

// Allow using window global if it is not undefined
/* global window:false */
// Allow using console, process, and window global variables, when present
/* global console: false, process:false, window:false */

// Allow logging to console to notify user that they may miss rejections.
/* eslint-disable no-console */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^46.0.0",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-n": "^16.5.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-regexp": "^2.0.0",
"eslint-plugin-unicorn": "^48.0.1",
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

'use strict';

/* global setTimeout:false */

it('passes synchronously', () => {});
it('passes asynchronously', (cb) => setTimeout(cb, 0));
it('passes resolved Promise', () => Promise.resolve());
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function runMocha(...args) {
// include .cmd in search path, necessary to resolve mocha to mocha.cmd.
// See https://github.com/nodejs/node/issues/6671
const promise = execFileP(
process.execPath,
process.execPath, // eslint-disable-line no-undef
[mochaPath, '-R', 'json', ...args],
);
promise.child.stdin.end();
Expand Down

0 comments on commit 8a3ba38

Please sign in to comment.