Skip to content

Commit 7c7d565

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 e5c2cb4 commit 7c7d565

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.eslintrc.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,17 @@
234234
"plugin:jsonc/recommended-with-json5"
235235
],
236236
"rules": {
237-
"no-irregular-whitespace": "error",
237+
// ESLint core no-irregular-whitespace rule doesn't work well in JSON
238+
"no-irregular-whitespace": "off",
239+
"jsonc/no-irregular-whitespace": [
240+
"error",
241+
{
242+
"skipStrings": true,
243+
"skipComments": false,
244+
"skipRegExps": true,
245+
"skipTemplates": false
246+
}
247+
],
238248
"no-trailing-spaces": "error",
239249
"jsonc/comma-dangle": [
240250
"error",

0 commit comments

Comments
 (0)