-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheslint.config.js
More file actions
53 lines (50 loc) · 1.48 KB
/
Copy patheslint.config.js
File metadata and controls
53 lines (50 loc) · 1.48 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
import js from "@eslint/js"
import globals from "globals"
import pluginReact from "eslint-plugin-react"
import pluginReactHooks from "eslint-plugin-react-hooks"
import stylistic from "@stylistic/eslint-plugin"
import { defineConfig } from "eslint/config"
export default defineConfig([
{
// 必须在单独块中来全局忽略
ignores: ["dist/**", "src/**"]
},
{
files: ["**/*.{js,jsx,mjs}"],
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
},
plugins: {
"react": pluginReact,
"@stylistic": stylistic
},
extends: [
js.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
pluginReactHooks.configs.flat.recommended,
stylistic.configs.recommended
],
rules: {
// React
"react/prop-types": "off",
// React Hooks
"react-hooks/set-state-in-effect": "off",
// Stylistic
"@stylistic/arrow-parens": ["error", "always"],
"@stylistic/brace-style": "off",
"@stylistic/comma-dangle": ["error", "never"],
"@stylistic/jsx-first-prop-new-line": ["error", "multiline"],
"@stylistic/jsx-one-expression-per-line": ["error", { allow: "non-jsx" }],
"@stylistic/jsx-quotes": ["error", "prefer-double"],
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/quotes": ["error", "double"]
},
settings: {
react: { version: "detect" }
}
}
])