Skip to content

Commit 85199b5

Browse files
committed
Upgrade eslint to v9
1 parent 977c3d7 commit 85199b5

File tree

17 files changed

+296
-442
lines changed

17 files changed

+296
-442
lines changed

.eslintrc

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

babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
const ENV = process.env.BABEL_ENV || process.env.NODE_ENV || 'development';
32

43
let config = {

eslint.config.mjs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import eslint from '@eslint/js';
2+
import { includeIgnoreFile } from '@eslint/compat';
3+
import path from 'node:path';
4+
5+
import globals from 'globals';
6+
import reactPlugin from 'eslint-plugin-react';
7+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
8+
import reactPerfPlugin from 'eslint-plugin-react-perf';
9+
import importPlugin from 'eslint-plugin-import';
10+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
11+
12+
const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
13+
14+
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
15+
export default [
16+
includeIgnoreFile(gitignorePath),
17+
{
18+
name: 'global ignore',
19+
// If ignores is used without any other keys in the configuration object,
20+
// then the patterns act as global ignores.
21+
ignores: []
22+
},
23+
eslint.configs.recommended,
24+
reactPlugin.configs.flat.recommended,
25+
importPlugin.flatConfigs.errors,
26+
reactPerfPlugin.configs.flat['recommended'],
27+
{
28+
plugins: { 'react-hooks': reactHooksPlugin },
29+
settings: {
30+
// version config for eslint-plugin-react
31+
react: {
32+
version: 'detect'
33+
}
34+
}
35+
},
36+
prettierRecommended,
37+
{
38+
name: 'src and test rules',
39+
files: ['packages/*/+(src|test)/**/*'],
40+
languageOptions: {
41+
globals: {
42+
...globals.browser,
43+
process: 'readonly'
44+
}
45+
},
46+
rules: {
47+
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
48+
'no-console': 'error',
49+
'react/prop-types': 'off',
50+
'prefer-object-spread': 'warn',
51+
'react-hooks/rules-of-hooks': 'error',
52+
'react/jsx-no-constructed-context-values': 'error'
53+
}
54+
},
55+
{
56+
name: 'jest tests',
57+
files: [`packages/*/test/**`],
58+
languageOptions: {
59+
globals: {
60+
...globals.jest,
61+
...globals.node
62+
}
63+
},
64+
rules: {
65+
'react/prop-types': 'off',
66+
'react/display-name': 'off',
67+
'react-perf/jsx-no-new-object-as-prop': 'off',
68+
'react-perf/jsx-no-new-function-as-prop': 'off',
69+
'react-perf/jsx-no-new-array-as-prop': 'off'
70+
}
71+
},
72+
{
73+
// rules for everybody else
74+
ignores: [`packages/*/+(src|test)/**`],
75+
languageOptions: {
76+
globals: {
77+
...globals.node
78+
}
79+
}
80+
}
81+
];

0 commit comments

Comments
 (0)