Skip to content

Commit

Permalink
Fix: id-match mysteriously fails when defined in a comment. (fixes es…
Browse files Browse the repository at this point in the history
  • Loading branch information
薛定谔的猫 committed Sep 29, 2017
1 parent 458ca67 commit f71b5ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/linter.js
Expand Up @@ -337,7 +337,11 @@ function modifyConfigsFromComments(filename, ast, config, linterContext) {

if (parseResult.success) {
Object.keys(parseResult.config).forEach(name => {
const ruleValue = parseResult.config[name];
let ruleValue = parseResult.config[name];

if (typeof ruleValue === "string") {
ruleValue = ruleValue.replace(/\\/g, "\\\\");
}

validator.validateRuleOptions(name, ruleValue, `${filename} line ${comment.loc.start.line}`, linterContext.rules);
commentRules[name] = ruleValue;
Expand Down

0 comments on commit f71b5ee

Please sign in to comment.