Skip to content

Commit 28c330f

Browse files
committed
chore: upgrade eslint-config-eslint v10
1 parent 066e38c commit 28c330f

File tree

17 files changed

+1444
-1438
lines changed

17 files changed

+1444
-1438
lines changed

eslint.config.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export default [
1111
{ files: ["packages/*/tests/**/*"], languageOptions: { globals: globals.mocha } },
1212
{
1313
plugins: { autofix: autofixPlugin, "no-autofix": noAutofixPlugin },
14-
rules: { "eslint-comments/require-description": 0, "no-autofix/eslint-plugin/test-case-shorthand-strings": "error" }
14+
rules: {
15+
"eslint-comments/require-description": 0,
16+
"no-autofix/eslint-plugin/test-case-shorthand-strings": 2,
17+
"@eslint-community/eslint-comments/require-description": 0
18+
}
1519
},
1620
...nPlugin.configs["flat/mixed-esm-and-cjs"]
1721
];

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"description": "some eslint plugins",
77
"devDependencies": {
88
"eslint": "^9.1.1",
9-
"eslint-config-eslint": "^9.0.0",
9+
"eslint-config-eslint": "^10.0.0",
1010
"eslint-plugin-autofix": "file:./packages/autofix",
11-
"eslint-plugin-eslint-plugin": "^6.0.0",
11+
"eslint-plugin-eslint-plugin": "^6.1.0",
1212
"eslint-plugin-no-autofix": "file:./packages/no-autofix",
13-
"globals": "^15.0.0"
13+
"globals": "^15.1.0"
1414
},
1515
"scripts": {
1616
"lint": "eslint packages/",
@@ -21,7 +21,7 @@
2121
"homepage": "https://github.com/aladdin-add/eslint-plugin",
2222
"bugs": "https://github.com/aladdin-add/eslint-plugin/issues/",
2323
"engines": {
24-
"node": ">=8"
24+
"node": ">=18"
2525
},
2626
"workspaces": [
2727
"packages/*"

packages/autofix/lib/configs/all.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ Object.keys(allRules)
2222
.reduce((rules, ruleName) => Object.assign(rules, { [`${PLUGIN_NAME}/${ruleName}`]: "error" }), all.rules);
2323

2424
module.exports = all;
25-

packages/autofix/lib/rules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
const fs = require("fs");
1313
const path = require("path");
14-
const {eslintVersion} = require("./utils.js")
14+
const { eslintVersion } = require("./utils.js");
1515

1616

1717
/**
@@ -41,7 +41,7 @@ if (eslintVersion >= 8) {
4141
}
4242
}
4343
} else if (eslintVersion >= 6) {
44-
const builtin = require("eslint/lib/rules");
44+
const builtin = require("eslint/lib/rules"); // eslint-disable-line n/no-missing-require
4545

4646
for (const [ruleId, rule] of builtin) {
4747
if (rule.meta.fixable) {

packages/autofix/lib/rules/no-unused-vars.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ module.exports = ruleComposer.mapReports(
159159
return fixer.remove(grand);
160160
}
161161

162-
if (parent !== grand.specifiers[grand.specifiers.length - 1]) {
162+
if (parent !== grand.specifiers.at(-1)) {
163163
const comma = sourceCode.getTokenAfter(parent, commaFilter);
164164

165165
return [fixer.remove(parent), fixer.remove(comma)];
@@ -189,7 +189,7 @@ module.exports = ruleComposer.mapReports(
189189
return fixer.remove(grand);
190190
}
191191

192-
if (parent !== grand.declarations[grand.declarations.length - 1]) {
192+
if (parent !== grand.declarations.at(-1)) {
193193
const comma = sourceCode.getTokenAfter(parent, commaFilter);
194194

195195
return [fixer.remove(parent), fixer.remove(comma)];
@@ -219,7 +219,7 @@ module.exports = ruleComposer.mapReports(
219219
return comma ? [identifierRemoval, fixer.remove(comma)] : identifierRemoval;
220220
}
221221

222-
if (parent === grand.properties[grand.properties.length - 1]) {
222+
if (parent === grand.properties.at(-1)) {
223223
const comma = sourceCode.getTokenBefore(parent, commaFilter);
224224

225225
return [fixer.remove(parent), fixer.remove(comma)];

packages/autofix/lib/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ exports.eslintVersion = Number.parseInt(require("eslint/package.json").version,
1010
// TODO: this might be unreliable
1111
if (exports.eslintVersion >= 8) {
1212
const { builtinRules } = require("eslint/use-at-your-own-risk");
13+
1314
exports.builtinRules = builtinRules;
1415
} else if (exports.eslintVersion >= 6) {
16+
// eslint-disable-next-line n/no-missing-require
1517
const builtin = require("eslint/lib/rules");
18+
1619
exports.builtinRules = builtin;
1720
} else {
1821
const builtin = require("eslint/lib/built-in-rules-index"); // eslint-disable-line n/no-missing-require
22+
1923
exports.builtinRules = builtin;
2024
}
2125

packages/autofix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
"homepage": "https://github.com/aladdin-add/eslint-plugin/tree/master/packages/autofix",
4444
"bugs": "https://github.com/aladdin-add/eslint-plugin/issues/new?assignees=aladdin-add&labels=bug&template=bug-report--eslint-plugin-autofix.md&title=eslint-plugin-autofix+bug",
4545
"engines": {
46-
"node": ">=8"
46+
"node": ">=18"
4747
}
4848
}

packages/autofix/tests/lib/rules/no-unused-vars.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const ruleTester = new RuleTester();
1919

2020
ruleTester.run("no-unused-vars", rule, {
2121
valid: [
22-
{
23-
code: "import 'm'",
24-
},
22+
"import 'm'",
2523

2624
// https://github.com/aladdin-add/eslint-plugin/issues/58
2725
`const { _ } = require('lib/locale.js');
@@ -186,7 +184,7 @@ ruleTester.run("no-unused-vars", rule, {
186184
{
187185
code: "function foo(a, b, c){console.log(b);}; foo(1, 2, 3);",
188186
output: "function foo(a, b ){console.log(b);}; foo(1, 2, 3);",
189-
errors:1,
187+
errors: 1,
190188
options: [{
191189
args: "after-used",
192190
argsIgnorePattern: "^_"
@@ -195,7 +193,7 @@ ruleTester.run("no-unused-vars", rule, {
195193
{
196194
code: "const foo = function(a, b, c) {console.log(b);}; foo(1, 2, 3);",
197195
output: "const foo = function(a, b ) {console.log(b);}; foo(1, 2, 3);",
198-
errors:1,
196+
errors: 1,
199197
options: [{
200198
args: "after-used",
201199
argsIgnorePattern: "^_"
@@ -204,7 +202,7 @@ ruleTester.run("no-unused-vars", rule, {
204202
{
205203
code: "const foo = (a, b, c) => {console.log(b);}; foo(1, 2, 3);",
206204
output: "const foo = (a, b ) => {console.log(b);}; foo(1, 2, 3);",
207-
errors:1,
205+
errors: 1,
208206
options: [{
209207
args: "after-used",
210208
argsIgnorePattern: "^_"
@@ -213,7 +211,7 @@ ruleTester.run("no-unused-vars", rule, {
213211
{
214212
code: "const foo = (a) => {}; foo();",
215213
output: "const foo = () => {}; foo();",
216-
errors:1,
214+
errors: 1,
217215
options: [{
218216
args: "after-used",
219217
argsIgnorePattern: "^_"
@@ -222,7 +220,7 @@ ruleTester.run("no-unused-vars", rule, {
222220
{
223221
code: "const foo = a => {}; foo();",
224222
output: "const foo = () => {}; foo();",
225-
errors:1,
223+
errors: 1,
226224
options: [{
227225
args: "after-used",
228226
argsIgnorePattern: "^_"

packages/autofix/tests/lib/rules/no-useless-catch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ruleTester.run("no-useless-catch", rule, {
4040
{
4141
code: "try {} catch (e) { throw e } finally {}",
4242
output: "try {} finally {}",
43-
errors:1
43+
errors: 1
4444
}
4545
]
4646
});

packages/autofix/tools/new-rule.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* eslint-disable node/no-process-exit */
2-
/* eslint no-console: 0, no-process-exit: 0*/
1+
/* eslint no-console: 0, n/no-process-exit: 0*/
32
"use strict";
43

54
const fs = require("fs");

0 commit comments

Comments
 (0)