-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to lint files w/ JSON comments #50
Comments
👍 |
+:100: Comments are not (always) evil. |
+1 |
1 similar comment
+1 |
That isn't valid JSON though... as evidenced by the nice bright red highlight GitHub is giving it 😛. If this is ever implemented it should be disabled by default behind a flag... |
@Arcanemagus What makes you say that? |
@paleite This is |
@Arcanemagus You're right, it should be disabled behind a flag as you said. But it is a useful feature and should be available. In a large project with many team members, I've found json to be commented more often than not. |
I needed some bugfixes and extensions to |
It may not technically be valid, but I wouldn't say it's invalid either. Douglas Crockford (creator of JSON) has said:
Comments were initially allowed in JSON, and were only removed to prevent people from adding parsing directives. There's no reason that decoders can't allow and ignore comments. Since some do just that, I think it makes sense for JSON linters to provide a flag that will let them pass through as well. The user will know best what their particular use case allows. |
The "json should not have comments" argument is long dead. I rarely see uncommented json anymore in commercial code (as opposed to open source code, which is fast and loose and not easily maintainable). |
More than dead. The spec finally added support for it to json5, kicking and screaming all the way 😄. |
Comments sometimes show up in TypeScript config |
I'm trying to lint some JSON files that happen to have some comments in JSON like this:
But the
$ jsonlint config/aws.json
command gives me the following:I'm not sure what libs mozilla/persona is using to load the commented JSON, but a bunch of the files are failing jsonlint due to the comments.
The text was updated successfully, but these errors were encountered: