-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
.eslintrc.json
109 lines (105 loc) · 3.8 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
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["import", "local-rules", "formatjs", "react-refresh", "simple-import-sort"],
"overrides": [
{
"files": ["playwright/**/*.ts"],
"parserOptions": {
"project": "./playwright/tsconfig.json"
},
"rules": {
"no-console": "off"
}
},
{
"files": ["src/**/*.test.*", "src/**/*.stories.*"],
"rules": {
"react-refresh/only-export-components": "off"
}
}
],
"rules": {
"import/no-duplicates": "error",
"import/no-extraneous-dependencies": "off", // imports are handled by simple-import-sort/sort
"import/no-internal-modules": "off", // imports are handled by simple-import-sort/sort
"import/order": "off", // imports are handled by simple-import-sort/sort
"sort-imports": "off", // imports are handled by simple-import-sort/sort
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"react-refresh/only-export-components": "warn",
"lines-between-class-members": ["error", "always"],
"padding-line-between-statements": [
"error",
// After directives (like 'use-strict'), except between directives
{ "blankLine": "always", "prev": "directive", "next": "*" },
{ "blankLine": "any", "prev": "directive", "next": "directive" },
// After imports, except between imports
{ "blankLine": "always", "prev": "import", "next": "*" },
{ "blankLine": "any", "prev": "import", "next": "import" },
// Before and after every sequence of variable declarations
{ "blankLine": "always", "prev": "*", "next": ["const", "let", "var"] },
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
// Before and after class declaration, if, while, switch, try
{ "blankLine": "always", "prev": "*", "next": ["class", "if", "while", "switch", "try"] },
{ "blankLine": "always", "prev": ["class", "if", "while", "switch", "try"], "next": "*" },
// Before return statements
{ "blankLine": "always", "prev": "*", "next": "return" }
],
"formatjs/enforce-id": [
"error",
{
"idInterpolationPattern": "[sha512:contenthash:base64:6]"
}
],
"local-rules/named-styles": "error",
"no-restricted-imports": [
"error",
{
"paths": ["lodash", "@material-ui/icons/Delete", "classnames"]
}
],
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
// Decided to turn off:
"react/prop-types": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
// Migration in progress:
// Tracked in https://github.com/saleor/saleor-dashboard/issues/3813
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off"
},
"ignorePatterns": ["node_modules/", "**/types/**/*", "type-policies.ts", "playwright/auth.js"]
}