Skip to content

Commit 40bd039

Browse files
committed
chore: upgrade to eslint v9
1 parent 5272277 commit 40bd039

File tree

5 files changed

+653
-1189
lines changed

5 files changed

+653
-1189
lines changed

eslint-remote-tester.config.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22

3-
const fs = require("node:fs");
4-
const { basename, extname } = require("node:path");
3+
const eslintPluginQunitRecommended = require("./lib/configs/recommended");
54

65
/** @type {import('eslint-remote-tester').Config} */
76
module.exports = {
@@ -33,25 +32,7 @@ module.exports = {
3332
cache: false,
3433

3534
/** ESLint configuration */
36-
eslintrc: {
37-
plugins: ["qunit"],
38-
39-
// Enable all of our rules.
40-
rules: Object.fromEntries(
41-
fs
42-
.readdirSync(`${__dirname}/lib/rules`)
43-
.map(
44-
(filename) =>
45-
`qunit/${basename(filename, extname(filename))}`,
46-
)
47-
.map((ruleName) => [ruleName, "error"]),
48-
),
49-
50-
overrides: [
51-
{
52-
files: ["*.ts", "*.mts", "*.cts"],
53-
parser: "@typescript-eslint/parser",
54-
},
55-
],
35+
eslintConfig: {
36+
...eslintPluginQunitRecommended,
5637
},
5738
};

eslint.config.js

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
"use strict";
22

33
const js = require("@eslint/js");
4-
const { FlatCompat } = require("@eslint/eslintrc");
4+
const eslintPluginEslintComments = require("@eslint-community/eslint-plugin-eslint-comments/configs");
55
const eslintPluginEslintPluginAll = require("eslint-plugin-eslint-plugin/configs/all");
66
const eslintPluginMarkdown = require("eslint-plugin-markdown");
7+
const eslintPluginMocha = require("eslint-plugin-mocha");
8+
const eslintPluginN = require("eslint-plugin-n");
9+
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
10+
const eslintPluginUnicorn = require("eslint-plugin-unicorn");
711
const globals = require("globals");
812

9-
const compat = new FlatCompat({
10-
baseDirectory: __dirname,
11-
recommendedConfig: js.configs.recommended,
12-
});
13-
1413
module.exports = [
15-
...compat.extends(
16-
"plugin:eslint-comments/recommended",
17-
"plugin:node/recommended",
18-
"plugin:prettier/recommended",
19-
"plugin:unicorn/recommended",
20-
),
14+
js.configs.recommended,
2115

16+
eslintPluginEslintComments.recommended,
2217
eslintPluginEslintPluginAll,
18+
eslintPluginN.configs["flat/recommended"],
19+
eslintPluginPrettierRecommended,
20+
eslintPluginUnicorn.configs["flat/recommended"],
2321

24-
// Apply mocha config only to tests.
25-
...compat
26-
.extends("plugin:mocha/recommended")
27-
.map((config) => ({ ...config, files: ["tests/**/*.js"] })),
22+
{
23+
...eslintPluginMocha.configs.flat.recommended,
24+
files: ["tests/**/*.js"],
25+
},
2826

2927
{
3028
languageOptions: {
@@ -136,14 +134,6 @@ module.exports = [
136134
"spaced-comment": ["error", "always", { exceptions: ["-"] }],
137135
strict: ["error", "global"],
138136
"use-isnan": "error",
139-
"valid-jsdoc": [
140-
"error",
141-
{
142-
prefer: {
143-
return: "returns",
144-
},
145-
},
146-
],
147137
"valid-typeof": "error",
148138
yoda: ["error", "never"],
149139

@@ -172,8 +162,8 @@ module.exports = [
172162
],
173163
"eslint-plugin/require-meta-schema-description": "off", // TODO: enable this.
174164

175-
// eslint-plugin-node
176-
"node/no-missing-require": [
165+
// eslint-plugin-n
166+
"n/no-missing-require": [
177167
"error",
178168
{
179169
allowModules: ["@typescript-eslint/parser"],

lib/rules/no-setup-teardown.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ module.exports = {
3535
};
3636

3737
function checkModuleHook(propertyNode) {
38-
if (replacements.hasOwnProperty(propertyNode.key.name)) {
38+
if (
39+
Object.prototype.hasOwnProperty.call(
40+
replacements,
41+
propertyNode.key.name,
42+
)
43+
) {
3944
context.report({
4045
node: propertyNode,
4146
messageId: "noSetupTeardown",

0 commit comments

Comments
 (0)