forked from takram-design-engineering/three-geospatial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
171 lines (155 loc) · 5.18 KB
/
eslint.config.mjs
File metadata and controls
171 lines (155 loc) · 5.18 KB
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
165
166
167
168
169
170
171
import eslint from '@eslint/js'
import nx from '@nx/eslint-plugin'
import love from 'eslint-config-love'
import { defineConfig } from 'eslint/config'
import tseslint from 'typescript-eslint'
export default defineConfig(
nx.configs['flat/base'],
nx.configs['flat/typescript'],
nx.configs['flat/javascript'],
nx.configs['flat/react'].map(config => {
delete config.plugins?.import
return config
}),
...[eslint.configs.recommended, ...tseslint.configs.recommended].map(
config => ({
...config,
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts']
})
),
{
ignores: [
'**/.nx',
'**/dist',
'**/vite.config.*.timestamp*',
'**/vitest.config.*.timestamp*'
]
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$'],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*']
}
]
}
]
}
},
{
files: [
'*.stories.ts',
'*.stories.tsx',
'**/stories/*.ts',
'**/stories/*.tsx'
],
rules: {
'@nx/enforce-module-boundaries': 'off'
}
},
{
...love,
files: [
'**/*.ts',
'**/*.tsx',
'**/*.cts',
'**/*.mts',
'**/*.js',
'**/*.jsx',
'**/*.cjs',
'**/*.mjs'
],
rules: {
...love.rules,
// Insane nonsenses.
complexity: 'off',
'max-depth': 'off',
'max-lines': 'off',
'no-console': 'off',
'no-negated-condition': 'off',
'no-plusplus': 'off',
'no-multi-assign': 'off',
'prefer-named-capture-group': 'off',
'no-await-in-loop': 'off',
'require-unicode-regexp': 'off',
'@typescript-eslint/init-declarations': 'off',
'@typescript-eslint/max-lines': 'off',
'@typescript-eslint/max-params': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/prefer-destructuring': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
eqeqeq: ['error', 'always', { null: 'ignore' }],
// Only if the rulesets are error prone.
'eslint-comments/require-description': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'@eslint-community/eslint-comments/require-description': 'off',
'@eslint-community/eslint-comments/no-unlimited-disable': 'off',
// Mostly agree but it makes hook cleanup functions hard to distinguish.
'arrow-body-style': 'off',
// Then, how can we resolve promises in callbacks?
'promise/avoid-new': 'off',
// Allow in arguments and catch statements.
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'none',
argsIgnorePattern: '^_',
caughtErrors: 'none',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
// Empty interfaces have purposes.
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
// It's not so harmful to coarse values to strings, especially inside
// template strings from which we often construct messages.
'@typescript-eslint/restrict-template-expressions': 'off',
// Triple slash reference has a different purpose.
'@typescript-eslint/triple-slash-reference': 'off',
// Too many false positives. `T extends any` is totally type-safe when
// used in type constraints.
'@typescript-eslint/no-explicit-any': 'off',
// Too many false positives.
'no-param-reassign': 'off',
'no-lonely-if': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-type-assertion': 'off',
'@typescript-eslint/unified-signatures': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/class-literal-property-style': 'off',
'@typescript-eslint/strict-void-return': 'off',
'@typescript-eslint/no-unused-private-class-members': 'off',
// Method signature has a purpose.
'@typescript-eslint/method-signature-style': 'off',
// To be determined. Turn this off for now.
'@typescript-eslint/no-misused-spread': 'off',
// This warns our own codes for backward compatibility.
'@typescript-eslint/no-deprecated': 'off',
// Overridden functions must use class methods.
'@typescript-eslint/class-methods-use-this': [
'error',
{ ignoreOverrideMethods: true }
]
}
},
{
files: ['**/eslint.config.mjs', '**/vite.config.ts', 'types/**/*.d.ts'],
extends: [tseslint.configs.disableTypeChecked]
}
)