-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
148 lines (138 loc) · 4.18 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import {fixupConfigRules, fixupPluginRules} from "@eslint/compat"
import prettier from "eslint-plugin-prettier"
import writeGoodComments from "eslint-plugin-write-good-comments"
import functional from "eslint-plugin-functional"
import promise from "eslint-plugin-promise"
import tsParser from "@typescript-eslint/parser"
import path from "node:path"
import {fileURLToPath} from "node:url"
import js from "@eslint/js"
import {FlatCompat} from "@eslint/eslintrc"
import sonarjs from "eslint-plugin-sonarjs"
import noUseExtendNative from "eslint-plugin-no-use-extend-native"
import love from "eslint-config-love"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
{
files: ["**/*.ts", "**/*.tsx"],
ignores: [
"**/dist",
"**/.github",
"**/.storybook/**",
"src/stories/**",
"**/github",
"**/vite.config.ts",
"!**/.storybook¡",
"**/commitlint.config.ts",
"**/node_modules",
"**/index.html",
"**/postcss.config.js",
],
},
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
"plugin:prettier/recommended",
"eslint-config-prettier",
"plugin:tailwindcss/recommended",
"plugin:github/react",
"plugin:unicorn/recommended",
"plugin:deprecation/recommended",
"plugin:jsx-a11y/recommended",
"plugin:import/typescript",
"plugin:regexp/recommended"
)
),
{
plugins: {
"prettier": fixupPluginRules(prettier),
"write-good-comments": fixupPluginRules(writeGoodComments),
"functional": fixupPluginRules(functional),
"promise": fixupPluginRules(promise),
"sonarjs": fixupPluginRules(sonarjs),
"noUseExtendNative": fixupPluginRules(noUseExtendNative),
"love": fixupConfigRules(love),
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: "./tsconfig.json",
},
},
settings: {
"react": {
version: "detect",
},
"import/extensions": [".ts", ".tsx"],
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
},
},
rules: {
"prettier/prettier": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"operator-linebreak": "off",
"multiline-ternary": "off",
"react/no-children-prop": "off",
"prefer-regex-literals": "off",
"no-useless-escape": "off",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"no-new": "off",
"sonarjs/cognitive-complexity": ["error", 17],
"unicorn/filename-case": ["off"],
"unicorn/prevent-abbreviations": ["off"],
"unicorn/no-nested-ternary": "off",
"unicorn/no-null": ["off"],
"unicorn/prefer-code-point": "off",
"write-good-comments/write-good-comments": [
"warn",
{
passive: false,
whitelist: ["read-only"],
},
],
"@typescript-eslint/no-throw-literal": "off",
"promise/always-return": "off",
"unicorn/number-literal-case": "off",
"unicorn/prefer-spread": "off",
"jsx-a11y/media-has-caption": [0],
"unicorn/prefer-global-this": "off",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
]