-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
93 lines (86 loc) · 3.31 KB
/
Copy patheslint.config.js
File metadata and controls
93 lines (86 loc) · 3.31 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
// ESLint flat config for quantakrypto-tools (P2-5).
//
// Pragmatic ruleset for an already-strict TypeScript codebase: it should pass
// (close to) clean out of the box. We enable typescript-eslint's recommended
// set plus the two type-aware promise rules that matter most for the async
// MCP/HTTP/sieve transports (`no-floating-promises`, `no-misused-promises`),
// and deliberately turn OFF noisy stylistic / mass-failing rules so the lint
// is a real signal rather than a wall of churn.
//
// `projectService: true` gives the type-aware rules a TS program without us
// having to enumerate every tsconfig in the monorepo.
import js from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
// Paths that should never be linted (build output, type decls, generated /
// mock material). Keep this first so the ignores apply globally.
{
ignores: [
"**/dist/**",
"**/node_modules/**",
"**/coverage/**",
"**/*.d.ts",
"**/examples/**", // mock SUT / sample vulnerable trees, intentionally "bad"
"**/test/benchmark/corpus/**", // labeled detector fixtures, intentionally "bad"
"**/test/benchmark/recall/**", // recall corpus: real-world crypto idioms, multi-language
],
},
js.configs.recommended,
...tseslint.configs.recommended,
// Type-aware layer: the high-value promise-handling rules, applied only to
// package SOURCE — the files a tsconfig project actually compiles. Scoping
// projectService here avoids "file not found by the project service" errors
// on test files / scripts, which no tsconfig includes (tests run via tsx).
{
files: ["packages/*/src/**/*.ts"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
},
},
// Test files are not part of any tsconfig project — lint them syntactically
// (recommended set), without the type-aware program.
{
files: ["packages/*/test/**/*.ts"],
...tseslint.configs.disableTypeChecked,
},
// Pragmatic relaxations: these would otherwise mass-fail or fight the
// existing (deliberate, strict-TS) style. tsconfig already enforces
// noUnusedLocals, so we let TS own unused-vars rather than double-reporting.
{
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-empty": ["error", { allowEmptyCatch: true }],
},
},
// scripts/ are zero-dep Node utilities (not part of any tsconfig project);
// lint them lightly without the type-aware program to avoid project errors.
{
files: ["scripts/**/*.{js,mjs,cjs}", "validation/**/*.{js,mjs,cjs}"],
...tseslint.configs.disableTypeChecked,
languageOptions: {
globals: {
process: "readonly",
console: "readonly",
Buffer: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
TextEncoder: "readonly",
TextDecoder: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
performance: "readonly",
structuredClone: "readonly",
globalThis: "readonly",
},
},
},
);