mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
tools: bump eslint to v10, babel to v8.0.0-rc.2
PR-URL: https://github.com/nodejs/node/pull/61905 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
48c208fe66
commit
e5546618ea
11 files changed
+396
-537
No files matched your search
@@ -2199,6 +2199,8 @@ const timedImport = performance.timerify(async (module) => {
|
||||
await timedImport('some-module');
|
||||
```
|
||||
|
||||
<!-- eslint-disable no-global-assign -->
|
||||
|
||||
```cjs
|
||||
'use strict';
|
||||
const {
|
||||
|
||||
@@ -412,6 +412,8 @@ To load modules from the file system in the injected main script, users can
|
||||
create a `require` function that can load from the file system using
|
||||
`module.createRequire()`. For example, in a CommonJS entry point:
|
||||
|
||||
<!-- eslint-disable no-global-assign -->
|
||||
|
||||
```js
|
||||
const { createRequire } = require('node:module');
|
||||
require = createRequire(__filename);
|
||||
|
||||
+4
-4
@@ -85,10 +85,9 @@ export default [
|
||||
js.configs.recommended,
|
||||
jsdoc.configs['flat/recommended'],
|
||||
{
|
||||
files: ['**/*.{js,cjs}'],
|
||||
files: ['**/*.js'],
|
||||
languageOptions: {
|
||||
// The default is `commonjs` but it's not supported by the Babel parser.
|
||||
sourceType: 'script',
|
||||
sourceType: 'commonjs',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -101,7 +100,6 @@ export default [
|
||||
parser: babelEslintParser,
|
||||
parserOptions: {
|
||||
babelOptions: {
|
||||
parserOpts: { createImportExpressions: true },
|
||||
plugins: [
|
||||
babelPluginSyntaxImportSource,
|
||||
],
|
||||
@@ -229,6 +227,7 @@ export default [
|
||||
...noRestrictedSyntaxCommonLib,
|
||||
],
|
||||
'no-self-compare': 'error',
|
||||
'no-shadow-restricted-names': ['error', { reportGlobalThis: false }],
|
||||
'no-template-curly-in-string': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'no-undef': ['error', { typeof: true }],
|
||||
@@ -256,6 +255,7 @@ export default [
|
||||
|
||||
// ESLint recommended rules that we disable.
|
||||
'no-inner-declarations': 'off',
|
||||
'no-useless-assignment': 'off',
|
||||
|
||||
// JSDoc rules.
|
||||
'jsdoc/require-jsdoc': 'off',
|
||||
|
||||
@@ -1798,8 +1798,6 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
}
|
||||
}
|
||||
|
||||
let redirects;
|
||||
|
||||
let compiledWrapper;
|
||||
if (format !== 'module') {
|
||||
const result = wrapSafe(filename, content, this, format);
|
||||
@@ -1815,7 +1813,7 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
}
|
||||
|
||||
const dirname = path.dirname(filename);
|
||||
const require = makeRequireFunction(this, redirects);
|
||||
const require = makeRequireFunction(this);
|
||||
let result;
|
||||
const exports = this.exports;
|
||||
const thisValue = exports;
|
||||
|
||||
+5
-5
@@ -154,7 +154,7 @@ function generateSEA(fixtureDir, options = {}) {
|
||||
} catch (e) {
|
||||
const message = `Cannot copy ${process.execPath} to ${outputFile}: ${inspect(e)}`;
|
||||
if (verifyWorkflow) {
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: e });
|
||||
}
|
||||
common.skip(message);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ function generateSEA(fixtureDir, options = {}) {
|
||||
} catch (e) {
|
||||
const message = `Cannot inject ${seaPrepBlob} into ${outputFile}: ${inspect(e)}`;
|
||||
if (verifyWorkflow) {
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: e });
|
||||
}
|
||||
common.skip(message);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
|
||||
} catch (e) {
|
||||
const message = `Cannot sign ${targetExecutable}: ${inspect(e)}`;
|
||||
if (verifyWorkflow) {
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: e });
|
||||
}
|
||||
common.skip(message);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
|
||||
} catch (e) {
|
||||
const message = `Cannot find signtool: ${inspect(e)}`;
|
||||
if (verifyWorkflow) {
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: e });
|
||||
}
|
||||
common.skip(message);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) {
|
||||
} catch (e) {
|
||||
const message = `Cannot sign ${targetExecutable}: ${inspect(e)}\n${stderr}`;
|
||||
if (verifyWorkflow) {
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: e });
|
||||
}
|
||||
common.skip(message);
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
|
||||
}
|
||||
|
||||
it('should not hint wrong format in resolve hook', async () => {
|
||||
// eslint-disable-next-line no-unassigned-vars
|
||||
let writeSync;
|
||||
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
|
||||
'--no-warnings',
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
// Helper function: Checks if two nodes have identical tokens
|
||||
function equalTokens(left, right) {
|
||||
|
||||
@@ -49,12 +49,13 @@ module.exports = {
|
||||
// The common module should be loaded in the first place.
|
||||
const notLoadedFirst = foundModules.indexOf(requiredModule) !== 0;
|
||||
if (notLoadedFirst) {
|
||||
context.report(
|
||||
node,
|
||||
'Mandatory module "{{moduleName}}" must be loaded ' +
|
||||
'before any other modules.',
|
||||
{ moduleName: requiredModule },
|
||||
);
|
||||
context.report({
|
||||
node: node.body[0] ?? node,
|
||||
message:
|
||||
'Mandatory module "{{moduleName}}" must be loaded ' +
|
||||
'before any other modules.',
|
||||
data: { moduleName: requiredModule },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -66,11 +66,11 @@ module.exports = {
|
||||
([module]) => foundModules.indexOf(module) === -1,
|
||||
);
|
||||
missingModules.forEach(([moduleName]) => {
|
||||
context.report(
|
||||
node,
|
||||
'Mandatory module "{{moduleName}}" must be loaded.',
|
||||
{ moduleName: moduleName },
|
||||
);
|
||||
context.report({
|
||||
node: node.body[0] ?? node,
|
||||
message: 'Mandatory module "{{moduleName}}" must be loaded.',
|
||||
data: { moduleName: moduleName },
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+360
-506
File diff suppressed because it is too large.
Load diff
@@ -3,14 +3,15 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.28.6",
|
||||
"@babel/eslint-parser": "^7.28.6",
|
||||
"@babel/plugin-syntax-import-source": "^7.28.6",
|
||||
"@babel/core": "^8.0.0-rc.2",
|
||||
"@babel/eslint-parser": "^8.0.0-rc.2",
|
||||
"@babel/plugin-syntax-import-source": "^8.0.0-rc.2",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@eslint/markdown": "^7.5.1",
|
||||
"@stylistic/eslint-plugin": "^5.7.1",
|
||||
"eslint": "^9.39.2",
|
||||
"@stylistic/eslint-plugin": "^5.9.0",
|
||||
"eslint": "^10.0.1",
|
||||
"eslint-formatter-tap": "^9.0.1",
|
||||
"eslint-plugin-jsdoc": "^62.4.1",
|
||||
"globals": "^17.2.0"
|
||||
"eslint-plugin-jsdoc": "^62.7.0",
|
||||
"globals": "^17.3.0"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user