Skip to content
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

Unable to parse utf-8 BOM if sub dependency jsonc-parser is upgraded #79

Open
lukeapage opened this issue Mar 28, 2023 · 1 comment
Open

Comments

@lukeapage
Copy link

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:

microsoft/node-jsonc-parser@009d0a6

I guess that eslint-plugin-json should remove a utf8 bom prior to passing it in?

@azeemba
Copy link
Owner

azeemba commented Mar 31, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants