microsoft / microsoft/node-jsonc-parser

Remove Property is not working as expected.

Offen
#10 2 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@aeschli arbeitet bereits daran.

Seit 04.5.2018.

feature-request
Vorherrschende Sprache
TypeScript
Sterne
759
Forks
66
Ø Merge
5 T. 10 Std.
Gemergte PRs (30 T.)
7

Beschreibung

It's such a great tool to handle JSON (with comments). Thanks!

But I find that it can not pass the following test:

test('remove property', () => {
    let content = '{\n  "x": "y",\n  // This is a comment\n  "test": "1"\n}';
    let edits = removeProperty(content, ['x'], formatterOptions);
    assertEdit(content, edits, '{\n  // This is a comment\n  "test": "1"\n}');
});

I've added a comment right after the property x. What I want is to remove the property but keep the comment. But jsonc-parser removes the comment too, which I think this maybe a bug or something?

P.S. You can test this in edit.test.ts.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.