This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path.eslintrc.js
100 lines (92 loc) · 2.83 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* eslint-env node */
module.exports = {
parser: "@typescript-eslint/parser",
root: true,
env: {
browser: true,
es6: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true,
},
ecmaVersion: 2021,
sourceType: "module",
},
extends: [
"problems",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/flowtype",
"prettier/react",
"prettier/standard",
],
plugins: ["prettier", "react", "react-hooks"],
rules: {
// Enable prettier
"prettier/prettier": "error",
// No consoles!
"no-console": "error",
// We're not creating PropTypes anywhere so don't both checking for them
"react/prop-types": "off",
// This should be suggested but not required as it will prevent us from
// using anon render functions
"react/display-name": "off",
/**
* React hooks
*/
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
// In favor of @typescript-eslint variants
"no-use-before-define": "off",
// The default for this rule requires that we define typedefs before we use
// them, which is silly because that can't cause a bug because typedefs are
// stripped from the transpiled code.
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: true, typedefs: false, variables: true },
],
// Remove stylistic rules recommended by @typescript-eslint because they
// don't actually catch any bugs
// @see https://github.com/typescript-eslint/typescript-eslint/issues/651
"@typescript-eslint/array-type": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/type-annotation-spacing": "off",
// I found this doesn't play well with react because it requires us to
// declare `state` and `render` as public methods. Why do we even bother?
"@typescript-eslint/explicit-member-accessibility": "off",
},
overrides: [
{
files: ["**/*.story.*", ".storybook/**", "stories/**"],
env: {
node: true,
},
},
{
files: ["*.mdx"],
extends: ["plugin:mdx/overrides", "plugin:mdx/recommended"],
env: {
commonjs: true,
},
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
},
},
],
settings: {
react: {
version: "detect",
},
},
};