Skip to content

Commit d914ba6

Browse files
authored
Upgrade ESLint packages (#235)
1 parent 3f8590f commit d914ba6

File tree

5 files changed

+119
-71
lines changed

5 files changed

+119
-71
lines changed

.eslintrc.json

-48
This file was deleted.

eslint.config.js

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
const __filename = fileURLToPath(import.meta.url);
5+
const __dirname = path.dirname(__filename);
6+
7+
import { FlatCompat } from '@eslint/eslintrc';
8+
import js from '@eslint/js';
9+
import mochaPlugin from 'eslint-plugin-mocha';
10+
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
11+
import reactPlugin from 'eslint-plugin-react';
12+
import globals from 'globals';
13+
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
export default [
21+
...compat.extends(
22+
'eslint:recommended',
23+
'plugin:mocha/recommended',
24+
'plugin:react/recommended'
25+
),
26+
{
27+
settings: {
28+
react: {
29+
version: 'detect'
30+
}
31+
}
32+
},
33+
{
34+
ignores: [
35+
'built/*',
36+
'public/*'
37+
]
38+
},
39+
{
40+
languageOptions: {
41+
globals: {
42+
...globals.node
43+
},
44+
ecmaVersion: 2020,
45+
sourceType: 'module'
46+
},
47+
rules: {
48+
'comma-dangle': 2,
49+
eqeqeq: 2,
50+
'guard-for-in': 2,
51+
'new-cap': 0,
52+
'no-caller': 2,
53+
'no-console': 2,
54+
'no-extend-native': 2,
55+
'no-irregular-whitespace': 2,
56+
'no-loop-func': 2,
57+
'no-multi-spaces': 2,
58+
'no-multiple-empty-lines': [2, { max: 1 }],
59+
'no-undef': 2,
60+
'no-underscore-dangle': 0,
61+
'no-unused-vars': 2,
62+
'no-var': 2,
63+
'one-var': [2, 'never'],
64+
quotes: [2, 'single'],
65+
semi: 2,
66+
'space-before-function-paren': 2,
67+
'spaced-comment': 2,
68+
strict: [2, 'global'],
69+
'wrap-iife': 2
70+
}
71+
},
72+
{
73+
files: [
74+
'**/*.jsx'
75+
],
76+
languageOptions: {
77+
globals: {
78+
...globals.browser
79+
},
80+
parserOptions: {
81+
ecmaFeatures: {
82+
jsx: true
83+
}
84+
}
85+
},
86+
plugins: {
87+
react: reactPlugin
88+
},
89+
rules: {
90+
'react/react-in-jsx-scope': 0
91+
}
92+
},
93+
{
94+
files: [
95+
'test/**/*.test.js'
96+
],
97+
languageOptions: {
98+
globals: {
99+
...globals.mocha
100+
}
101+
},
102+
plugins: {
103+
mocha: mochaPlugin,
104+
'no-only-tests': noOnlyTestsPlugin
105+
},
106+
rules: {
107+
'mocha/no-mocha-arrows': 0,
108+
'no-only-tests/no-only-tests': 2
109+
}
110+
}
111+
];

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MS-RSL",
88
"main": "src/server/app.js",
99
"scripts": {
10-
"lint": "eslint --ext .js,.jsx src/ test/",
10+
"lint": "eslint",
1111
"lintspaces": "git ls-files ':!:*.ico' | xargs lintspaces -e .editorconfig",
1212
"lint-check": "npm run lint && npm run lintspaces",
1313
"unit-test": "mocha --config test/.mocharc.json",
@@ -55,10 +55,11 @@
5555
"@rollup/plugin-replace": "6.0.1",
5656
"chai": "5.1.2",
5757
"concurrently": "9.1.0",
58-
"eslint": "8.57.0",
59-
"eslint-plugin-mocha": "^10.4.3",
60-
"eslint-plugin-no-only-tests": "3.1.0",
61-
"eslint-plugin-react": "7.34.2",
58+
"eslint": "9.17.0",
59+
"eslint-plugin-mocha": "10.5.0",
60+
"eslint-plugin-no-only-tests": "3.3.0",
61+
"eslint-plugin-react": "7.37.2",
62+
"globals": "15.14.0",
6263
"lintspaces-cli": "0.8.0",
6364
"mocha": "10.4.0",
6465
"pre-commit": "1.2.2",

src/server/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import http from 'node:http';
22
import path from 'node:path';
33
import { fileURLToPath } from 'node:url';
44

5-
const __filename = fileURLToPath(import.meta.url); // eslint-disable-line no-underscore-dangle
6-
const __dirname = path.dirname(__filename); // eslint-disable-line no-underscore-dangle
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
77

88
import express from 'express';
99
import { engine } from 'express-handlebars';

test/.eslintrc.json

-16
This file was deleted.

0 commit comments

Comments
 (0)