From 386116ff597dcbb61028d4df5ed87bd04b64cc2b Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 15 Jun 2023 16:33:06 +0300 Subject: [PATCH] .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 --- .eslintrc.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5d52f579d6c..317e5473ee9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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",