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

no-unused-vars configuration incompatible with express middleware error handling #21

Open
JavaRip opened this issue Sep 16, 2021 · 1 comment

Comments

@JavaRip
Copy link

JavaRip commented Sep 16, 2021

Express requires error handling functions to have 4 parameters, even if not all parameters are used: https://expressjs.com/en/guide/error-handling.html#writing-error-handlers

This is an issue as variables have to be defined even if not used, which fires an error in eslint.

image

GitHub thread discussing the issue: expressjs/generator#78

Potential Solutions

add an ignore pattern for next: expressjs/generator#78 (comment)
use an underscore in the variable name to mark it as not used: https://eslint.org/docs/rules/no-unused-vars#argsignorepattern

@jacekkopecky
Copy link
Contributor

jacekkopecky commented Sep 16, 2021

another possible solution: disable linting that issue for error handlers explicitly (as there's likely only up to one of those): expressjs/generator#78 (comment)

// eslint-disable-next-line no-unused-vars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants