Skip to content

Commit 6c93390

Browse files
committed
.eslintrc.json: use jsonc/no-irregular-whitespace
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
1 parent ed29ed3 commit 6c93390

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.eslintrc.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,17 @@
272272
"plugin:jsonc/recommended-with-json5"
273273
],
274274
"rules": {
275-
"no-irregular-whitespace": "error",
275+
// ESLint core no-irregular-whitespace rule doesn't work well in JSON
276+
"no-irregular-whitespace": "off",
277+
"jsonc/no-irregular-whitespace": [
278+
"error",
279+
{
280+
"skipStrings": true,
281+
"skipComments": false,
282+
"skipRegExps": true,
283+
"skipTemplates": false
284+
}
285+
],
276286
"no-trailing-spaces": "error",
277287
"jsonc/comma-dangle": [
278288
"error",

0 commit comments

Comments
 (0)