From f703b60086f34bef0e4c2e8584ac98cc6135d952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=9B=E5=AE=9A=E8=B0=94=E7=9A=84=E7=8C=AB?= Date: Sat, 30 Sep 2017 13:45:06 +0800 Subject: [PATCH] Fix: id-match mysteriously fails when defined in a comment. (fixes #9366) --- lib/linter.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/linter.js b/lib/linter.js index e96e713ffdb7..c5d57629fcd6 100755 --- a/lib/linter.js +++ b/lib/linter.js @@ -94,6 +94,10 @@ function parseJsonConfig(string, location) { // Parses a JSON-like comment by the same way as parsing CLI option. try { + + // https://github.com/eslint/eslint/issues/9366 + string = string.replace(/\\\\/g, "\\"); + items = levn.parse("Object", string) || {}; // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`.