Skip to content

Commit

Permalink
.eslintrc.json: use jsonc/no-irregular-whitespace
Browse files Browse the repository at this point in the history
The eslint-plugin-jsonc documentation recommends turning ESLint's
own no-irregular-whitespace plugin off for JSON files in favor of
its own jsonc/no-irregular-whitespace plugin.

The idea here is to allow "irregular" whitespace in quoted strings
and regular expressions, as that may be deliberate, and to forbid
such whitespace in comments and templates (though I'm unsure if we
should skip them in templates?).

See: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html
  • Loading branch information
alanorth committed Jul 19, 2023
1 parent afa3875 commit 386116f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,17 @@
"plugin:jsonc/recommended-with-json5"
],
"rules": {
"no-irregular-whitespace": "error",
// ESLint core no-irregular-whitespace rule doesn't work well in JSON
"no-irregular-whitespace": "off",
"jsonc/no-irregular-whitespace": [
"error",
{
"skipStrings": true,
"skipComments": false,
"skipRegExps": true,
"skipTemplates": false
}
],
"no-trailing-spaces": "error",
"jsonc/comma-dangle": [
"error",
Expand Down

0 comments on commit 386116f

Please sign in to comment.