eslint-plugin-json
eslint-plugin-json copied to clipboard
Unable to parse utf-8 BOM if sub dependency jsonc-parser is upgraded
I use renovate to upgrade the lock file and it updated
jsonc-parser@^3.0.0
from 3.0.0 to 3.2.0
1:2 error Expected a JSON object, array or literal json/*
It looks like it was caused by this:
https://github.com/microsoft/node-jsonc-parser/commit/009d0a69c900e5cdaa956b39effe70660b1dac0c
I guess that eslint-plugin-json should remove a utf8 bom prior to passing it in?
Since the spec says that the BOM shouldn't be added, I think its fair for a linting tool to complain about it.
Implementations MUST NOT add a byte order mark to the beginning of a JSON text. In the interests of interoperability, implementations that parse JSON texts MAY ignore the presence of a byte order mark rather than treating it as an error.
While the spec allows for parsers to ignore it, I don't think linters should.