-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patheslint.config.js
107 lines (100 loc) Β· 2.99 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import prettierPlugin from "eslint-plugin-prettier";
import importPlugin from "eslint-plugin-import";
const airbnbRules = {
// Airbnb μ€νμΌ κ°μ΄λμ ν΅μ¬ κ·μΉλ€
"no-var": "error",
"prefer-const": "error",
"prefer-template": "error",
"no-param-reassign": "error",
"object-shorthand": "error",
"prefer-destructuring": ["error", { array: true, object: true }],
"no-array-constructor": "error",
"func-style": ["error", "expression"],
"arrow-parens": ["error", "always"],
"arrow-body-style": ["warn", "as-needed"],
"no-duplicate-imports": "error",
"one-var": ["error", "never"],
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"spaced-comment": ["error", "always"],
"no-underscore-dangle": "off",
"max-len": ["warn", { code: 100, ignoreComments: true }],
// Import κ·μΉ
"import/prefer-default-export": "off",
"import/no-default-export": "off",
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
};
/** @type {import('eslint').Linter.FlatConfig[]} */
const config = [
js.configs.recommended,
// κ³΅ν΅ μ€μ
{
files: ["**/*.{ts,tsx,js,jsx}"],
plugins: {
"@typescript-eslint": tseslint,
prettier: prettierPlugin,
import: importPlugin,
},
languageOptions: {
parser: tsparser,
ecmaVersion: 2022,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
// Airbnb κ·μΉ
...airbnbRules,
// TypeScript
...tseslint.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": [
"warn",
{
varsIgnorePattern:
"^(js|Injectable|Controller|Get|Post|Put|Delete|Patch|Options|Head|All)$",
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
// Prettier
...prettierPlugin.configs.recommended.rules,
// κ°λ° μ΄κΈ° λ¨κ³λ₯Ό μν κ·μΉ μν
"no-console": "off",
"no-unused-vars": "off", // TypeScript ruleμ λμ μ¬μ©
"no-undef": "off", // TypeScriptμμ μ²λ¦¬
},
},
{
ignores: [
"**/node_modules/",
"**/dist/",
"**/build/",
"**/coverage/",
"**/*.config.js",
"**/src/**/*.test.js",
"**/public/*",
"client/styled-system/",
],
},
// μ€μ νμΌμ λν νΉλ³ κ·μΉ
{
files: ["**/eslint.config.js", "**/prettier.config.js", "**/vite.config.ts"],
rules: {
"@typescript-eslint/no-unused-vars": "off",
"import/no-unused-modules": "off",
},
},
];
export default config;