ota-meshi / eslint-plugin-jsonc

ESLint plugin for JSON(C|5)? files
https://ota-meshi.github.io/eslint-plugin-jsonc/
MIT License
181 stars 17 forks source link

Fatal parsing error when parsing JSON with URLs #307

Closed abejfehr closed 3 months ago

abejfehr commented 3 months ago

I have a custom rule and a test case where I'd like to ensure that HTML tags are allowed in strings:

  valid: [
    {
      code: `{"translation-key": "this string includes <a href="https://www.google.com/">HTML</a>."}`,
    },
  ],

but I get the following error:

    Message:
      A fatal parsing error occurred: Parsing error: Unexpected token 'https'.

      at runRuleForItem (../../node_modules/eslint/lib/rule-tester/flat-rule-tester.js:759:13)
      at testValidTemplate (../../node_modules/eslint/lib/rule-tester/flat-rule-tester.js:812:28)
      at Object.<anonymous> (../../node_modules/eslint/lib/rule-tester/flat-rule-tester.js:1097:33)

and I think it's coming from the jsonc parser

abejfehr commented 3 months ago

Wow am I ever silly, you can ignore this issue.

I need to escape those quotes for this to be valid JSON 🤦