-
Notifications
You must be signed in to change notification settings - Fork 175
/
eslint.config.mjs
76 lines (72 loc) · 2.04 KB
/
eslint.config.mjs
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
import path from 'path'
import { baseConfigs, globals, getESMDirname } from '../../eslint.config.mjs'
import * as babelParser from '@babel/eslint-parser'
import tseslint from 'typescript-eslint'
const __dirname = getESMDirname(import.meta.url)
const babelConfigFile = path.resolve(__dirname, './.babelrc')
/**
* @type {Array<import('eslint').Linter.FlatConfig>}
*/
const configs = [
...baseConfigs,
{
files: ['**/*.js'],
languageOptions: {
sourceType: 'module'
}
},
{
files: ['*.{js,cjs,mjs,ts}'],
languageOptions: {
globals: {
...globals.node
}
}
},
{
languageOptions: {
globals: {
...globals.browser
},
parser: babelParser,
parserOptions: {
babelOptions: {
configFile: babelConfigFile
}
}
}
},
...tseslint.configs.recommendedTypeChecked.map((c) => ({
...c,
files: [...(c.files || []), '**/*.ts', '**/*.d.ts']
})),
{
files: ['**/*.ts', '**/*.d.ts'],
languageOptions: {
parserOptions: {
tsconfigRootDir: getESMDirname(import.meta.url),
project: './tsconfig.eslint.json'
}
},
rules: {
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-base-to-string': 'off', // too restrictive
'@typescript-eslint/restrict-template-expressions': 'off', // too restrictive
'@typescript-eslint/no-unsafe-enum-comparison': 'off', // too restrictive
'@typescript-eslint/require-await': 'off', // too restrictive
'@typescript-eslint/unbound-method': 'off', // too restrictive
// TODO: Can we re-enable these? Only disabled because of the amount of errors
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off'
}
},
{
rules: {
'no-console': ['warn', { allow: ['warn', 'error'] }]
}
}
]
export default configs