-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
65 lines (63 loc) · 1.87 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
import path from 'node:path'
import { includeIgnoreFile } from '@eslint/compat'
import eslint from '@eslint/js'
import markdown from '@eslint/markdown'
import stylistic from '@stylistic/eslint-plugin'
import tseslint from 'typescript-eslint'
import htmlProcessor from 'eslint-processor-html'
/**
* Unnecessarily explicit type annotation until the upstream issue is resolved.
* @see https://github.com/typescript-eslint/typescript-eslint/issues/10893
* @type {import('typescript-eslint').ConfigArray}
*/
const configs = tseslint.config(
includeIgnoreFile(path.resolve(import.meta.dirname, '.gitignore')),
{
files: ['**/*.?(m|c){js,ts}'],
extends: [
eslint.configs.recommended,
stylistic.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// Disable rules that are only useful when TypeScript becomes smart enough.
{
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
],
},
// @playwright/test likes empty object patterns. (It ASTs the test fns internally.)
{
files: ['test/**/*.ts'],
rules: {
'no-empty-pattern': ['error', { allowObjectPatternsAsParameters: true }],
},
},
// Markdown code blocks
markdown.configs.processor,
{
files: ['*.md/**/*.{js,ts}'],
extends: [
// Disable type checks until eslint and typescript can interop better.
// https://github.com/eslint/markdown/tree/main/examples/typescript
tseslint.configs.disableTypeChecked,
],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
},
{
files: ['**/*.html', '**/*.htm'],
processor: htmlProcessor(),
},
)
export default configs