-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
115 lines (115 loc) · 3.92 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
module.exports = {
settings: {
react: {
version: 'detect',
},
},
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
plugins: [
'@typescript-eslint',
'react-hooks',
'fp',
'simple-import-sort',
'testing-library',
],
extends: [
'standard',
'plugin:fp/recommended',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:react/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'prettier',
],
globals: {
fetch: 'readonly',
},
ignorePatterns: ['out/', 'utils.js', '.next/', 'next.config.js', 'node_modules/'],
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
rules: {
// Overwrite rules specified from the extended configs or add ones
// Prettier
'prettier/prettier': 0,
// Typescript
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
'@typescript-eslint/array-type': [2, { default: 'array', readonly: 'array' }],
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/prefer-interface': 0,
'@typescript-eslint/no-object-literal-type-assertion': 0,
'@typescript-eslint/no-shadow': 2,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-use-before-define': [
2,
{ functions: false, classes: true, variables: false },
],
'@typescript-eslint/switch-exhaustiveness-check': 2,
// React
'jsx-quotes': [1, 'prefer-double'],
'react/react-in-jsx-scope': 0,
'react-hooks/rules-of-hooks': 2,
'react-hooks/exhaustive-deps': 1,
'react/prop-types': 0,
'react/jsx-key': 0,
'react/display-name': [0, { ignoreTranspilerName: false }],
// testing library
'testing-library/await-async-utils': 2,
'testing-library/no-await-sync-events': 2,
'testing-library/no-await-sync-query': 2,
'testing-library/no-wait-for-empty-callback': 2,
'testing-library/no-wait-for-multiple-assertions': 2,
'testing-library/no-debugging-utils': 1,
'testing-library/prefer-query-by-disappearance': 1,
'testing-library/prefer-presence-queries': 1,
'testing-library/prefer-find-by': 1,
'testing-library/await-async-query': 1,
'testing-library/await-fire-event': 1,
'testing-library/prefer-screen-queries': 1,
'testing-library/prefer-wait-for': 2,
// fp
'fp/no-mutation': [
1,
{
exceptions: [
{ property: 'getInitialProps' },
{ property: 'current' },
{ property: 'getLayout' },
],
},
],
'fp/no-let': 1,
'fp/no-loops': 1,
'fp/no-nil': 'off',
'fp/no-unused-expression': 'off',
'fp/no-rest-parameters': 'off',
// import
'import/no-absolute-path': 0,
'import/exports-last': 1,
// simple-import-sort
'simple-import-sort/imports': 1,
// Misc
'array-callback-return': 1,
complexity: [1, 5],
curly: [1, 'multi', 'consistent'],
'max-lines': [1, { max: 150, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': [1, { max: 100, skipBlankLines: true, skipComments: true }],
'max-depth': [2, 2],
'max-nested-callbacks': [1, 2],
'newline-before-return': 1,
'no-console': [1, { allow: ['error'] }],
'no-debugger': 1,
'no-nested-ternary': 2,
'no-shadow': 0,
'no-unused-expressions': [1, { allowShortCircuit: true }],
'no-use-before-define': 0,
'no-var': 2,
quotes: [1, 'single', { allowTemplateLiterals: false, avoidEscape: true }],
'space-before-function-paren': [
1,
{ anonymous: 'always', named: 'never', asyncArrow: 'always' },
],
},
}