Skip to content

Commit 91ba24d

Browse files
committed
chore(wheelhouse): cascade template@aa230749
Auto-applied by socket-wheelhouse sync-scaffolding into socket-lib. 1 file(s) touched: - scripts/fleet/ai-lint-fix/oxlint-json.mts
1 parent bd9676f commit 91ba24d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/fleet/ai-lint-fix/oxlint-json.mts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ export interface OxlintJsonOutput {
5555

5656
/**
5757
* Normalize oxlint's `{diagnostics:[...]}` payload into the ESLint-style
58-
* `OxlintFile[]` shape the rest of the step expects. Strip the `socket(...)`
59-
* wrapper around the rule code so AI_HANDLED_RULES (which stores bare rule
60-
* names) matches.
58+
* `OxlintFile[]` shape the rest of the step expects. Convert the oxlint code
59+
* form `socket(rule)` into the `socket/rule` form that AI_HANDLED_RULES,
60+
* RULE_GUIDANCE, and RULE_MODEL_TIER are keyed on (the same id used in
61+
* oxlintrc `rules`). Stripping to a bare `rule` would never match those sets.
6162
*/
6263
export function normalizeOxlintJson(payload: OxlintJsonOutput): OxlintFile[] {
6364
const byFile = new Map<string, OxlintMessage[]>()
@@ -70,7 +71,7 @@ export function normalizeOxlintJson(payload: OxlintJsonOutput): OxlintFile[] {
7071
// "eslint(no-unused-vars)"; strip the plugin wrapper.
7172
const ruleId =
7273
typeof d.code === 'string' && d.code.includes('(')
73-
? d.code.replace(/^[^(]+\(([^)]+)\).*$/, '$1') // `^[^(]+` plugin name; `([^)]+)` captures rule id; `\).*$` discards the rest
74+
? d.code.replace(/^([^(]+)\(([^)]+)\).*$/, '$1/$2') // `([^(]+)` plugin; `([^)]+)` rule -> `plugin/rule` to match the keyed sets
7475
: d.code
7576
const msg: OxlintMessage = {
7677
ruleId,

0 commit comments

Comments
 (0)