Skip to content

Commit 2c937f1

Browse files
authored
chore: update eslint to 9 (#1801)
1 parent ba898a4 commit 2c937f1

File tree

8 files changed

+368
-295
lines changed

8 files changed

+368
-295
lines changed

.eslintrc.json

Lines changed: 0 additions & 129 deletions
This file was deleted.

apis/locale/scripts/generate-all.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! /usr/bin/env node
2+
/* eslint no-underscore-dangle: 0 */
23
import { globbySync } from 'globby';
34
import { fileURLToPath } from 'url';
45
import fs from 'fs';
@@ -49,7 +50,6 @@ for (const fileName of LOCALES_FILES) {
4950
acc[key].locale = {};
5051
}
5152
acc[key].locale[locale] = content[curr].value;
52-
const localeObj = acc[key].locale[locale];
5353
return acc;
5454
}, merged);
5555
}

apis/nucleus/src/components/listbox/ListBox.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function ListBox({
7676
const scrollTimeout = 0;
7777

7878
const { frequencyMax, awaitingFrequencyMax } = useFrequencyMax(app, layout);
79-
79+
// eslint-disable-next-line no-unused-vars
8080
const { isLoadingData, ...itemsLoader } = useItemsLoader({
8181
local,
8282
loaderRef,

apis/nucleus/src/components/listbox/__tests__/list-box-portal.test.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ describe('ListBoxPortal', () => {
205205
option_two: '#02',
206206
__DO_NOT_USE__: doNotUse,
207207
};
208+
// eslint-disable-next-line no-unused-vars
208209
const { __DO_NOT_USE__, ...resultOfOptions } = extraOptions;
209210
expect(getOptions(extraOptions)).toMatchObject({ ...defaultValues, ...resultOfOptions, ...doNotUse });
210211
});

apis/nucleus/src/components/listbox/components/ListBoxRowColumn/components/ListBoxRoot.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const RowColRoot = styled('div', {
8282
'styles',
8383
].includes(prop),
8484
})(({ theme, checkboxes, isGridMode, isGridCol, dense, direction, sizes, frequencyMode, freqHitsValue, styles }) => {
85+
// eslint-disable-next-line no-unused-vars
8586
const { backgroundColor: _, ...contentFontStyles } = styles.content;
8687

8788
const rowSelectionStyle = getRowSelectionStyle({ theme, styles, checkboxes, selectionState: 'selected' });

eslint.config.mjs

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import prettier from 'eslint-plugin-prettier';
3+
import jest from 'eslint-plugin-jest';
4+
import globals from 'globals';
5+
import mocha from 'eslint-plugin-mocha';
6+
import path from 'node:path';
7+
import { fileURLToPath } from 'node:url';
8+
import js from '@eslint/js';
9+
import { FlatCompat } from '@eslint/eslintrc';
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all,
17+
});
18+
19+
export default defineConfig([
20+
globalIgnores(['**/dist/', '**/coverage/', '**/node_modules/', 'apis/snapshooter/client.js', 'apis/*/core/**/*.js']),
21+
{
22+
extends: compat.extends('airbnb', 'prettier'),
23+
24+
plugins: {
25+
prettier,
26+
jest,
27+
},
28+
29+
languageOptions: {
30+
globals: {
31+
...globals.browser,
32+
...jest.environments.globals.globals,
33+
__NEBULA_DEV__: false,
34+
},
35+
36+
ecmaVersion: 2020,
37+
sourceType: 'module',
38+
},
39+
40+
rules: {
41+
'max-len': 0,
42+
'no-plusplus': 0,
43+
'no-bitwise': 0,
44+
'no-unused-expressions': 0,
45+
'prettier/prettier': 2,
46+
'react/destructuring-assignment': [0, 'always'],
47+
'react/prop-types': 0,
48+
'react/no-deprecated': 0,
49+
50+
'import/no-extraneous-dependencies': [
51+
2,
52+
{
53+
devDependencies: true,
54+
},
55+
],
56+
57+
'import/no-dynamic-require': 0,
58+
'jest/no-disabled-tests': 'warn',
59+
'jest/no-focused-tests': 'error',
60+
'jest/no-identical-title': 'error',
61+
'jest/prefer-to-have-length': 'warn',
62+
'jest/valid-expect': 'error',
63+
'no-unused-vars': [
64+
'error',
65+
{
66+
caughtErrors: 'none',
67+
},
68+
],
69+
},
70+
},
71+
{
72+
files: ['apis/**/*', 'packages/**/*', 'commands/create/**/*', 'commands/sense/src/**/*'],
73+
74+
rules: {
75+
'jest/valid-expect': 0,
76+
'jest/no-identical-title': 0,
77+
},
78+
},
79+
{
80+
files: ['scripts/**/*', '**/apis/*/scripts/**/*'],
81+
82+
rules: {
83+
'no-restricted-syntax': 0,
84+
},
85+
},
86+
{
87+
files: ['apis/**/*'],
88+
89+
rules: {
90+
'no-console': 'error',
91+
},
92+
},
93+
{
94+
files: ['apis/*/index.js'],
95+
96+
rules: {
97+
'global-require': 0,
98+
},
99+
},
100+
{
101+
files: ['commands/sense/src/*.js'],
102+
103+
languageOptions: {
104+
globals: {
105+
define: false,
106+
},
107+
},
108+
109+
rules: {
110+
'no-var': 0,
111+
'import/no-amd': 0,
112+
},
113+
},
114+
{
115+
files: ['commands/serve/web/**/*.{js,jsx}'],
116+
117+
rules: {
118+
'arrow-body-style': 1,
119+
'no-use-before-define': 1,
120+
'react/function-component-definition': 0,
121+
'import/prefer-default-export': 1,
122+
'import/no-cycle': 1,
123+
},
124+
},
125+
{
126+
files: ['commands/serve/web/**/*.test.{js,jsx}', 'commands/serve/web/utils/testRenderer.jsx'],
127+
128+
rules: {
129+
'import/no-extraneous-dependencies': 0,
130+
'array-callback-return': 0,
131+
},
132+
},
133+
{
134+
files: ['**/*.{int,comp,spec}.{js,jsx}'],
135+
136+
plugins: {
137+
mocha,
138+
},
139+
140+
languageOptions: {
141+
globals: {
142+
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
143+
...globals.node,
144+
...globals.mocha,
145+
chai: false,
146+
expect: false,
147+
sinon: false,
148+
page: false,
149+
},
150+
},
151+
152+
rules: {
153+
'mocha/no-exclusive-tests': 'error',
154+
},
155+
},
156+
{
157+
files: ['**/*.{int,comp}.js'],
158+
159+
languageOptions: {
160+
globals: {
161+
...globals.browser,
162+
},
163+
},
164+
},
165+
{
166+
files: ['**/templates/**/*.js'],
167+
168+
rules: {
169+
'import/no-unresolved': 0,
170+
'import/extensions': 0,
171+
'import/no-extraneous-dependencies': 0,
172+
},
173+
},
174+
{
175+
files: ['**/website/**/*.js'],
176+
177+
rules: {
178+
'react/jsx-filename-extension': 0,
179+
'react/no-multi-comp': 0,
180+
'react/prefer-stateless-function': 0,
181+
'import/no-extraneous-dependencies': 0,
182+
'import/no-unresolved': 0,
183+
},
184+
},
185+
]);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"cross-env": "10.0.0",
6262
"css-loader": "7.1.2",
6363
"enigma.js": "2.14.0",
64-
"eslint": "8.57.1",
64+
"eslint": "9.35.0",
6565
"eslint-config-airbnb": "19.0.4",
6666
"eslint-config-prettier": "10.1.8",
6767
"eslint-plugin-import": "2.32.0",
@@ -71,6 +71,7 @@
7171
"eslint-plugin-prettier": "5.5.4",
7272
"eslint-plugin-react": "7.37.5",
7373
"express": "5.1.0",
74+
"globals": "^16.3.0",
7475
"husky": "9.1.7",
7576
"jest": "^29.7.0",
7677
"jest-environment-jsdom": "^29.7.0",

0 commit comments

Comments
 (0)