You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This parser allows us to lint JSON, JSONC and JSON5 files.
This parser and the rules of eslint-plugin-jsonc would catch some of the mistakes and code style violations.
In your ESLint configuration file, set the parser property:
importjsoncParserfrom"jsonc-eslint-parser";exportdefault[{// ...// Add the following settings.files: ["*.json","*.json5"],// Specify the extension or pattern you want to parse as JSON.languageOptions: {parser: jsoncParser,// Set this parser.}},];
π Usage (Legacy Config)
In your ESLint configuration file, set the overrides > parser property:
{// ...// Add the following settings."overrides": [{"files": ["*.json","*.json5"],// Specify the extension or pattern you want to parse as JSON."parser": "jsonc-eslint-parser",// Set this parser.},],}
βοΈ Configuration
The following additional configuration options are available by specifying them in parserOptions in your ESLint configuration file.
Set to "JSON", "JSONC" or "JSON5". Select the JSON syntax you are using.
If not specified, all syntaxes that express static values ββare accepted. For example, template literals without interpolation.
Note : Recommended to loosen the syntax checking by the parser and use check rules of eslint-plugin-jsonc to automatically fix it.