@interlace/eslint-devkit 1.3.3 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -0
- package/README.md +20 -9
- package/package.json +13 -11
- package/src/aria-definitions.d.ts +5 -0
- package/src/aria-definitions.js +28 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +4 -0
- package/src/messaging/formatters-ai.d.ts +22 -3
- package/src/messaging/formatters-v2.d.ts +84 -0
- package/src/messaging/formatters-v2.js +363 -0
- package/src/messaging/types-v2.d.ts +112 -0
- package/src/messaging/types-v2.js +7 -0
- package/src/node/path.js +29 -5
- package/src/resolver/dependency-analysis.d.ts +73 -11
- package/src/resolver/dependency-analysis.js +375 -84
- package/src/resolver/resolver-adapter.js +1 -0
- package/src/resolver/resolver-detection.js +16 -11
- package/src/resolver/resolver.d.ts +6 -26
- package/src/resolver/resolver.js +162 -185
- package/src/security/security-utils.js +3 -3
- package/src/types/index.d.ts +1 -0
- package/src/types/index.js +4 -0
- package/src/types/meta-augmentation.d.ts +44 -0
- package/src/types/meta-augmentation.js +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
## [1.4.0] - 2026-05-03
|
|
2
|
+
|
|
3
|
+
## 1.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#155](https://github.com/ofri-peretz/eslint/pull/155) [`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix `patternToRegex` (glob→regex) to escape **all** regex metacharacters, not just `.`. The previous chained `.replace()` left `\ + ( ) | [ ] { } ^ $` to leak through as regex syntax, so an ignore glob such as `a+b` or `(x)` compiled to a quantifier / capture group and matched the wrong files (CWE-116, surfaced by CodeQL `js/incomplete-sanitization`). The wildcard translation (`**`, `*`, `?`) is unchanged; a regression-lock test pins the metacharacter behavior.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Module resolver swapped from `enhanced-resolve` + `get-tsconfig` to [`oxc-resolver`](https://www.npmjs.com/package/oxc-resolver) (Rust NAPI, ~18-30× faster). Per-tsconfig caching for monorepo path-alias correctness across package boundaries.
|
|
12
|
+
- `peerDependenciesMeta` no longer lists `enhanced-resolve` and `get-tsconfig` (consumers don't need to peer-provide them; this is **technically breaking** but no consumer impact is expected).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `oxc-resolver` is now a hard `dependencies` entry. Note for adopters: NAPI prebuilds cover common targets (Linux x64/arm64 glibc + musl, macOS x64/arm64, Windows x64); rare targets may need to fall back to a build step.
|
|
17
|
+
|
|
18
|
+
## [1.3.3] - 2026-02-08
|
|
19
|
+
|
|
20
|
+
This was a version bump only for eslint-devkit to align it with other projects, there were no code changes.
|
|
21
|
+
|
|
22
|
+
## [1.3.2] - 2026-02-06
|
|
23
|
+
|
|
24
|
+
This was a version bump only for eslint-devkit to align it with other projects, there were no code changes.
|
|
25
|
+
|
|
26
|
+
# Changelog
|
|
27
|
+
|
|
28
|
+
All notable changes to `@interlace/eslint-devkit` are documented here.
|
|
29
|
+
|
|
30
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and [SemVer](https://semver.org/spec/v2.0.0.html).
|
|
31
|
+
|
|
32
|
+
## [1.0.0] - 2025-11-30
|
|
33
|
+
|
|
34
|
+
### 🚀 Features
|
|
35
|
+
|
|
36
|
+
- Enhanced LLM message formatting utilities.
|
|
37
|
+
- Improved TypeScript typings for IDE support.
|
|
38
|
+
|
|
39
|
+
### 🩹 Fixes
|
|
40
|
+
|
|
41
|
+
- Compatibility fixes for TS strict mode.
|
|
42
|
+
- More accurate type guards for AST checking.
|
|
43
|
+
|
|
44
|
+
### 📌 Notes
|
|
45
|
+
|
|
46
|
+
- Package name aligned to `@interlace/eslint-devkit` (formerly eslint-plugin-utils).
|
|
47
|
+
|
|
48
|
+
### ❤️ Thank You
|
|
49
|
+
|
|
50
|
+
- Ofri Peretz
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## [0.3.0] - 2025-11-15
|
|
55
|
+
|
|
56
|
+
### 🚀 Features
|
|
57
|
+
|
|
58
|
+
- Enhanced type utilities.
|
|
59
|
+
- Improved AST helpers.
|
|
60
|
+
- Better LLM-oriented error messaging.
|
|
61
|
+
|
|
62
|
+
### 🩹 Fixes
|
|
63
|
+
|
|
64
|
+
- Type checking edge cases.
|
|
65
|
+
- Documentation improvements.
|
|
66
|
+
|
|
67
|
+
### ❤️ Thank You
|
|
68
|
+
|
|
69
|
+
- Ofri Peretz
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## [0.2.2] - 2025-11-07
|
|
74
|
+
|
|
75
|
+
### 🩹 Fixes
|
|
76
|
+
|
|
77
|
+
- Config fixes; removed codecov vite plugin.
|
|
78
|
+
- Adjusted ignore patterns in dependency checks.
|
|
79
|
+
- Added vitest to peerDependencies.
|
|
80
|
+
|
|
81
|
+
### ❤️ Thank You
|
|
82
|
+
|
|
83
|
+
- Ofri Peretz
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## [0.2.1] - 2025-11-07
|
|
88
|
+
|
|
89
|
+
### 🩹 Fixes
|
|
90
|
+
|
|
91
|
+
- Config and dependency-check adjustments.
|
|
92
|
+
|
|
93
|
+
### ❤️ Thank You
|
|
94
|
+
|
|
95
|
+
- Ofri Peretz
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## [0.2.0] - 2025-11-02
|
|
100
|
+
|
|
101
|
+
Version bump to align packages; no code changes.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## [0.1.1] - 2025-11-02
|
|
106
|
+
|
|
107
|
+
Version bump to align packages; no code changes.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## [0.1.0] - 2025-11-02
|
|
112
|
+
|
|
113
|
+
Initial prerelease for the devkit utilities.
|
package/README.md
CHANGED
|
@@ -494,19 +494,21 @@ const rule = createRule<[], 'messageId'>({
|
|
|
494
494
|
|
|
495
495
|
## Compatibility
|
|
496
496
|
|
|
497
|
-
| Package | Version
|
|
498
|
-
| ------------------------- |
|
|
499
|
-
| ESLint | ^8.0.0 \|\| ^9.0.0 |
|
|
500
|
-
| TypeScript | >=4.0.0
|
|
501
|
-
| @typescript-eslint/parser | >=6.0.0
|
|
502
|
-
| @typescript-eslint/utils | ^8.0.0
|
|
503
|
-
| Node.js | >=18.0.0
|
|
497
|
+
| Package | Version |
|
|
498
|
+
| ------------------------- | ----------------------------- |
|
|
499
|
+
| ESLint | ^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0 |
|
|
500
|
+
| TypeScript | >=4.0.0 |
|
|
501
|
+
| @typescript-eslint/parser | >=6.0.0 |
|
|
502
|
+
| @typescript-eslint/utils | ^8.0.0 |
|
|
503
|
+
| Node.js | >=18.0.0 |
|
|
504
|
+
|
|
505
|
+
See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) for current ecosystem share data and the rules that determine which majors are supported.
|
|
504
506
|
|
|
505
507
|
---
|
|
506
508
|
|
|
507
509
|
## Related Packages
|
|
508
510
|
|
|
509
|
-
- **
|
|
511
|
+
- **The `@interlace/eslint-plugin-*` family** — Ready-to-use LLM-optimized rules built with this package. See the [root README](https://github.com/ofri-peretz/eslint#-available-packages) for the full list.
|
|
510
512
|
- **[@typescript-eslint/utils](https://www.npmjs.com/package/@typescript-eslint/utils)** - Official TypeScript ESLint utilities
|
|
511
513
|
- **[eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)** - Import/export validation
|
|
512
514
|
|
|
@@ -520,10 +522,19 @@ MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
|
|
520
522
|
|
|
521
523
|
## Contributing
|
|
522
524
|
|
|
523
|
-
Contributions welcome! See
|
|
525
|
+
Contributions welcome! See CONTRIBUTING.md (planned).
|
|
524
526
|
|
|
525
527
|
---
|
|
526
528
|
|
|
529
|
+
<!-- INTERLACE:STAR_CTA:START -->
|
|
530
|
+
## ⭐ Support & follow
|
|
531
|
+
|
|
532
|
+
If the devkit saved you time, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and engineering behind these tools.
|
|
533
|
+
|
|
534
|
+
[](https://github.com/ofri-peretz/eslint)
|
|
535
|
+
|
|
536
|
+
<!-- INTERLACE:STAR_CTA:END -->
|
|
537
|
+
|
|
527
538
|
## Changelog
|
|
528
539
|
|
|
529
540
|
See [CHANGELOG.md](./CHANGELOG.md) for a list of changes and version history.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlace/eslint-devkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "TypeScript utilities for building LLM-optimized ESLint plugins - AST helpers, type utilities, security benchmarks, and SARIF output",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -60,25 +60,27 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=18.0.0"
|
|
62
62
|
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsx ../../scripts/build-package.ts",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:coverage": "vitest run --coverage",
|
|
67
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
68
|
+
},
|
|
63
69
|
"peerDependencies": {
|
|
70
|
+
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
64
71
|
"tslib": "^2.3.0"
|
|
65
72
|
},
|
|
66
73
|
"peerDependenciesMeta": {
|
|
67
74
|
"typescript": {
|
|
68
75
|
"optional": true
|
|
69
|
-
},
|
|
70
|
-
"get-tsconfig": {
|
|
71
|
-
"optional": true
|
|
72
|
-
},
|
|
73
|
-
"enhanced-resolve": {
|
|
74
|
-
"optional": true
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
|
-
"optionalDependencies": {},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@typescript-eslint/utils": "^7.0.0 || ^8.0.0"
|
|
79
|
+
"@typescript-eslint/utils": "^7.0.0 || ^8.0.0",
|
|
80
|
+
"oxc-resolver": "^11.20.0"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@typescript-eslint/parser": "^8.46.2"
|
|
83
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
84
|
+
"gpt-tokenizer": "^3.4.0"
|
|
83
85
|
}
|
|
84
|
-
}
|
|
86
|
+
}
|
|
@@ -11,4 +11,9 @@ export declare const ARIA_ROLES: Set<string>;
|
|
|
11
11
|
export declare const ARIA_ATTRIBUTES: Set<string>;
|
|
12
12
|
export declare const ARIA_REQUIRED_PROPS: Record<string, string[]>;
|
|
13
13
|
export declare const ARIA_UNSUPPORTED_ELEMENTS: Set<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Global ARIA properties valid on every element regardless of role.
|
|
16
|
+
* Per WAI-ARIA 1.2 § 6.2 "Global States and Properties".
|
|
17
|
+
*/
|
|
18
|
+
export declare const GLOBAL_ARIA_PROPS: Set<string>;
|
|
14
19
|
export declare const ROLE_SUPPORTED_ARIA_PROPS: Record<string, Set<string>>;
|
package/src/aria-definitions.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* MIT license that can be found in the LICENSE file.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ROLE_SUPPORTED_ARIA_PROPS = exports.ARIA_UNSUPPORTED_ELEMENTS = exports.ARIA_REQUIRED_PROPS = exports.ARIA_ATTRIBUTES = exports.ARIA_ROLES = void 0;
|
|
8
|
+
exports.ROLE_SUPPORTED_ARIA_PROPS = exports.GLOBAL_ARIA_PROPS = exports.ARIA_UNSUPPORTED_ELEMENTS = exports.ARIA_REQUIRED_PROPS = exports.ARIA_ATTRIBUTES = exports.ARIA_ROLES = void 0;
|
|
9
9
|
/**
|
|
10
10
|
* ARIA Definitions
|
|
11
11
|
* Lists of valid ARIA roles and attributes
|
|
@@ -177,6 +177,33 @@ exports.ARIA_UNSUPPORTED_ELEMENTS = new Set([
|
|
|
177
177
|
'title',
|
|
178
178
|
'track',
|
|
179
179
|
]);
|
|
180
|
+
/**
|
|
181
|
+
* Global ARIA properties valid on every element regardless of role.
|
|
182
|
+
* Per WAI-ARIA 1.2 § 6.2 "Global States and Properties".
|
|
183
|
+
*/
|
|
184
|
+
exports.GLOBAL_ARIA_PROPS = new Set([
|
|
185
|
+
'aria-atomic',
|
|
186
|
+
'aria-busy',
|
|
187
|
+
'aria-controls',
|
|
188
|
+
'aria-current',
|
|
189
|
+
'aria-describedby',
|
|
190
|
+
'aria-details',
|
|
191
|
+
'aria-disabled',
|
|
192
|
+
'aria-dropeffect',
|
|
193
|
+
'aria-errormessage',
|
|
194
|
+
'aria-flowto',
|
|
195
|
+
'aria-grabbed',
|
|
196
|
+
'aria-haspopup',
|
|
197
|
+
'aria-hidden',
|
|
198
|
+
'aria-invalid',
|
|
199
|
+
'aria-keyshortcuts',
|
|
200
|
+
'aria-label',
|
|
201
|
+
'aria-labelledby',
|
|
202
|
+
'aria-live',
|
|
203
|
+
'aria-owns',
|
|
204
|
+
'aria-relevant',
|
|
205
|
+
'aria-roledescription',
|
|
206
|
+
]);
|
|
180
207
|
// Mapping of roles to supported ARIA properties
|
|
181
208
|
exports.ROLE_SUPPORTED_ARIA_PROPS = {
|
|
182
209
|
alert: new Set([
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -23,6 +23,10 @@ const tslib_1 = require("tslib");
|
|
|
23
23
|
* - Custom message templates for organizations
|
|
24
24
|
*/
|
|
25
25
|
// Rule creation utilities
|
|
26
|
+
// Side-effect import: extends `@typescript-eslint/utils` `RuleMetaDataDocs`
|
|
27
|
+
// with Interlace fields (cwe + cvss) so plugin authors can populate them
|
|
28
|
+
// without per-rule `@ts-expect-error`. See ./types/meta-augmentation.ts.
|
|
29
|
+
require("./types/meta-augmentation");
|
|
26
30
|
tslib_1.__exportStar(require("./rule-creation"), exports);
|
|
27
31
|
// AST utilities
|
|
28
32
|
tslib_1.__exportStar(require("./ast/ast-utils"), exports);
|
|
@@ -6,9 +6,28 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* AI-Native Runtime functions for LLM message formatting (Next-Gen)
|
|
8
8
|
*
|
|
9
|
-
* Contains the "Dual-Hertz" formatting engine for Agentic workflows
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Contains the "Dual-Hertz" formatting engine for Agentic workflows.
|
|
10
|
+
* Provides context-aware message formatting that automatically routes
|
|
11
|
+
* between Human (CLI), Agent (JSON), and Hybrid (Cursor) modes.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ For NEW rule code, prefer the V2 formatters in `./formatters-v2`:
|
|
14
|
+
* - `formatSecurityMessage` — CWE-mapped security rules
|
|
15
|
+
* - `formatCodeQualityMessage` — structural / import / cycle rules
|
|
16
|
+
* - `formatPerformanceMessage` — performance / complexity rules
|
|
17
|
+
*
|
|
18
|
+
* The V2 formatters are category-specific (no force-fit security metadata
|
|
19
|
+
* on quality rules), expose `why` + before/after examples for higher
|
|
20
|
+
* first-fix accuracy, and support `'human' | 'compact' | 'agent'` modes.
|
|
21
|
+
*
|
|
22
|
+
* This file is retained for two reasons:
|
|
23
|
+
* 1. `buildASTSelector` — AST-targeting precision selector that V2 does
|
|
24
|
+
* not yet replicate. Still useful for agent-mode messages that want
|
|
25
|
+
* to hand the model an esquery target instead of a file/line.
|
|
26
|
+
* 2. `formatMessageNextGen` — the IDE_CURSOR mode that injects hidden
|
|
27
|
+
* `<!-- AI_HINT: ... -->` comments. Not yet ported to V2.
|
|
28
|
+
*
|
|
29
|
+
* Do not deprecate — downstream plugins still consume this API. New work
|
|
30
|
+
* should land in `formatters-v2.ts` instead.
|
|
12
31
|
*/
|
|
13
32
|
import type { LLMMessageOptions, EnterpriseMessageOptions, AgentMessageOptions } from './types';
|
|
14
33
|
import { type RuleContextLike } from './config';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
import type { SecurityMessageOptions, CodeQualityMessageOptions, PerformanceMessageOptions } from './types-v2';
|
|
7
|
+
/**
|
|
8
|
+
* Output mode for v2 formatters.
|
|
9
|
+
* - `'human'`: Rich multi-line output for CLI/IDE (default)
|
|
10
|
+
* - `'compact'`: Condensed single/two-line for token-sensitive contexts
|
|
11
|
+
* - `'agent'`: Minified JSON for programmatic agent consumption
|
|
12
|
+
*/
|
|
13
|
+
export type V2OutputMode = 'human' | 'compact' | 'agent';
|
|
14
|
+
/**
|
|
15
|
+
* Formats a security-focused rule message.
|
|
16
|
+
*
|
|
17
|
+
* Supports three output modes:
|
|
18
|
+
* - `'human'` (default): Rich multi-line with OWASP, compliance, examples
|
|
19
|
+
* - `'compact'`: Token-optimized two-line (CWE+CVSS, inline examples)
|
|
20
|
+
* - `'agent'`: Minified JSON with self-describing keys
|
|
21
|
+
*
|
|
22
|
+
* Tokens measured with `tiktoken` o200k_base on the example below:
|
|
23
|
+
* human=120, compact=65, agent=72. (V1 baseline for the same content
|
|
24
|
+
* minus `why`/`vulnerable`/`safe`: 69 tokens.)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Human mode (~120 tokens)
|
|
29
|
+
* formatSecurityMessage({
|
|
30
|
+
* cwe: 'CWE-89', severity: 'CRITICAL',
|
|
31
|
+
* description: 'SQL injection via string concatenation',
|
|
32
|
+
* why: 'Attackers can modify the query structure',
|
|
33
|
+
* vulnerable: "db.query('SELECT...' + userId)",
|
|
34
|
+
* safe: "db.query('SELECT...$1', [userId])",
|
|
35
|
+
* fix: 'Use parameterized queries ($1, $2)',
|
|
36
|
+
* docs: 'https://node-postgres.com/...',
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Compact mode (~65 tokens — actually cheaper than V1)
|
|
40
|
+
* formatSecurityMessage({ ...same... }, 'compact');
|
|
41
|
+
*
|
|
42
|
+
* // Agent mode (~72 tokens)
|
|
43
|
+
* formatSecurityMessage({ ...same... }, 'agent');
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatSecurityMessage(options: SecurityMessageOptions, mode?: V2OutputMode): string;
|
|
47
|
+
/**
|
|
48
|
+
* Formats a code quality / structural rule message.
|
|
49
|
+
*
|
|
50
|
+
* No CWE/OWASP/CVSS — these are architecture concerns, not vulnerabilities.
|
|
51
|
+
* Supports cycle path rendering for circular dependency rules.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* formatCodeQualityMessage({
|
|
56
|
+
* category: 'circular-dependency',
|
|
57
|
+
* severity: 'WARNING',
|
|
58
|
+
* description: 'Circular import detected: A → B → C → A',
|
|
59
|
+
* why: 'Circular imports cause undefined values at import time',
|
|
60
|
+
* cycle: ['src/A.ts', 'src/B.ts', 'src/C.ts', 'src/A.ts'],
|
|
61
|
+
* fix: 'Extract shared types to a separate module',
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatCodeQualityMessage(options: CodeQualityMessageOptions, mode?: V2OutputMode): string;
|
|
66
|
+
/**
|
|
67
|
+
* Formats a performance-focused rule message.
|
|
68
|
+
*
|
|
69
|
+
* Uses complexity metrics instead of security metadata.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* formatPerformanceMessage({
|
|
74
|
+
* severity: 'MEDIUM',
|
|
75
|
+
* description: 'Loop-based INSERT detected — O(n) database calls',
|
|
76
|
+
* why: 'Each iteration opens a new round-trip, causing N×latency',
|
|
77
|
+
* vulnerable: 'for (const row of rows) { await db.query("INSERT...", row); }',
|
|
78
|
+
* safe: 'await db.query("INSERT INTO t VALUES " + values.join(","), flat)',
|
|
79
|
+
* impact: { current: 'O(n) queries', optimized: 'O(1) query' },
|
|
80
|
+
* fix: 'Use bulk INSERT with a single VALUES clause',
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function formatPerformanceMessage(options: PerformanceMessageOptions, mode?: V2OutputMode): string;
|