-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
127 lines (122 loc) · 3.05 KB
/
.eslintrc.cjs
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
const { resolve } = require("path");
module.exports = {
ignorePatterns: [
"/*",
"!src/",
],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:jsx-a11y/recommended",
"@electron-toolkit/eslint-config-ts/recommended",
"@electron-toolkit/eslint-config-prettier",
],
settings: {
react: {
version: "detect",
},
"import/resolver": {
[resolve("./electron-vite-resolver.cjs")]: {
viteConfigPath: "./electron.vite.config.cjs",
// Turn on resolver logs by uncommenting this line
// debug: true,
},
},
},
rules: {
// General Rules
camelcase: "warn",
"sort-imports": [
"error",
{
ignoreDeclarationSort: true,
},
],
"@typescript-eslint/explicit-function-return-type": "off",
// React Rules
"react/button-has-type": "warn",
"react/checked-requires-onchange-or-readonly": "warn",
"react/function-component-definition": [
"error",
{
unnamedComponents: "arrow-function",
namedComponents: "function-declaration",
},
],
"react/hook-use-state": "warn",
"react/jsx-boolean-value": "warn",
"react/jsx-curly-newline": "warn",
"react/jsx-no-useless-fragment": "error",
"react/jsx-pascal-case": "warn",
"react/no-array-index-key": "warn",
"react/no-multi-comp": "warn",
"react/void-dom-elements-no-children": "error",
// React Hooks Rules
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// import Rules
"import/no-deprecated": "warn",
"import/no-empty-named-blocks": "error",
"import/no-mutable-exports": "error",
"import/no-unused-modules": "warn",
"import/no-cycle": "error",
"import/no-useless-path-segments": "error",
"import/consistent-type-specifier-style": [
"error",
"prefer-inline"
],
"import/first": "warn",
"import/newline-after-import": [
"warn",
{
count: 1,
exactCount: true,
considerComments: true,
},
],
"import/no-default-export": "error",
// Import Sorting
"import/order": [
"warn",
{
"newlines-between": "never",
distinctGroup: false,
alphabetize: {
order: "asc",
caseInsensitive: true,
},
groups: [
"builtin",
"external",
"internal",
"sibling",
"parent",
"type",
"index",
],
pathGroups: [
{
pattern: "react",
group: "external",
position: "before",
},
{
pattern: "~/**",
group: "internal",
position: "before",
},
{
pattern: "$*",
group: "internal",
position: "before",
},
],
pathGroupsExcludedImportTypes: ["react"],
},
],
},
};