forked from emilmor/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
164 lines (162 loc) · 4.48 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
const prettierConfig = require('./prettier.config');
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'cypress',
'prettier',
'ava',
'jsdoc',
'promise',
'graphql',
'react-hooks',
'@typescript-eslint',
],
extends: [
'airbnb',
'prettier',
'prettier/react',
'plugin:cypress/recommended',
// 'plugin:@typescript-eslint/recommended',
// "plugin:promise/recommended" @todo turn this back and .then() fix every error
],
env: {
'cypress/globals': true,
},
globals: {
document: true,
window: true,
fetch: true,
},
settings: {
'import/resolver': {
// use an array of glob patterns
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root/>@types` directory even it doesn't contain any source code, like `@types/unist`
// can glob
directory: ['./tsconfig.base.json'],
},
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/explicit-function-return-type': [0],
// '@typescript-eslint/interface-name-prefix': [
// 1,
// {
// prefixWithI: 'always',
// allowUnderscorePrefix: true,
// },
// ],
'valid-jsdoc': [0],
'react/state-in-constructor': [0],
},
},
],
rules: {
'consistent-return': [0],
'import/no-extraneous-dependencies': [0],
'import/prefer-default-export': [0],
'import/dynamic-import-chunkname': [0],
'import/no-dynamic-require': [0],
'import/no-unresolved': [
2,
{
ignore: [
// docs-site's docusaurus uses this custom webpack alias to point to current theme and it's overrides
'^@theme',
'^@docusaurus',
],
},
],
'jsdoc/check-types': 'error',
'jsx-a11y/anchor-is-valid': [
'warn',
{
aspects: ['invalidHref'],
},
],
'jsx-a11y/href-no-hash': 'off',
'no-console': [0],
'default-case': [0],
'no-inner-declarations': [0],
'no-param-reassign': [
1,
{
props: false,
},
],
'no-plusplus': [
'error',
{
allowForLoopAfterthoughts: true,
},
],
'no-useless-constructor': 'off',
// 'lines-between-class-members': ['2', 'always', { exceptAfterSingleLine: true }],
'prettier/prettier': ['error', prettierConfig],
'react/boolean-prop-naming': [2],
'react/destructuring-assignment': [0],
'react/forbid-prop-types': [
2,
{
forbid: ['any', 'array'],
},
],
'react/prop-types': [0],
'react/jsx-key': [2],
'react-hooks/rules-of-hooks': 'error',
'react/no-array-index-key': [2],
'react/no-danger': [0],
'react/jsx-props-no-spreading': [0], // @todo remove rule, fix (props spreading is bad!)
'react/sort-comp': [0],
'react/static-property-placement': [0, 'static public field'],
'react/require-extension': [0],
'react/jsx-filename-extension': [
2,
{ extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs'] },
],
strict: [0],
// @todo enable
// "graphql/template-strings": ["error", {
// "env": "literal"
// }]
// AVA rules - https://github.com/avajs/eslint-plugin-ava
'ava/assertion-arguments': 'error',
'ava/hooks-order': 'error',
'ava/max-asserts': ['off', 5],
'ava/no-async-fn-without-await': 'error',
'ava/no-cb-test': 'off',
'ava/no-duplicate-modifiers': 'error',
'ava/no-identical-title': 'error',
'ava/no-incorrect-deep-equal': 'error',
'ava/no-inline-assertions': 'error',
'ava/no-invalid-end': 'error',
'ava/no-nested-tests': 'error',
'ava/no-only-test': 'error',
'ava/no-skip-assert': 'error',
'ava/no-skip-test': 'error',
'ava/no-statement-after-end': 'error',
'ava/no-todo-implementation': 'error',
'ava/no-todo-test': 'warn',
'ava/no-unknown-modifiers': 'error',
'ava/prefer-async-await': 'error',
'ava/prefer-power-assert': 'off',
'ava/prefer-t-regex': 'error',
'ava/test-ended': 'error',
'ava/test-title': 'error',
'ava/test-title-format': 'off',
'ava/use-t': 'error',
'ava/use-t-well': 'error',
'ava/use-test': 'error',
'ava/use-true-false': 'error',
// End AVA Rules
},
};