NodeRequirer
NodeRequirer copied to clipboard
Error parsing jscsrc
lazy_parse_json fails
On the following jscsrc file
// See https://github.com/jscs-dev/node-jscs/tree/master/presets for
// other options (remember to re-enable esnext)
{
"preset": "google",
"esnext": true
}
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 550, in run_
return self.run(edit, **args)
File "/home/gyeates/.config/sublime-text-3/Packages/NodeRequirer/NodeRequirer.py", line 386, in run
file_name=view.file_name()
File "/home/gyeates/.config/sublime-text-3/Packages/NodeRequirer/src/RequireSnippet.py", line 28, in __init__
self.jscs_options = get_jscs_options(self.file_name)
File "/home/gyeates/.config/sublime-text-3/Packages/NodeRequirer/src/utils.py", line 166, in get_jscs_options
open(jscsrc_path, 'r', encoding='UTF-8'))
File "/home/gyeates/.config/sublime-text-3/Packages/NodeRequirer/src/utils.py", line 157, in lazy_parse_comment_json
return json.loads(json_text)
File "./json/__init__.py", line 319, in loads
File "./json/decoder.py", line 352, in decode
File "./json/decoder.py", line 370, in raw_decode
ValueError: No JSON object could be decoded
Removing comments fixes it
Strange, it already has code to strip // comments.
Try testing 2 things for me:
- Does it happen when there is only one comment?
- Try deleting the comments, but leave the line they're on in the file as a blank line, does it still happen?
- Does it happen when there is only one comment?
Yeah
-Try deleting the comments, but leave the line they're on in the file as a blank line, does it still happen?
No, but
jsonis fine with whitespace
We should just drop jscsrc support and switch to supporting eslint