forked from Chia-Network/chia-blockchain-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
executable file
·161 lines (158 loc) · 5.99 KB
/
.eslintrc.json
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
149
150
151
152
153
154
155
156
157
158
159
160
161
// To add or update the rule, please make a separate PR with only this file changed
// PRs where a rule is changed within a lager PR will be rejected.
//
// To print currently used rules (AirBnB + our overrides) run:
// npx eslint --print-config .eslintrc.json
{
"extends": [
// airbnb is replaced with airbnb-base and airbnb/rules/react to exclude jsx-a11y
"airbnb-base",
"airbnb/rules/react",
"airbnb/hooks",
"airbnb-typescript",
"plugin:eslint-comments/recommended",
"prettier"
],
"env": {
"browser": true,
"es2020": true,
"node": true,
"jest": true
},
"parserOptions": {
"project": "./packages/*/tsconfig.json"
},
// Allow electron to be only a devDependency instead of normal dependency
"settings": {
"import/core-modules": ["electron"]
},
"plugins": ["unicorn"],
// Airbnb rule overrides and additions
"rules": {
// Automatically order imports
"import/order": [
"error",
{ "groups": ["builtin", "external", "internal"], "alphabetize": { "order": "asc" }, "newlines-between": "always" }
],
// Already taken care of by import/order. This must stay here, so require(); is before any import
"import/first": "off",
// Require a reason for disabling a rule via disable-line
"eslint-comments/require-description": "error",
// Do not allow unused disable-line
"eslint-comments/no-unused-disable": "error",
// Allow single line disables (overrides the eslint-comments defaults)
"eslint-comments/disable-enable-pair": "off",
// We use TS instead of prop-types
"react/prop-types": "off",
// TS takes care of this
// .defaultProps are deprecated for functional components: https://github.com/facebook/react/pull/16210
// "functions": "defaultArguments" was not used since it requires to do the props destructuring in the function signature
"react/require-default-props": "off",
// We do not see the value of this turned on
"no-plusplus": "off",
// We do not see the value of this turned on
"react/jsx-props-no-spreading": "off",
// We do not see the value of this turned on
"react/destructuring-assignment": "off",
// Only functions can be used before assigning
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false, "variables": true }],
// Add additional directories to the default airbnb list
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
// these are defaults from airbnb
"test/**",
"tests/**",
"spec/**",
"**/__tests__/**",
"**/__mocks__/**",
"test.{js,jsx}",
"test-*.{js,jsx}",
"**/*{.,_}{test,spec}.{js,jsx}",
"**/jest.config.js",
"**/jest.setup.js",
"**/vue.config.js",
"**/webpack.config.js",
"**/webpack.config.*.js",
"**/rollup.config.js",
"**/rollup.config.*.js",
"**/gulpfile.js",
"**/gulpfile.*.js",
"**/Gruntfile{,.js}",
"**/protractor.conf.js",
"**/protractor.conf.*.js",
"**/karma.conf.js",
"**/.eslintrc.js",
// These are our custom additions
// Add any directory or file here that is used in development or CI only
"**/@types/**",
"**/test/**",
"**/tests/**",
"**/cypress/**",
"**/vite.config.ts",
"**/babel.config.js",
"**/playwright.config.js",
// You can change the file name extension to .dev.ts to avoid the: "XX should be listed in the project's dependencies, not devDependencies."
"**/*.dev.{js,jsx,ts,tsx}"
],
"optionalDependencies": false
}
],
// The airbnb default has ignoreCase: true
"react/jsx-no-duplicate-props": ["error", { "ignoreCase": false }],
// We often want named export even if there is only one at the beginning
"import/prefer-default-export": "off",
// So we do not forget to remove console.logs after debugging
"no-console": ["error", { "allow": ["warn", "error", "info"] }],
// Better readability
"react/no-unescaped-entities": "off",
// Useless - the warning that it is dangerous is in the property name
"react/no-danger": "off",
// Prettier will make it obvious that its a nested ternary
"no-nested-ternary": "off",
// We do not see the value of this turned on
"prefer-rest-params": "off",
// These issues should be decided and reported in typescript config
"@typescript-eslint/no-explicit-any": "off",
// Adding _ will bypass no-used issues
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_"
}
],
// required for TS where string does not satisfy the expected return type of JSX.Element
"react/jsx-no-useless-fragment": ["error", { "allowExpressions": true }],
// Memoizing all prop callbacks would speed up the app but introduce a hard to debug bugs (wrong memo dependencies)
"react/jsx-no-bind": "off",
// This code should be allowed `export { default } from './Link';`
// Remove "no-restricted-exports" after eslint fixes issue https://github.com/eslint/eslint/issues/15617
"no-restricted-exports": [
"error",
{
"restrictedNamedExports": ["then"]
}
],
// We use a lot of large numbers. This rule enforce large number has to use separator. Example: 1_000_000
"unicorn/numeric-separators-style": "error",
// Airbnb is too restrictive
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true,
"allowTaggedTemplates": true,
"enforceForJSX": false
}
],
// We do not see the value of this turned on
"class-methods-use-this": "off"
//
// ** Before adding or updating any rule, please read the comments at the top of this file
//
}
}