-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
66 lines (65 loc) · 2.38 KB
/
Copy patheslint.config.js
File metadata and controls
66 lines (65 loc) · 2.38 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
// @ts-check
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
// Things ESLint should never look at. test/fixtures holds WASM guest sources
// and build scripts (their own runtime/globals), not library code.
ignores: [
'dist/**',
'dist-e2e/**',
'node_modules/**',
'test-results/**',
'playwright-report/**',
'coverage/**',
'test/fixtures/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
rules: {
// TypeScript already resolves identifiers; ESLint's core no-undef produces
// false positives on TS-only globals/types, so the typescript-eslint guide
// recommends disabling it for .ts files.
'no-undef': 'off',
// The codebase already enforces unused-locals/params via tsconfig; mirror it
// here but allow leading-underscore opt-outs (used widely for ignored args).
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
// `any` is used pragmatically at WASM/host boundaries; warn rather than block
// so it shows up without failing the build. Tighten over time (ratchet).
'@typescript-eslint/no-explicit-any': 'warn',
// The `Function` type is used at the WASM/jco trampoline boundary where the
// precise signature is genuinely unknown; warn (ratchet) rather than block.
'@typescript-eslint/no-unsafe-function-type': 'warn',
// `const self = this` shows up in a few async wrappers; low value to block.
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
// WASI plugins legitimately use empty methods / interface stubs.
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
},
},
{
// Tests may be looser: scaffolding churns and intentionally keeps unused
// fixtures, so demote the noisy rules to warnings there.
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
},
}
)