Repository navigation
Commit 9603e67
Gio Della-Libera
fix(path): plumb fileNameForGuard through internal rebuild + fix yaml type inference (#78678)
CI on the post-merge head surfaced 2 issues my local lint missed:
- TS7022 in `src/oc-path/yaml/edit.ts:167` — `'pair' implicitly has
type 'any' because it does not have a type annotation and is
referenced directly or indirectly in its own initializer'. Fixed
by adding explicit `Pair | undefined` / `readonly Pair[]` /
`readonly string[]` type annotations on the local bindings —
breaks the circular-inference path that the bare `Pair` cast
triggered. Same fix at positionalForYamlNode.
- CLI-S03 in `src/commands/path.test.ts` failed asserting
`gateway.jsonc` appeared in the sentinel error. Root cause: the
F13 plumbing landed at emitForKind (the OUTER emit) but the
sentinel throw originates INSIDE the per-kind setter via
rebuildRaw → emitJsonc({mode:'render'}), which doesn't see the
outer fileName. Threaded `path.file` through setJsoncOcPath →
rebuildRaw → emitJsonc and through setJsonlOcPath → finalize →
emitJsonl so internal render-mode emits also surface the file
context (`oc://gateway.jsonc/[path]` instead of `oc:///[path]`).
Yaml's setIn uses the yaml-lib serializer (not our emit), so no
plumbing needed there. The jsonl finalize change also propagates
`ast.lineEnding` through the synthetic `next` AST so CRLF
preservation (F10) still holds after a structural edit.
Local: vitest path.test + yaml/jsonc/jsonl edit tests 70 passed;
oxlint --type-aware on changed files: 0 warnings, 0 errors.1 parent 8829bcb commit 9603e67
3 files changed
Lines changed: 33 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
172 | 181 | | |
173 | | - | |
| 182 | + | |
174 | 183 | | |
175 | 184 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
199 | 207 | | |
200 | 208 | | |
201 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | | - | |
191 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
192 | 195 | | |
193 | 196 | | |
194 | 197 | | |
195 | | - | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
| |||
0 commit comments