Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JSON formatter's "Did you mean" hint reads inside strings, so a missing comma near a URL says to remove comments

Aperta
#314 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@kachamsiddarth ci sta già lavorando.

Dal 23/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug good first issue hacktoberfest

Paste {"url": "https://example.com" "id": 1} into the JSON formatter. The error is right ("Expected ',' or '}' after property value"), but the "Did you mean" hint says "JSON doesn't support comments". There's no comment: the // is part of the URL. suggestFix (lib/json-utils.ts, lines 116 to 131) runs its checks on the raw text, including what's inside strings. Two more:

  • {"a": "{", "b" 1} (missing colon) gets "Unbalanced braces" (2 "{" vs 1 "}")
  • {"note": "value is undefined" "x": 1} (missing comma) gets "JSON has no undefined"

What to do

  • Run the checks on a copy of the input with the contents of double-quoted strings blanked out, for example raw.replace(/"(?:[^"\\\n]|\\.)*"/g, '""'), so only text outside strings counts.

Where to look

  • lib/json-utils.ts: suggestFix (lines 116 to 131)
  • lib/__tests__/json-utils.test.ts, through validate (suggestFix isn't exported)

Acceptance criteria

  • The three inputs above get no comments, braces or undefined hint
  • A real // comment, a bare undefined and a missing } still get their hints
  • Tests that fail on the current code
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #314 in the description.

Lingua principale
TypeScript
Stelle
1
Fork
9
Merge medio
7h 30m
PR unite (30g)
151

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/toolbelt

Tutte le issue di codercops/toolbelt

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.