forked from gladly-team/next-firebase-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
71 lines (71 loc) · 2.16 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
module.exports = {
extends: ['airbnb', 'prettier'],
plugins: ['prettier', 'react-hooks'],
rules: {
'prettier/prettier': 'error',
'react/jsx-filename-extension': 0,
'react/jsx-one-expression-per-line': 0,
'react/no-unescaped-entities': 0,
'react/prop-types': 0,
'jsx-a11y/anchor-is-valid': 0, // https://github.com/zeit/next.js/issues/5533
// The jsx-wrap-multilines rule conflicts with Prettier.
// https://github.com/prettier/prettier/issues/1009#issuecomment-286993938
'react/jsx-wrap-multilines': [
'error',
{
declaration: false,
assignment: false,
},
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
overrides: [
// Set Jest rules only for test files.
// https://stackoverflow.com/a/49211283
{
files: ['**/*.test.js', '**/__mocks__/**/*.js'],
extends: ['plugin:jest/recommended'],
env: {
jest: true,
},
plugins: ['jest'],
rules: {
'global-require': 0,
'react/jsx-props-no-spreading': 0,
},
},
// Handle TypeScript separately.
{
files: ['**/*.ts', '**/*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
rules: {
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-am-using-a-rule-from-eslint-core-and-it-doesnt-work-correctly-with-typescript-code
'no-shadow': 0,
'@typescript-eslint/no-shadow': 'error',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-defsine.md
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
},
},
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
env: {
es6: true,
},
globals: {
// Polyfilled in Next.js 9.4. Set as a Webpack external.
fetch: 'writable',
},
settings: {
// Handle linting for absolute imports.
'import/resolver': {
alias: [['src', './src']],
},
},
}