-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
eslint.config.js
71 lines (67 loc) · 1.96 KB
/
eslint.config.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
import { readFileSync } from 'node:fs'
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
const tsconfig = JSON.parse(readFileSync('./tsconfig.json', 'utf8'))
export default defineConfig([
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked.map((config) => ({
...config,
files: tsconfig.include,
})),
{
files: tsconfig.include,
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
languageOptions: {
globals: {
process: 'readonly',
},
},
plugins: { unicorn: eslintPluginUnicorn },
rules: {
'unicorn/prefer-node-protocol': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
disallowTypeAnnotations: false,
},
],
// TODO: Nice-to-have rules
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/no-namespace': 'off',
},
},
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/require-await': 'off',
},
},
{ ignores: ['dist'] },
eslintPluginPrettierRecommended,
])
/** @param config {import('eslint').Linter.Config} */
function defineConfig(config) {
return config
}