-
Notifications
You must be signed in to change notification settings - Fork 4
/
eslint.config.mjs
86 lines (84 loc) · 2.3 KB
/
eslint.config.mjs
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
import pluginJs from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import parser from '@typescript-eslint/parser';
import pluginImport from 'eslint-plugin-import';
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
const commonRules = {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
...pluginReact.configs.recommended.rules,
...pluginImport.configs.rules,
...pluginReactHooks.configs.recommended.rules,
...pluginJsxA11y.configs.recommended.rules,
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'import/no-unresolved': 'off',
'react/prop-types': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'jsx-a11y/label-has-associated-control': 'off',
eqeqeq: 'error',
'no-undef': 'off',
'no-unused-vars': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
};
export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
languageOptions: {
globals: globals.browser,
parser: parser,
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
},
},
settings: {
react: {
version: 'detect',
},
},
plugins: {
'@typescript-eslint': tseslint,
react: pluginReact,
'react-hooks': pluginReactHooks,
import: pluginImport,
'jsx-a11y': pluginJsxA11y,
'simple-import-sort': pluginSimpleImportSort,
},
rules: {
...commonRules,
},
},
//! ts override (지우면 ts와 충돌)
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: parser,
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
project: ['./tsconfig.json'],
},
},
rules: {
...commonRules,
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
],
},
},
];