-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
116 lines (114 loc) · 3.7 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
{
"root": true,
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"react-app",
"react-app/jest",
"eslint:recommended",
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from @typescript-eslint/eslint-plugin
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
"plugin:react-hooks/recommended",
"plugin:jest/recommended",
"plugin:jest/style",
"prettier"
],
"parserOptions": {
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true // Allows for the parsing of JSX
}
},
"env": {
"browser": true,
"node": true,
"jest": true,
"es6": true
},
"rules": {
"@typescript-eslint/ban-ts-comment": "error",
"prettier/prettier": "warn",
"react/prop-types": "off", // We use TypeScript to document our Components.
"react/display-name": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/array-type": ["error", { "default": "array" }],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Array": null
}
}
],
"no-return-await": "warn",
"no-trailing-spaces": [
"error",
{
"ignoreComments": true
}
],
"no-fallthrough": "error",
"jest/valid-expect": ["error", { "maxArgs": 2 }],
"jest/require-top-level-describe": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{ "argsIgnorePattern": "^_" }
], // Allow unused vars when prefixed with underscore
"jest/no-commented-out-tests": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"no-console": "warn",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true
}
],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"curly": ["warn", "all"],
"eqeqeq": ["error", "allow-null"],
"import/no-cycle": "off", // TODO: Enabling this slows down VSCode ESLint plugin - https://github.com/microsoft/vscode-eslint/issues/1431
"react/react-in-jsx-scope": "off"
},
"overrides": [
{
// Unit tests
"files": ["*.{spec,test}.{ts,tsx}", "**/tests/**"],
"rules": {
"no-console": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off"
}
},
{
"files": ["*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off"
}
}
],
"settings": {
"react": {
"pragma": "React",
"version": "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
"project": ["libs/*/tsconfig.json", "services/*/**/tsconfig.json"]
}
}
}
}