-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.ts
More file actions
105 lines (103 loc) · 3.33 KB
/
eslint.config.ts
File metadata and controls
105 lines (103 loc) · 3.33 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
import js from '@eslint/js'
import love from 'eslint-config-love'
import prettier from 'eslint-config-prettier'
import { configs as lit } from 'eslint-plugin-lit'
import { configs as wc } from 'eslint-plugin-wc'
import { defineConfig, type Config } from 'eslint/config'
import typescript from 'typescript-eslint'
// `eslint-config-love` currently exposes FlatConfig types that don't line up with ESLint v10 helpers.
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const loveConfig = love as unknown as Config
const strictConfigs = Array.isArray(typescript.configs.strict)
? typescript.configs.strict
: [typescript.configs.strict]
const stylisticConfigs = Array.isArray(typescript.configs.stylistic)
? typescript.configs.stylistic
: [typescript.configs.stylistic]
const { pathname: tsconfigRootDir } = new URL('.', import.meta.url)
export default defineConfig(
{
ignores: [
'**/*.{js,jsx,cjs,mjs}',
'**/.bundle/**',
'**/.rslib',
'**/android/**',
'**/build/**',
'**/coverage',
'**/contentful-generated.d.ts',
'**/dist',
'docs/media/**',
'**/ios/**',
'**/node_modules',
],
},
js.configs.recommended,
{
files: ['**/*.{js,jsx,cjs,mjs,ts,tsx}'],
...loveConfig,
},
{
files: ['**/*.{js,jsx,cjs,mjs,ts,tsx}'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir,
},
},
},
...strictConfigs,
...stylisticConfigs,
{
rules: {
'@typescript-eslint/class-methods-use-this': [
'error',
{ ignoreClassesThatImplementAnInterface: true },
],
'@typescript-eslint/no-magic-numbers': [
'error',
{ ignore: [-2, -1, 0, 0.5, 1, 2, 10, 36, 100] },
],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/strict-boolean-expressions': 'off',
'eslint-comments/disable-enable-pair': 'off',
'eslint-comments/no-aggregating-enable': 'off',
'eslint-comments/no-duplicate-disable': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'eslint-comments/no-unused-enable': 'off',
'eslint-comments/require-description': 'off',
'no-useless-assignment': 'off',
},
},
wc['flat/best-practice'],
lit['flat/recommended'],
{
// https://github.com/vitest-dev/vitest/issues/4543#issuecomment-1824628142
files: ['**/src/**/*.test.ts', '**/src/**/*.spec.ts', '**/test/**/*.ts', '**/e2e/**/*.ts'],
rules: {
'@typescript-eslint/class-methods-use-this': 'off',
'@typescript-eslint/init-declarations': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/prefer-destructuring': 'off',
'@typescript-eslint/unbound-method': 'off',
complexity: 'off',
'max-nested-callbacks': 'off',
'promise/avoid-new': 'off',
},
},
prettier,
)