8000 Use eslint v9 (#16479) · babel/babel@e37e64d · GitHub
[go: up one dir, main page]

Skip to content

Commit e37e64d

Browse files
authored
Use eslint v9 (#16479)
* update * skip old eslint * review * compat
1 parent c1bf7d7 commit e37e64d

File tree

31 files changed

+196
-246
lines changed

31 files changed

+196
-246
lines changed

Makefile.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile.source.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ target["clone-license"] = function () {
336336
*/
337337

338338
function eslint(...extraArgs) {
339-
const eslintEnv = { BABEL_ENV: "test" };
340339
const eslintArgs = ["--format", "codeframe", ...extraArgs.filter(Boolean)];
341340

342341
const packagesPackages = readdirSync("packages").filter(n =>
@@ -361,10 +360,15 @@ function eslint(...extraArgs) {
361360

362361
if (process.env.ESLINT_GO_BRRRR) {
363362
// Run as a single process. Needs a lot of memory (12GB).
364-
env(() => yarn(["eslint", "packages", ...rest, ...eslintArgs]), eslintEnv);
363+
env(() => yarn(["eslint", "packages", ...rest, ...eslintArgs]), {
364+
BABEL_ENV: "test",
365+
NODE_OPTIONS: "--max-old-space-size=16384",
366+
});
365367
} else {
366368
for (const chunk of chunks) {
367-
env(() => yarn(["eslint", ...chunk, ...eslintArgs]), eslintEnv);
369+
env(() => yarn(["eslint", ...chunk, ...eslintArgs]), {
370+
BABEL_ENV: "test",
371+
});
368372
}
369373
}
370374
}

eslint.config.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = [
6565
{
6666
plugins: {
6767
import: pluginImport,
68-
node: pluginN,
68+
n: pluginN,
6969
prettier: pluginPrettier,
7070
"@babel/development": pluginBabelDevelopment,
7171
"@babel/development-internal": pluginBabelDevelopmentInternal,
@@ -85,7 +85,10 @@ module.exports = [
8585
parser: typescriptEslint.parser,
8686
parserOptions: {
8787
allowAutomaticSingleRunInference: true,
88-
EXPERIMENTAL_useProjectService: true,
88+
// @ts-expect-error types are old
89+
EXPERIMENTAL_useProjectService: {
90+
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000,
91+
},
8992
},
9093
},
9194
plugins: {
@@ -218,9 +221,9 @@ module.exports = [
218221
{
219222
files: testFiles,
220223
rules: {
221-
"node/no-unsupported-features": [
224+
"n/no-unsupported-features/node-builtins": [
222225
"error",
223-
{ version: "12.17.0", ignores: ["modules"] },
226+
{ version: "12.17.0", ignores: ["module"] },
224227
],
225228
"@babel/development-internal/require-default-import-fallback": "error",
226229
"import/no-unresolved": "error",
@@ -281,12 +284,6 @@ module.exports = [
281284
],
282285
},
283286
},
284-
{
285-
files: ["eslint/babel-eslint-parser/src/**/*.js"],
286-
rules: {
287-
"no-restricted-imports": ["error", "@babel/core"],
288-
},
289-
},
290287
{
291288
files: ["packages/babel-plugin-transform-runtime/scripts/**/*.js"],
292289
rules: {
@@ -306,7 +303,7 @@ module.exports = [
306303
},
307304
},
308305
{
309-
files: ["scripts/**/*.{js,cjs}"],
306+
files: ["scripts/**/*.{js,cjs,mjs}"],
310307
rules: {
311308
"import/no-extraneous-dependencies": ["error", { packageDir: "." }],
312309
},

eslint/babel-eslint-config-internal/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = [
3434
"no-confusing-arrow": "error",
3535
"no-empty": ["error", { allowEmptyCatch: true }],
3636
"no-process-exit": "error",
37+
"no-unused-vars": ["error", { caughtErrors: "none" }],
3738
"no-var": "error",
3839
"prefer-const": "error",
3940
},

eslint/babel-eslint-parser/src/types.d.cts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { InputOptions } from "@babel/core";
33
import type { Token as tokenizerToken } from "../../../packages/babel-parser/src/tokenizer";
44
import type { ExportedTokenType } from "../../../packages/babel-parser/src/tokenizer/types";
55
import type * as estree from "estree";
6-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
76
import type {
87
PatternVisitor,
98
Reference,

eslint/babel-eslint-plugin-development-internal/src/rules/require-default-import-fallback.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ module.exports = {
3333
);
3434
if (!defaultSpecifier) return;
3535

36-
const scope = ctx.getScope();
36+
const scope = ctx.sourceCode
37+
? ctx.sourceCode.getScope(node)
38+
: ctx.getScope();
3739

3840
const { name: local } = defaultSpecifier.local;
3941
const { references } = scope.variables.find(v => v.name === local);

eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ module.exports = {
1010
return {
1111
CallExpression(node) {
1212
const { callee } = node;
13-
const scope = context.getScope();
13+
const scope = context.sourceCode
14+
? context.sourceCode.getScope(node)
15+
: context.getScope();
1416

1517
const origin = getReferenceOrigin(callee, scope);
1618
if (!origin) return;

eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ module.exports = {
1717
return {
1818
CallExpression(node) {
1919
const { callee } = node;
20-
const scope = context.getScope();
20+
const scope = context.sourceCode
21+
? context.sourceCode.getScope(node)
22+
: context.getScope();
2123

2224
const origin = getReferenceOrigin(callee, scope);
2325
if (!origin) return;

eslint/babel-eslint-plugin-development/src/rules/plugin-name.cjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ module.exports = {
3232
};
3333

3434
function functionVisitor(node) {
35-
if (!isBabelPluginFactory(node, context.getScope())) return;
35+
if (
36+
!isBabelPluginFactory(
37+
node,
38+
context.sourceCode
39+
? context.sourceCode.getScope(node)
40+
: context.getScope(),
41+
)
42+
) {
43+
return;
44+
}
3645

3746
const returnValue = getReturnValue(node);
3847
if (!returnValue || returnValue.type !== "ObjectExpression") return;

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
"c8": "^8.0.1",
5252
"charcodes": "^0.2.0",
5353
"core-js": "^3.36.1",
54-
"eslint": "^8.57.0",
54+
"eslint": "^9.2.0",
5555
"eslint-formatter-codeframe": "^7.32.1",
5656
"eslint-import-resolver-node": "^0.3.9",
5757
"eslint-plugin-import": "^2.29.1",
5858
"eslint-plugin-jest": "^27.9.0",
59-
"eslint-plugin-n": "^16.6.2",
59+
"eslint-plugin-n": "^17.5.0",
6060
"eslint-plugin-prettier": "^5.1.3",
6161
"execa": "^8.0.1",
6262
"glob": "^10.3.10",
@@ -82,8 +82,8 @@
8282
"shelljs": "^0.8.5",
8383
"test262-stream": "^1.4.0",
8484
"through2": "^4.0.0",
85-
"typescript": "^5.4.2",
86-
"typescript-eslint": "^7.2.0"
85+
"typescript": "^5.4.5",
86+
"typescript-eslint": "^7.8.0"
8787
},
8888
"workspaces": [
8989
"codemods/*",

0 commit comments

Comments
 (0)
0