Skip to content

Commit

Permalink
fix: not report when the rule severity is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed May 21, 2019
1 parent 84dcfa2 commit 7d930cb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/linter.js
Expand Up @@ -297,10 +297,16 @@ function getDirectiveComments(filename, ast, ruleMapper) {

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

if (rule === null) {
problems.push(createMissingProblem(name));
return;
}

try {
validator.validateRuleOptions(ruleMapper(name), name, ruleValue);
validator.validateRuleOptions(rule, name, ruleValue);
} catch (err) {
problems.push({
ruleId: name,
Expand Down Expand Up @@ -746,21 +752,15 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser
const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]);
const rule = ruleMapper(ruleId);

/*
* report an linting error, if the rule:
* a. has been replaced by some other rules;
* b. has not been defined;
*/
if (!rule) {
lintingProblems.push(createMissingProblem(ruleId));
if (severity === 0) {
return;
}

if (severity === 0) {
if (!rule) {
lintingProblems.push(createMissingProblem(ruleId));
return;
}


const messageIds = rule.meta && rule.meta.messages;
let reportTranslator = null;
const ruleContext = Object.freeze(
Expand Down

0 comments on commit 7d930cb

Please sign in to comment.