-
Notifications
You must be signed in to change notification settings - Fork 5
/
eslint.config.js
99 lines (98 loc) · 3.34 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
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
// @ts-check
import eslint from '@eslint/js';
import {includeIgnoreFile} from '@eslint/compat';
import tseslint from 'typescript-eslint';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import path from 'node:path';
export default tseslint.config(
// @ts-expect-error - upstream type conflict, safe to ignore. Remove this line when fixed upstream.
includeIgnoreFile(path.resolve(import.meta.dirname, '.gitignore')),
eslint.configs.recommended,
tseslint.configs.eslintRecommended,
{
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
}
},
extends: tseslint.configs.recommendedTypeChecked,
rules: {
'@typescript-eslint/comma-dangle': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{prefer: 'type-imports', fixStyle: 'inline-type-imports'}
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/quotes': ['error', 'single'],
'@typescript-eslint/semi': ['error', 'always'],
'no-console': 'error',
'no-constant-condition': 'off',
'no-else-return': [
'error',
{
allowElseIf: false
}
],
'prefer-const': 'error',
'semi-spacing': [
'error',
{
before: false,
after: true
}
],
'semi-style': ['error', 'last']
}
},
{
name: 'prettier',
files: ['**/*.ts'],
plugins: {
prettier: prettierPlugin
},
rules: {
// @ts-expect-error - type's aren't accurate enough.
...prettierPlugin.configs?.recommended?.rules,
...prettierConfig.rules
}
},
{
name: 'tests',
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/require-await': 'off'
}
},
{
name: 'type tests',
files: ['test/**/types/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off'
}
},
{
name: 'benchmark',
files: ['benchmarks/**/*.ts'],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'no-console': 'off'
}
}
);