forked from thomvaill/log4brains
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
85 lines (85 loc) · 2.74 KB
/
.eslintrc.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
module.exports = {
root: true,
env: {
es2021: true
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
project: "./tsconfig.json"
},
ignorePatterns: ["**/*.js", "**/*.d.ts", "dist", "node_modules"],
plugins: ["jest", "sonarjs", "promise", "@typescript-eslint", "react"],
extends: [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:sonarjs/recommended",
"plugin:promise/recommended",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"prettier/@typescript-eslint",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"airbnb/hooks",
"prettier/react"
],
rules: {
"import/prefer-default-export": "off", // @adr 20200927-avoid-default-exports
"import/no-default-export": "error", // @adr 20200927-avoid-default-exports
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
"sonarjs/no-duplicate-string": "off",
"react/prefer-stateless-function": [2, { ignorePureComponents: false }],
"react/function-component-definition": [
2,
{
namedComponents: "function-declaration",
unnamedComponents: "arrow-function"
}
],
"react/require-default-props": [2, { ignoreFunctionalComponents: true }], // DefaultProps are deprecated for functional components (https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md)
"react/jsx-props-no-spreading": "off", // For HOC
"no-void": [2, { allowAsStatement: true }], // For React.useEffect() with async functions
"react/display-name": "off"
},
overrides: [
{
files: ["*.ts", "*.tsx"] // Forces Jest to include these files
},
{
files: "*.tsx",
rules: {
"sonarjs/cognitive-complexity": [2, 18], // React functions are usually more complex
"@typescript-eslint/explicit-module-boundary-types": "off" // @adr web/20200927-avoid-react-fc-type
}
},
{
files: ["src/**/*.stories.tsx"], // Storybook
rules: {
"import/no-extraneous-dependencies": "off",
"import/no-default-export": "off",
"react/function-component-definition": "off"
}
},
{
files: "*", // All non-React files
excludedFiles: "*.tsx",
rules: {
"react/static-property-placement": "off"
}
},
{
files: "**.test.ts", // Jest
rules: {
"max-classes-per-file": "off",
"import/no-extraneous-dependencies": "off",
"no-new": "off",
"no-empty": "off"
}
}
]
};