-
Notifications
You must be signed in to change notification settings - Fork 37
/
.eslintrc.js
111 lines (105 loc) · 2.63 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
// @ts-check
// Disable this annoying red lines under unformatted code
// if there is prettier extensions installed
let prettierExtension = process.env.VSCODE_CWD;
module.exports = {
root: true,
ignorePatterns: ['**/*'],
extends: [
prettierExtension
? 'eslint-config-prettier'
: 'plugin:prettier/recommended',
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'plugin:jest/recommended',
'plugin:testing-library/react',
],
plugins: [
'@nrwl/nx',
prettierExtension ? '' : 'prettier',
'jest',
'testing-library',
].filter(Boolean),
parserOptions: {
project: './tsconfig.base.json',
},
overrides: [
{
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {
...(prettierExtension
? {}
: {
'prettier/prettier': [
'error',
{
endOfLine: 'crlf',
},
],
}),
'@nrwl/nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
// We allow it because we need to use import from
// postybirb-ui to make jump-to definition in the
// FieldType.label
allow: ['@postybirb/form-builder'],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
},
{
files: ['*.ts', '*.tsx'],
extends: ['plugin:@nrwl/nx/typescript'],
rules: {},
},
{
files: ['*.js', '*.jsx'],
extends: ['plugin:@nrwl/nx/javascript'],
rules: {},
},
],
rules: {
'class-methods-use-this': 'off',
'no-await-in-loop': 'off',
'import/no-cycle': 'off',
'import/prefer-default-export': 'off',
'react/jsx-props-no-spreading': 'off',
'react/react-in-jsx-scope': 'off',
'no-restricted-syntax': 'off',
'@typescript-eslint/ban-types': 'warn',
'import/no-extraneous-dependencies': [
'warn',
{
// These dependencies will be considered
// as bundled and no warning will be shown
bundledDependencies: ['electron'],
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
// Allow const { _ } = useLingui()
leadingUnderscore: 'allow',
},
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
},
};