Skip to content

Commit 9429c8d

Browse files
committed
style: update ESLint configurations and remove unnecessary disable comments
1 parent 72f5921 commit 9429c8d

12 files changed

Lines changed: 28 additions & 28 deletions

eslint.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import globals from 'globals';
33
export default [
44
{
55
languageOptions: {
6-
ecmaVersion: 2017,
7-
sourceType: "module",
6+
ecmaVersion: 2022,
7+
sourceType: 'script',
88
globals: {
9-
...globals.node
9+
...globals.node,
1010
},
1111
parserOptions: {
1212
ecmaFeatures: {
1313
globalReturn: true,
14-
}
15-
}
14+
},
15+
},
1616
},
17-
ignores: ["eslint.config.mjs"],
17+
ignores: ['eslint.config.mjs', '.claude/worktrees/**'],
1818
},
19-
];
19+
];

lib/bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ function thisIsConstructor(obj) {
272272
// Note: obj@any(unsafe)
273273
const Func = new ThisProxy(obj, TEST_PROXY_HANDLER);
274274
try {
275-
// eslint-disable-next-line no-new
275+
276276
new Func();
277277
return true;
278278
} catch (e) {

lib/builtin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const BUILTIN_MODULES = (nmod.builtinModules || Object.getOwnPropertyNames(proce
8888

8989
let EventEmitterReferencingAsyncResourceClass = null;
9090
if (EventEmitter.EventEmitterAsyncResource) {
91-
// eslint-disable-next-line global-require
91+
9292
const {AsyncResource} = require('async_hooks');
9393
const kEventEmitter = Symbol('kEventEmitter');
9494
class EventEmitterReferencingAsyncResource extends AsyncResource {

lib/compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function getCoffeeScriptCompiler(options) {
1717
try {
1818
// The warning generated by webpack can be disabled by setting:
1919
// ignoreWarnings[].message = /Can't resolve 'coffee-script'/
20-
/* eslint-disable-next-line global-require */
20+
2121
const coffeeScript = require('coffee-script');
2222
return (code, filename) => {
2323
return coffeeScript.compile(code, Object.assign({header: false, bare: true}, options));
@@ -40,7 +40,7 @@ function getTypeScriptCompiler(options) {
4040
try {
4141
// The warning generated by webpack can be disabled by setting:
4242
// ignoreWarnings[].message = /Can't resolve 'typescript'/
43-
/* eslint-disable-next-line global-require */
43+
4444
const typescript = require('typescript');
4545
return (code, filename) => {
4646
return typescript.transpileModule(code, {

lib/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ function _addListener(target, type, listener, prepend) {
671671
if (m > 0 && existing.length > m && !existing.warned) {
672672
existing.warned = true;
673673
// No error code for this since it is a Warning
674-
// eslint-disable-next-line no-restricted-syntax
674+
675675
const w = new Error('Possible EventEmitter memory leak detected. ' +
676676
`${existing.length} ${String(type)} listeners ` +
677677
`added to ${inspect(target, { depth: -1 })}. Use ` +

lib/resolver-compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {jsCompiler} = require('./compiler');
1919
*/
2020
function defaultRequire(moduleName) {
2121
// Set module.parser.javascript.commonjsMagicComments=true in your webpack config.
22-
// eslint-disable-next-line global-require
22+
2323
return require(/* webpackIgnore: true */ moduleName);
2424
}
2525

lib/resolver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Resolver {
8787

8888
getExtensions(vm) {
8989
return {
90-
// eslint-disable-next-line quote-props
90+
9191
__proto__: null,
9292
'.js': this.makeExtensionHandler(vm, 'loadJS'),
9393
'.json': this.makeExtensionHandler(vm, 'loadJSON'),
@@ -697,7 +697,7 @@ class DefaultResolver extends Resolver {
697697
if (internal && !target.startsWith('../') && !target.startsWith('/')) {
698698
let isURL = false;
699699
try {
700-
// eslint-disable-next-line no-new
700+
701701
new URL(target);
702702
isURL = true;
703703
} catch (e) {}

lib/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class VMScript {
163163
}
164164
} else if (arguments.length > 2) {
165165
// We do it this way so that there are no more arguments in the function.
166-
// eslint-disable-next-line prefer-rest-params
166+
167167
useOptions = arguments[2] || {__proto__: null};
168168
useFileName = options || useOptions.filename;
169169
} else {

lib/setup-node-sandbox.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function findBestExtensionHandler(filename) {
166166
}
167167

168168
function createRequireForModule(mod) {
169-
// eslint-disable-next-line no-shadow
169+
170170
function require(id) {
171171
return requireImpl(mod, id, true);
172172
}
@@ -209,7 +209,7 @@ function clearTimer(timer) {
209209
}
210210

211211
// This is a function and not an arrow function, since the original is also a function
212-
// eslint-disable-next-line no-shadow
212+
213213
global.setTimeout = function setTimeout(callback, delay, ...args) {
214214
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
215215
const obj = new Timeout(callback, args);
@@ -228,7 +228,7 @@ global.setTimeout = function setTimeout(callback, delay, ...args) {
228228
return obj;
229229
};
230230

231-
// eslint-disable-next-line no-shadow
231+
232232
global.setInterval = function setInterval(callback, interval, ...args) {
233233
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
234234
const obj = new Interval();
@@ -247,7 +247,7 @@ global.setInterval = function setInterval(callback, interval, ...args) {
247247
return obj;
248248
};
249249

250-
// eslint-disable-next-line no-shadow
250+
251251
global.setImmediate = function setImmediate(callback, ...args) {
252252
if (typeof callback !== 'function') throw new LocalTypeError('"callback" argument must be a function');
253253
const obj = new Immediate();
@@ -266,17 +266,17 @@ global.setImmediate = function setImmediate(callback, ...args) {
266266
return obj;
267267
};
268268

269-
// eslint-disable-next-line no-shadow
269+
270270
global.clearTimeout = function clearTimeout(timeout) {
271271
clearTimer(timeout);
272272
};
273273

274-
// eslint-disable-next-line no-shadow
274+
275275
global.clearInterval = function clearInterval(interval) {
276276
clearTimer(interval);
277277
};
278278

279-
// eslint-disable-next-line no-shadow
279+
280280
global.clearImmediate = function clearImmediate(immediate) {
281281
clearTimer(immediate);
282282
};
@@ -317,7 +317,7 @@ function addListener(name, handler) {
317317
* @this process
318318
* @return {this}
319319
*/
320-
// eslint-disable-next-line no-shadow
320+
321321
function process() {
322322
return this;
323323
}

lib/setup-sandbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ if (
400400
throw localUnexpected();
401401

402402
// Fixes buffer unsafe allocation
403-
/* eslint-disable no-use-before-define */
403+
404404
class BufferHandler extends ReadOnlyHandler {
405405

406406
// SECURITY (GHSA-v37h-5mfm-c47c): forward every arg (token + object)
@@ -430,7 +430,7 @@ class BufferHandler extends ReadOnlyHandler {
430430
return apply(LocalBuffer.from, LocalBuffer, args);
431431
}
432432
}
433-
/* eslint-enable no-use-before-define */
433+
434434

435435
// SECURITY (post-GHSA-v37h hardening): rebind BufferHandler.prototype.constructor
436436
// to the throw-always sentinel so `Object.getPrototypeOf(handler).constructor`

0 commit comments

Comments
 (0)