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 Apr 15, 2024
1 parent ed29ed3 commit 6c93390
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 @@ -272,7 +272,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 6c93390

Please sign in to comment.