Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: no-unused-vars false pos. with markVariableAsUsed (fixes #10952) #10954

Merged
merged 1 commit into from Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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