Skip to content

Commit

Permalink
Fix: no-unused-vars false pos. with markVariableAsUsed (fixes eslint#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Sutton committed Oct 10, 2018
1 parent 95c4cb1 commit 2134ed9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-unused-vars.js
Expand Up @@ -469,7 +469,7 @@ module.exports = {
const posteriorParams = params.slice(params.indexOf(variable) + 1);

// If any used parameters occur after this parameter, do not report.
return !posteriorParams.some(v => v.references.length > 0);
return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion tests/lib/rules/no-unused-vars.js
Expand Up @@ -271,7 +271,11 @@ ruleTester.run("no-unused-vars", rule, {
code: "(({a, ...rest}) => rest)",
options: [{ args: "all", ignoreRestSiblings: true }],
parserOptions: { ecmaVersion: 2018 }
}
},

// https://github.com/eslint/eslint/issues/10952
"/*eslint use-every-a:1*/ !function(b, a) { return 1 }"

],
invalid: [
{ code: "function foox() { return foox(); }", errors: [definedError("foox")] },
Expand Down

0 comments on commit 2134ed9

Please sign in to comment.