-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
89 lines (87 loc) · 2.04 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// @ts-check
import { fixupPluginRules } from '@eslint/compat';
import eslint from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import eslintConfigPrettier from 'eslint-config-prettier';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
name: 'exclude vite build output',
ignores: ['dist'],
},
{
name: 'eslint/recommended',
...eslint.configs.recommended,
},
...tseslint.configs.recommended,
{
name: 'react/recommended',
files: ['**/*.jsx', '**/*.tsx'],
...react.configs.flat.recommended,
},
{
name: 'react/jsx-runtime',
files: ['**/*.jsx', '**/*.tsx'],
...react.configs.flat['jsx-runtime'],
},
{
name: 'react-hooks/recommended',
plugins: {
'react-hooks': fixupPluginRules(reactHooks),
},
files: ['**/*.jsx', '**/*.tsx'],
rules: {
...reactHooks.configs.recommended.rules,
'react-hooks/exhaustive-deps': 'error',
},
},
{
name: 'react-refresh/only-export-components',
files: ['**/*.jsx', '**/*.tsx'],
plugins: {
'react-refresh': reactRefresh,
},
rules: {
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
},
},
{
name: 'add-browser-globals',
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.browser,
thisDoesntExist: 'writable',
},
parser: tsParser,
},
settings: {
react: {
version: 'detect',
},
},
},
{
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
{
name: 'prettier',
...eslintConfigPrettier,
}
);