-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
59 lines (58 loc) · 2.26 KB
/
Copy patheslint.config.js
File metadata and controls
59 lines (58 loc) · 2.26 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
// Flat config (ESLint 9). ESM, Node >= 18 — matches package.json "type":"module".
// Scope note: we lint the code WE own (src, tests, tools, bench). We deliberately
// do NOT lint:
// - templates/** rendered code with placeholders (__ANY_TYPE__ etc.); not
// real modules, must stay byte-stable (hard rule #6).
// - tests/fixtures/** byte-sensitive: route fingerprints hash this source and
// `remove` asserts a byte-for-byte clean diff (hard rule #4).
// - demo-app/** same: the `demo` command parses + injects + removes this
// and asserts a byte-for-byte clean diff; it is rendered to
// the user, kept hand-shaped to mirror the fixture.
// - **/.tmp/** generated hosts/routers (gitignored).
import js from '@eslint/js';
import globals from 'globals';
import prettier from 'eslint-config-prettier';
export default [
{
ignores: [
'node_modules/**',
'dist/**',
'**/.tmp/**',
'templates/**',
'tests/fixtures/**',
'demo-app/**',
'tests/e2e/**',
'**/*.bak',
'bench/results.json',
'docs/csop-handoff/**',
],
},
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: { ...globals.node },
},
rules: {
// Allow intentional throwaways (_unused, _req) and keep catch-bindings:
// SPARDA convention is `catch (err)` even when only logged conditionally.
'no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
],
// Best-effort cleanup paths (shims, probes) use `catch {}` deliberately —
// a swallowed failure there must never crash the host. Empty *catch* is
// allowed; any other empty block (if/for/fn) still errors.
'no-empty': ['error', { allowEmptyCatch: true }],
},
},
{
// CJS islands (e.g. tests/router-selftest.cjs runs outside the ESM graph).
files: ['**/*.cjs'],
languageOptions: { sourceType: 'commonjs', globals: { ...globals.node } },
},
// eslint-config-prettier must stay LAST: it switches off every stylistic rule
// that would fight Prettier, so formatting is owned by Prettier alone.
prettier,
];