-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
114 lines (114 loc) · 2.75 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
module.exports = {
env: {
browser: true,
es6: true,
},
extends: ['airbnb', 'prettier'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', 'react-hooks', 'prettier', 'import'],
rules: {
// preact uses class instead of className
'react/no-unknown-property': [2, { ignore: ['class'] }],
// don't use these they are bad
'no-restricted-syntax': [2, 'LabeledStatement', 'WithStatement'],
// Allow these to be unused
'no-unused-vars': [
1,
{
ignoreRestSiblings: true,
argsIgnorePattern: 'res|next',
},
],
/**
* in a destructure statement error if anything assigned
* with let could be const because not reassigned
*/
'prefer-const': [
'error',
{
destructuring: 'any',
},
],
// Only force braces if needed for syntax
'arrow-body-style': [2, 'as-needed'],
// allow using tagged template literals
'no-unused-expressions': [
2,
{
allowTaggedTemplates: true,
},
],
// warn for console logs
'no-console': 1,
// no
'import/prefer-default-export': 0,
// require naming functions when can't be inferred, helps debugging
'func-names': [2, 'as-needed'],
// max line length of 80
'max-len': [1, { code: 80 }],
// error missing extensions if not js/jsx
'import/extensions': [2, { js: 'never', jsx: 'never' }],
// Allow import of preact/hooks provided by preact
'import/no-extraneous-dependencies': 0,
// allow empty returns
'consistent-return': 0,
// don't require importing react
'react/react-in-jsx-scope': 0,
// don't care about prop types missing
'react/prop-types': 0,
// allow js or js
'react/jsx-filename-extension': [
1,
{
extensions: ['.js', '.jsx'],
},
],
'no-shadow': [
2,
{
hoist: 'all',
allow: ['resolve', 'reject', 'done', 'next', 'err', 'error'],
},
],
// single quotes, but double allowed to prevent escaping
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
// Don't want semi colons
semi: [2, 'never'],
'prettier/prettier': [
'error',
{
trailingComma: 'es5',
singleQuote: true,
semi: false,
jsxSingleQuote: true,
printWidth: 80,
tabWidth: 2,
},
],
// warn for not listing all used variables in deps
'react-hooks/exhaustive-deps': 1,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
}