-
Notifications
You must be signed in to change notification settings - Fork 0
/
react.js
147 lines (147 loc) · 3.63 KB
/
react.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
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
module.exports = {
env: {
node: false,
browser: true,
},
extends: [
"plugin:storybook/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:@tanstack/eslint-plugin-query/recommended",
"./index.js",
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
project: "tsconfig.json",
sourceType: "module",
},
overrides: [
{
files: ["App.tsx", "app.tsx"],
rules: {
"react/jsx-max-depth": "off",
},
},
{
files: ["*.styles.tsx", "*.styles.ts"],
rules: {
"max-lines": "off",
"react/no-multi-comp": "off",
},
},
{
files: ["*.stories.tsx"],
rules: {
"max-lines": "off",
"react/function-component-definition": "off",
"react/no-array-index-key": "off",
"react/no-multi-comp": "off",
"react-native/no-color-literals": "off",
},
},
],
plugins: ["react-hooks", "react-native", "react-perf"],
rules: {
"@typescript-eslint/no-floating-promises": "off",
"import-helpers/order-imports": [
"warn",
{
newlinesBetween: "never",
groups: [
"/^react/",
"module",
"/^@/",
"/^~/",
["parent", "sibling", "index"],
],
alphabetize: {
order: "asc",
ignoreCase: true,
},
},
],
"max-lines-per-function": [
"warn",
{
max: 100,
skipBlankLines: true,
skipComments: true,
},
],
"react/boolean-prop-naming": [
"warn", // react/boolean-prop-naming is not working at the moment
{
rule: "^(is|has|should)[A-Z]([A-Za-z0-9]?)+",
validateNested: true,
propTypeNames: ["bool", "boolean"],
},
],
"react/destructuring-assignment": [
"warn",
"always",
{ destructureInSignature: "always" },
],
"react/function-component-definition": [
"warn",
{
namedComponents: "function-declaration",
},
],
"react/jsx-boolean-value": ["warn", "never"],
"react/jsx-fragments": ["warn"],
"react/jsx-key": "warn",
"react/jsx-max-depth": ["warn", { max: 4 }],
"react/jsx-no-constructed-context-values": "warn",
"react/jsx-no-leaked-render": ["warn"],
"react/jsx-no-useless-fragment": "off",
"react/jsx-pascal-case": [
"warn",
{
allowLeadingUnderscore: false,
},
],
"react/jsx-wrap-multilines": [
"warn",
{
declaration: "parens",
assignment: "parens",
return: "parens",
arrow: "parens",
condition: "parens",
logical: "parens",
prop: "parens",
},
],
"react/no-array-index-key": "warn",
"react/no-multi-comp": "warn",
"react/no-unescaped-entities": "off",
"react/no-unstable-nested-components": ["warn"],
"react/self-closing-comp": [
"warn",
{
component: true,
html: true,
},
],
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
"react-native/no-color-literals": "warn",
"react-native/no-inline-styles": "warn",
"react-native/no-raw-text": "off",
"react-native/no-single-element-style-arrays": "warn",
"react-native/no-unused-styles": "warn",
"react-native/split-platform-components": "warn",
"react-perf/jsx-no-jsx-as-prop": "warn",
"react-perf/jsx-no-new-array-as-prop": "warn",
"react-perf/jsx-no-new-function-as-prop": "warn",
"react-perf/jsx-no-new-object-as-prop": "warn",
},
settings: {
react: {
version: "detect",
},
},
};