-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
eslint.config.js
87 lines (82 loc) · 2.67 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
import react from 'eslint-plugin-react';
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import importPlugin from 'eslint-plugin-import';
import reactCompiler from 'eslint-plugin-react-compiler';
export default tseslint.config(
{ ignores: ['dist', 'vite.config.ts', '**/env.d.ts', '**/vite-env.d.ts'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended, importPlugin.flatConfigs.recommended],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: { ...globals.browser },
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
'react-hooks': reactHooks,
'react-compiler': reactCompiler,
'react-refresh': reactRefresh,
'simple-import-sort': simpleImportSort,
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-compiler/react-compiler': 'error',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'react/react-in-jsx-scope': 'off',
camelcase: 'error',
'spaced-comment': 'error',
quotes: ['error', 'single'],
'no-duplicate-imports': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'warn',
'sort-imports': 'off',
'import/order': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'off',
'import/no-duplicates': 'error',
'@next/next/no-img-element': 'off',
'brace-style': ['error', '1tbs'],
curly: ['error', 'all'],
'react/jsx-curly-brace-presence': [
'error',
{
props: 'never',
},
],
'object-shorthand': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'prefer-arrow-callback': 'error',
'react/function-component-definition': [
2,
{ namedComponents: 'function-declaration', unnamedComponents: 'arrow-function' },
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'no-irregular-whitespace': 'off',
'import/no-unresolved': ['error', { ignore: ['^virtual:'] }],
},
},
);