eslint-plugin
eslint-plugin copied to clipboard
New Rule: `no-unused-vars`
export default function foo(a) {
assert(a > 0);
// do something without a.
}
I want to prevent marking references inside of assert() as used.
And if statements for assertion are the same.
if (foo > 0) { // don't mark `foo` as used
assert(bar > 0); // don't mark `bar` as used
}
@mysticatea don't allow assert as the only value inside an if/alternative body.
While you can of course add rules as you wish, you might want to consider https://github.com/onechiporenko/eslint-plugin-mocha-cleanup/ as a home for such a rule, as it already has rules regarding assertions. (https://github.com/ihordiachenko/eslint-plugin-chai-friendly and https://github.com/Turbo87/eslint-plugin-chai-expect might perhaps be open to it, but they are currently confined to expect and should)