Skip to content

Commit ccbcb97

Browse files
JLHwungaduh95
authored andcommitted
tools: bump eslint to v10, babel to v8.0.0-rc.2
PR-URL: #61905 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent ea2649d commit ccbcb97

File tree

11 files changed

+389
-530
lines changed

11 files changed

+389
-530
lines changed

doc/api/perf_hooks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,8 @@ const timedImport = performance.timerify(async (module) => {
21912191
await timedImport('some-module');
21922192
```
21932193

2194+
<!-- eslint-disable no-global-assign -->
2195+
21942196
```cjs
21952197
'use strict';
21962198
const {

doc/api/single-executable-applications.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ This also ensures a more deterministic dependency graph.
459459
460460
However, if a file based `require()` is still needed, that can also be achieved:
461461
462+
<!-- eslint-disable no-global-assign -->
463+
462464
```js
463465
const { createRequire } = require('node:module');
464466
require = createRequire(__filename);

eslint.config.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,9 @@ export default [
8585
js.configs.recommended,
8686
jsdoc.configs['flat/recommended'],
8787
{
88-
files: ['**/*.{js,cjs}'],
88+
files: ['**/*.js'],
8989
languageOptions: {
90-
// The default is `commonjs` but it's not supported by the Babel parser.
91-
sourceType: 'script',
90+
sourceType: 'commonjs',
9291
},
9392
},
9493
{
@@ -101,7 +100,6 @@ export default [
101100
parser: babelEslintParser,
102101
parserOptions: {
103102
babelOptions: {
104-
parserOpts: { createImportExpressions: true },
105103
plugins: [
106104
babelPluginSyntaxImportSource,
107105
],
@@ -229,6 +227,7 @@ export default [
229227
...noRestrictedSyntaxCommonLib,
230228
],
231229
'no-self-compare': 'error',
230+
'no-shadow-restricted-names': ['error', { reportGlobalThis: false }],
232231
'no-template-curly-in-string': 'error',
233232
'no-throw-literal': 'error',
234233
'no-undef': ['error', { typeof: true }],
@@ -256,6 +255,7 @@ export default [
256255

257256
// ESLint recommended rules that we disable.
258257
'no-inner-declarations': 'off',
258+
'no-useless-assignment': 'off',
259259

260260
// JSDoc rules.
261261
'jsdoc/require-jsdoc': 'off',

lib/internal/modules/cjs/loader.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,8 +1799,6 @@ Module.prototype._compile = function(content, filename, format) {
17991799
}
18001800
}
18011801

1802-
let redirects;
1803-
18041802
let compiledWrapper;
18051803
if (format !== 'module') {
18061804
const result = wrapSafe(filename, content, this, format);
@@ -1816,7 +1814,7 @@ Module.prototype._compile = function(content, filename, format) {
18161814
}
18171815

18181816
const dirname = path.dirname(filename);
1819-
const require = makeRequireFunction(this, redirects);
1817+
const require = makeRequireFunction(this);
18201818
let result;
18211819
const exports = this.exports;
18221820
const thisValue = exports;

test/common/sea.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function generateSEA(fixtureDir, options = {}) {
9494
} catch (e) {
9595
const message = `Cannot copy ${process.execPath} to ${outputFile}: ${inspect(e)}`;
9696
if (verifyWorkflow) {
97-
throw new Error(message);
97+
throw new Error(message, { cause: e });
9898
}
9999
common.skip(message);
100100
}
@@ -132,7 +132,7 @@ function generateSEA(fixtureDir, options = {}) {
132132
} catch (e) {
133133
const message = `Cannot inject ${seaPrepBlob} into ${outputFile}: ${inspect(e)}`;
134134
if (verifyWorkflow) {
135-
throw new Error(message);
135+
throw new Error(message, { cause: e });
136136
}
137137
common.skip(message);
138138
}
@@ -150,7 +150,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
150150
} catch (e) {
151151
const message = `Cannot sign ${targetExecutable}: ${inspect(e)}`;
152152
if (verifyWorkflow) {
153-
throw new Error(message);
153+
throw new Error(message, { cause: e });
154154
}
155155
common.skip(message);
156156
}
@@ -161,7 +161,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
161161
} catch (e) {
162162
const message = `Cannot find signtool: ${inspect(e)}`;
163163
if (verifyWorkflow) {
164-
throw new Error(message);
164+
throw new Error(message, { cause: e });
165165
}
166166
common.skip(message);
167167
}
@@ -172,7 +172,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
172172
} catch (e) {
173173
const message = `Cannot sign ${targetExecutable}: ${inspect(e)}\n${stderr}`;
174174
if (verifyWorkflow) {
175-
throw new Error(message);
175+
throw new Error(message, { cause: e });
176176
}
177177
common.skip(message);
178178
}

test/es-module/test-esm-detect-ambiguous.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
147147
}
148148

149149
it('should not hint wrong format in resolve hook', async () => {
150+
// eslint-disable-next-line no-unassigned-vars
150151
let writeSync;
151152
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
152153
'--no-warnings',

tools/eslint-rules/prefer-optional-chaining.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
},
1616

1717
create(context) {
18-
const sourceCode = context.getSourceCode();
18+
const sourceCode = context.sourceCode;
1919

2020
// Helper function: Checks if two nodes have identical tokens
2121
function equalTokens(left, right) {

tools/eslint-rules/require-common-first.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ module.exports = {
4949
// The common module should be loaded in the first place.
5050
const notLoadedFirst = foundModules.indexOf(requiredModule) !== 0;
5151
if (notLoadedFirst) {
52-
context.report(
53-
node,
54-
'Mandatory module "{{moduleName}}" must be loaded ' +
55-
'before any other modules.',
56-
{ moduleName: requiredModule },
57-
);
52+
context.report({
53+
node: node.body[0] ?? node,
54+
message:
55+
'Mandatory module "{{moduleName}}" must be loaded ' +
56+
'before any other modules.',
57+
data: { moduleName: requiredModule },
58+
});
5859
}
5960
},
6061
};

tools/eslint-rules/required-modules.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ module.exports = {
6666
([module]) => foundModules.indexOf(module) === -1,
6767
);
6868
missingModules.forEach(([moduleName]) => {
69-
context.report(
70-
node,
71-
'Mandatory module "{{moduleName}}" must be loaded.',
72-
{ moduleName: moduleName },
73-
);
69+
context.report({
70+
node: node.body[0] ?? node,
71+
message: 'Mandatory module "{{moduleName}}" must be loaded.',
72+
data: { moduleName: moduleName },
73+
});
7474
});
7575
}
7676
},

0 commit comments

Comments
 (0)