-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
85 lines (83 loc) · 2.7 KB
/
Copy patheslint.config.js
File metadata and controls
85 lines (83 loc) · 2.7 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
// ESLint v9 flat config for the dcd CLI.
// Replaces the old .eslintrc / .eslintignore pair.
// Keep this config lean: we're primarily interested in catching unused
// imports, obvious TS mistakes, and accidental `any` leaks in handwritten
// code. Generated schema types and the build output are excluded wholesale.
const js = require('@eslint/js');
const tseslint = require('typescript-eslint');
// These plugins ship as ESM with a `default` export under CJS interop.
const unicornPlugin =
require('eslint-plugin-unicorn').default ?? require('eslint-plugin-unicorn');
const importPlugin =
require('eslint-plugin-import').default ?? require('eslint-plugin-import');
module.exports = tseslint.config(
{
ignores: [
'dist/**',
'node_modules/**',
'src/types/generated/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
// `unicorn` and `import` are only registered so legacy
// `// eslint-disable-next-line unicorn/...` comments scattered through
// the source resolve. We don't enable any rules from them.
plugins: {
unicorn: unicornPlugin,
import: importPlugin,
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
// Node runtime globals used by the CLI.
process: 'readonly',
console: 'readonly',
Buffer: 'readonly',
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
setImmediate: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
require: 'readonly',
module: 'readonly',
exports: 'readonly',
global: 'readonly',
fetch: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
FormData: 'readonly',
Response: 'readonly',
Request: 'readonly',
Headers: 'readonly',
ReadableStream: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
AbortController: 'readonly',
AbortSignal: 'readonly',
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// The codebase uses `any` in a few gateway surfaces intentionally.
'@typescript-eslint/no-explicit-any': 'off',
// `require(...)` is used for lazy-loaded node builtins in a few places.
'@typescript-eslint/no-require-imports': 'off',
},
},
{
// Chai's property-style assertions (`expect(x).to.be.true`) are
// expression statements by design.
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
);