Closed nathanredblur closed 5 years ago
This cost me a bit of time too, and now I'm trying to find a github issue on the right project to make sure this doesn't happen to someone else. I'm not sure if this is a vscode, tslint, or this project, or some other project's issue. What would we want to change?
From reading issues on multiple projects, these seem to be the options:
tsconfig.json
is not used with jsonc, and instead parse it as vanilla JSON
a. I'm not sure what is telling vscode to use jsonc for this file. Is it vscode itself, or this tslint extension?Thoughts?
Workaround:
Add to settings.json
:
"files.associations": {
"tsconfig.json": "json"
},
Downside is you'll get errors for having comments in there.
Saying that, I think the best way forward might be to push for trailing commas to be allowed by tslint, because all the other options are breaking changes.
Caused by fix for #8. TSlint support comments in config files but not trailing commas and there is no equivalent language mode for this in VS Code. Proper support for trailing commas requires https://github.com/palantir/tslint/issues/1721 upstream.
Until then, you can make such errors more obvious with the suggestion in https://github.com/Microsoft/vscode-typescript-tslint-plugin/issues/45#issuecomment-468136545
I lost like 3 hours trying to find why my tslint plugin didn't work. Then I fount that my tslint.json file had an extra comma that disable it.
VScode set the lenguage to JSON with comments by default, and I did't see the error.
here an example:
I wouldn't lost all this 3 hours if someone point this extra comma after
"cx"
.