-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip comments before parsing JSON config files
Also contains minor tweaks to analyzeArgv() and adds comments to the JSON files under test/fixtures/analyzeArgv. Added a new "Development" section to README.md including instructions on configuring Vim, Visual Studio Code, and IntelliJ IDEA to recognize JSON comments. From the function comment for the new stripJsonComments(): Replaces rather than removes characters so that any JSON.parse() errors line up with the original. Preserves all existing whitespace as is, including newlines, carriage returns, and horizontal tabs. This function is necessary because the `jsdoc` command depends upon the extremely popular strip-json-comments npm. Otherwise analyzeArgs() would choke on config.json files containing comments. This implementation was inspired by strip-json-comments, but is a completely original implementation to avoid adding any dependencies. It may become its own separate package one day, likely scoped to avoid conflicts with strip-json-comments.
- Loading branch information
Showing
7 changed files
with
371 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
{ | ||
"opts": {} | ||
"opts": {} // This will override opts.destination, since opts is defined. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
{} | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
{/* This won't override opts.destination, since opts is undefined. */} |
Oops, something went wrong.