question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't print Validation Warning for "//" comments in package.json

See original GitHub issue

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

package.json doesn’t support comments. The official, npm-sanctioned way to add comments is to use "//" key:

{ "//": "this is the first line of a comment", 
  "//": "this is the second line of the comment" } 

Running https://repl.it/repls/ThornyHatefulVirus prints a Validation Warning:

● Validation Warning:

  Unknown option "//" with value "comment" was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://facebook.github.io/jest/docs/configuration.html

What is the expected behavior?

No warning should be printed for "//" keys.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SimenBcommented, Oct 27, 2018

That’s awesome @andrew-pyle!

It’s here: https://github.com/facebook/jest/blob/c22d9f584627a1ae6c476d44f10c3c186b480722/packages/jest-validate/src/validate.js#L59-L63

What I would do (I think, haven’t tested it) is add // to the default blacklist. Feel free to ask questions if you’re stuck 🙂

0reactions
github-actions[bot]commented, May 12, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I add comments to package.json for npm install?
It in-lined comments for the scripts, but I've come to realize that those comments show up as "commands" in some tools (in VS...
Read more >
no-warning-comments - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
JSON editing in Visual Studio Code
To disable validation, use the json.validate.enable setting. ... JSON with Comments ... but they are discouraged and the editor will display a warning....
Read more >
Configuring Jest
It is recommended to define the configuration in a dedicated JavaScript, TypeScript or JSON file. The file will be discovered automatically, if it...
Read more >
package.json - Yarn
name · Must be less than or equal to 214 characters (including the @scope/ for scoped packages). · Must not start with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found