jfmengels/node-elm-review
View on GitHubThe CLI crashes in watch mode when suppression files are incorrect JSON
Open
#117 opened on Apr 17, 2023
bughelp wanted
Repository metrics
- Stars
- (55 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Ideally we don't want to crash in that case, we just want to report an error and wait for the file to be valid again.
To reproduce:
- Run
elm-review --watchon a project with suppressed errors - Changed one of the suppressed files to invalid JSON
- Expect to see an error like below:
-- UNEXPECTED ERROR ------------------------------------------------------------
I ran into an unexpected error. Please open an issue at the following link:
https://github.com/jfmengels/node-elm-review/issues/new
Please include this error message and as much detail as you can provide. If you
can, please provide a setup that makes it easy to reproduce the error. That will
make it much easier to fix the issue.
Below is the error that was encountered.
--------------------------------------------------------------------------------
SyntaxError: /Users/jengels/dev/humio/ui/review/suppressed/NoDeprecated.json: Unexpected token , in JSON at position 571
at JSON.parse (<anonymous>)
at _readFile (/Users/jengels/dev/my-project/ui/node_modules/jsonfile/index.js:25:16)
This might happen if someone touches the JSON file, or during a Git rebase when there are conflicts in a suppression file.
Expected behavior
In the same conditions, the CLI should not crash. It should show a nice error indicating that a suppressed errors file is invalid. Once that file is fixed, it should resume working like before.