forked from raveclassic/frp-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
158 lines (156 loc) · 4.46 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
const workspaces = require('./workspace.json')
const path = require('path')
const ROOT = path.resolve(__dirname)
module.exports = {
root: true,
env: {
node: true,
browser: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
extraFileExtensions: ['.json'],
},
plugins: ['@nrwl/nx', 'jest', 'import', 'unicorn'],
extends: [
'plugin:@nrwl/nx/typescript',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
rules: {
semi: 'off',
'@typescript-eslint/semi': [2, 'never'],
'@typescript-eslint/member-delimiter-style': [
2,
{
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/ban-ts-comment': 2,
'@typescript-eslint/await-thenable': 2,
'@typescript-eslint/ban-types': 2,
'@typescript-eslint/class-literal-property-style': 2,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-unused-vars': 2,
'no-mixed-spaces-and-tabs': 0,
'@typescript-eslint/no-explicit-any': 2,
'no-restricted-syntax': [2, "TSAsExpression[typeAnnotation.typeName.name!='const']"],
'@typescript-eslint/prefer-readonly': 2,
'@typescript-eslint/prefer-readonly-parameter-types': 0,
'@typescript-eslint/no-empty-function': [2, { allow: ['arrowFunctions'] }],
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-non-null-assertion': 2,
'no-warning-comments': [2, { terms: ['@todo'] }],
'jest/consistent-test-it': [2, { fn: 'it' }],
'jest/no-test-prefixes': 2,
'jest/require-top-level-describe': 2,
'jest/valid-title': [2, { disallowedWords: ['should'] }],
'@typescript-eslint/strict-boolean-expressions': [2],
'import/no-default-export': 2,
'import/no-extraneous-dependencies': [
2,
{
packageDir: [ROOT, ...Object.values(workspaces.projects).map((p) => path.resolve(ROOT, p))],
devDependencies: [
path.resolve(ROOT, './*.@(js|ts|tsx)'),
...Object.values(workspaces.projects).map((p) =>
path.resolve(ROOT, `${p}/**/*.@(stories|mock|test|spec).@(ts|tsx|js|jsx)`),
),
],
},
],
'import/namespace': 0,
'import/no-unresolved': 0,
'unicorn/consistent-function-scoping': 0,
'unicorn/custom-error-definition': 2,
'unicorn/filename-case': [
2,
{
case: 'kebabCase',
},
],
'unicorn/no-abusive-eslint-disable': 2,
'unicorn/no-array-for-each': 2,
'unicorn/no-array-push-push': 2,
'unicorn/no-array-reduce': 2,
'unicorn/no-console-spaces': 0,
'unicorn/no-instanceof-array': 2,
'unicorn/no-lonely-if': 2,
'unicorn/no-nested-ternary': 2,
'unicorn/no-this-assignment': 2,
'unicorn/no-unsafe-regex': 2,
'unicorn/no-zero-fractions': 2,
'unicorn/prefer-add-event-listener': 2,
'unicorn/prefer-array-find': 2,
'unicorn/prefer-array-flat-map': 2,
'unicorn/prefer-array-index-of': 2,
'unicorn/prefer-array-some': 2,
'unicorn/prefer-date-now': 2,
'unicorn/prefer-dom-node-append': 2,
'unicorn/prefer-dom-node-dataset': 2,
'unicorn/prefer-dom-node-remove': 2,
'unicorn/prefer-dom-node-text-content': 2,
'unicorn/prefer-includes': 2,
'unicorn/prefer-keyboard-event-key': 2,
'unicorn/prefer-modern-dom-apis': 2,
'unicorn/prefer-reflect-apply': 2,
'unicorn/prefer-set-has': 2,
'unicorn/prefer-string-replace-all': 2,
'unicorn/prefer-string-slice': 2,
'unicorn/prefer-string-starts-ends-with': 2,
'unicorn/prefer-string-trim-start-end': 2,
'unicorn/prefer-ternary': 2,
'unicorn/prefer-type-error': 2,
'unicorn/throw-new-error': 2,
/**
* https://eslint.org/docs/rules/no-empty
*/
'no-empty': [
2,
{
// allows empty `catch` blocks
allowEmptyCatch: true,
},
],
eqeqeq: 2,
'@nrwl/nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
overrides: [
{
files: ['*.js', '*.jsx'],
// extends: ['plugin:@nrwl/nx/javascript'],
rules: {
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
},
},
],
}