forked from streetmix/streetmix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
146 lines (146 loc) · 4.15 KB
/
.eslintrc
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
{
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"babelOptions": {
"plugins": [
// Import attributes are required to import JSON
// Deprecated syntax must be used to support Node < 20.10.0
// We cannot switch to "with" syntax until "assert" is fully removed
[
"@babel/plugin-syntax-import-attributes",
{ "deprecatedAssertSyntax": true }
]
]
}
},
"env": {
"browser": true,
"cypress/globals": true,
"node": true,
"es6": true,
"mocha": true
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["react", "cypress", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"standard",
"standard-jsx",
"standard-react",
"plugin:import/errors",
"plugin:import/warnings"
],
"rules": {
"import/no-unresolved": 0,
"import/order": ["warn", {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
"pathGroups": [
{
"pattern": "~/**",
"group": "internal"
}
]
}],
"jsx-quotes": ["error", "prefer-double"],
"react/jsx-boolean-value": ["error", "always"],
"react/jsx-no-bind": 0,
"no-restricted-globals": [
"error",
{
"name": "isNaN",
"message": "Use Number.isNaN() instead of the global isNan()."
},
{
"name": "isFinite",
"message": "Use Number.isFinite() instead of the global isFinite()."
},
{
"name": "parseInt",
"message": "Use Number.parseInt() instead of the global parseInt()."
},
{
"name": "parseFloat",
"message": "Use Number.parseFloat() instead of the global parseFloat()."
}
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
"overrides": [
// Only run TypeScript linting on TypeScript files, otherwise it'd
// report TypeScript errors on regular JavaScript files (bad!)
{
"files": ["client/**/*.ts", "client/**/*.tsx", "packages/types/**/*.ts"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"standard-with-typescript"
],
"settings": {
"import/resolver": {
"typescript": true,
"node": true
}
},
// TODO: set up project-specific eslint "flat config" (eslint v9) inside
// of client package
"parserOptions": {
"tsconfigRootDir": "client",
"project": "./tsconfig.json"
},
"rules": {
// This was added as an error in eslint-config-standard-with-typescript
// v42.0.0 and is much too strict while parts of the app are still in JS
// Warnings indicate opportunities for typescript porting
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/strict-boolean-expressions": [
2,
{
"allowString": true
}
],
// Turns off an error that was only reporting for useIntl
// see https://github.com/formatjs/formatjs/issues/4133
"@typescript-eslint/unbound-method": "off"
}
},
{
"files": ["packages/export-image/**/*.ts"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"standard-with-typescript"
],
"settings": {
"import/resolver": {
"typescript": true,
"node": true
}
},
// TODO: set up project-specific eslint "flat config" (eslint v9)
"parserOptions": {
"tsconfigRootDir": "packages/export-image",
"project": "./tsconfig.json"
},
"rules": {
// Allow legacy __dirname and __filename variables
"@typescript-eslint/naming-convention": "off"
}
}
],
"root": true
}