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

New Rule: no-unused-vars #1

Open
mysticatea opened this issue Sep 23, 2015 · 3 comments
Open

New Rule: no-unused-vars #1

mysticatea opened this issue Sep 23, 2015 · 3 comments
Assignees

Comments

@mysticatea
Copy link
Owner

export default function foo(a) {
    assert(a > 0);

    // do something without a.
}

I want to prevent marking references inside of assert() as used.

@mysticatea mysticatea self-assigned this Sep 23, 2015
@mysticatea
Copy link
Owner Author

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
}

@graingert
Copy link
Contributor

@mysticatea don't allow assert as the only value inside an if/alternative body.

@brettz9
Copy link
Contributor

brettz9 commented Mar 11, 2020

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)

MichaelDeBoey added a commit to MichaelDeBoey/eslint-plugin-mysticatea that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants