-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.json
More file actions
98 lines (98 loc) · 3.41 KB
/
.eslintrc.json
File metadata and controls
98 lines (98 loc) · 3.41 KB
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
{
"parser": "@typescript-eslint/parser",
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"extraFileExtensions": [".mjs"],
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
},
"project": "./tsconfig.json"
},
"extends": [
"react-app",
"react-app/jest",
"plugin:unicorn/recommended",
"plugin:prettier/recommended"
],
"plugins": ["react", "jsx-a11y", "import", "prettier", "unicorn"],
"settings": {
"react": { "version": "detect" },
"import/resolver": { "typescript": {} }
},
"rules": {
// React is imported in the entrypoint or _app.js
"react/react-in-jsx-scope": "off",
// Allow JSX in typescript files
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }],
// Frameworks like Next and Flareact have specific Link components
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": ["Link"],
"specialLink": ["hrefLeft", "hrefRight"],
"aspects": ["invalidHref", "preferButton"]
}
],
// Some abbreviations are (or will soon be) clear even for new programmers
"unicorn/prevent-abbreviations": [
"error",
{
"replacements": {
"props": { "properties": false },
"ref": { "reference": false },
"env": { "environment": false },
"fn": { "function": false }
}
}
],
// Waiting for AirBnb upgrade: https://github.com/typescript-eslint/typescript-eslint/issues/2077#issuecomment-634811363
"@typescript-eslint/camelcase": "off",
// Conflict between prettier and eslint-unicorn
"react/jsx-wrap-multilines": "off",
// Allow forOfStatements
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
// Continue is viable in forOf loops in generators
"no-continue": "off",
// Spreading is needed in case of forwarding props
"react/jsx-props-no-spreading": "off",
// Allow inline <strong> tags
"react/jsx-one-expression-per-line": "off",
// React components should be able to return null
"unicorn/no-null": "off",
// Redux and Immer use prop reassign by design
"no-param-reassign": ["error", { "props": false }],
// For react components it's not always useful to move small methods up in scope
"unicorn/consistent-function-scoping": ["error", { "checkArrowFunctions": false }],
// From experience, named exports are almost always desired. I got tired of this rule
"import/prefer-default-export": "off",
// Firebase requires importing each module that's used
"import/no-duplicates": "off",
// Unused vars are useful to keep method signatures consistent and documented
"@typescript-eslint/no-unused-vars": "off",
// Found false positive, not correctly detecting try catch, then autofixed and broke some code
"@typescript-eslint/return-await": "off",
// For this project don't use kebab-case
"unicorn/filename-case": [
"error",
{
"cases": {
"camelCase": true,
"pascalCase": true
},
"ignore": [".d.ts"]
}
],
// in typescript having fn({}: Props) is very useful for boilerplate
"no-empty-pattern": "off",
// Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration'
"unicorn/prefer-spread": "off"
}
}