-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.js
More file actions
122 lines (114 loc) ยท 3.43 KB
/
eslint.config.js
File metadata and controls
122 lines (114 loc) ยท 3.43 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";
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 { defineConfig } from "eslint/config";
import importPlugin from "eslint-plugin-import";
import typescriptParser from "@typescript-eslint/parser";
import eslintConfigPrettier from "eslint-config-prettier";
import react from "eslint-plugin-react";
export default defineConfig([
{
ignores: [
"dist",
"node_modules",
"build",
"*.config.js",
"*.config.ts",
"**/*.ejs",
],
},
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
js.configs.recommended,
...tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
{
files: ["**/*.{ts,tsx}"],
plugins: {
react,
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.app.json",
},
},
},
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
sourceType: "module",
parser: typescriptParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"no-var": "error", // var ๊ธ์ง
"no-console": ["warn", { allow: ["warn", "error"] }], // console.log ๊ฒฝ๊ณ
"no-unused-vars": "off", // ts ๋ฃฐ๋ก ๋์ฒดํจ
"@typescript-eslint/no-unused-vars": [
// ์ฌ์ฉํ์ง ์๋ ๋ณ์ ๊ฒฝ๊ณ
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/consistent-type-imports": [
// type import ์ฌ์ฉ ๊ถ์ฅ
"error",
{ prefer: "type-imports" },
],
"@typescript-eslint/no-explicit-any": "warn", // any ์ฌ์ฉ ๊ฒฝ๊ณ
"@typescript-eslint/no-non-null-assertion": "warn", // non-null assertion ๊ฒฝ๊ณ
"react-hooks/rules-of-hooks": "error", // Hooks ๊ท์น ์ค์
"react-hooks/exhaustive-deps": "warn", // useEffect ์์กด์ฑ ๋ฐฐ์ด ๊ฒ์ฌ
// ํ์ดํ ํจ์ ์ปดํฌ๋ํธ ์ฌ์ฉ ๊ถ์ฅ
"react/function-component-definition": [
"warn",
{
namedComponents: "arrow-function",
},
],
// import ์ ๋ ฌ order ์ค์
"import/order": [
"warn",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"type",
],
"newlines-between": "always",
alphabetize: { order: "asc", caseInsensitive: true },
},
],
"import/first": "error", // import๋ฌธ ์ต์๋จ ์์น
"import/no-duplicates": "error", // ์ค๋ณต import ๊ธ์ง
"import/no-unresolved": "off", // TS resolver๊ฐ ์ฒ๋ฆฌ
"import/default": "off", // default export ๋ถํ์ํ ๊ฒฝ๊ณ ์ ๊ฑฐ
"import/prefer-default-export": "off", // named export ์ฌ์ฉ(์ต์ ํ ๊ด์ )
// Prettier์ ์ถฉ๋ ๋ฐฉ์ง
"arrow-body-style": "off",
"prefer-arrow-callback": "off",
},
},
eslintConfigPrettier,
]);