I'm learning Express.js
and using their generator I generated a new app with:
npm install express-generator -g && express myapp
After that I saw in app.js
that there is this code:
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get("env") === "development" ? err : {};
// render the error page
res.status(err.status || 500);
res.render("error");
});
As you can see in the image eslint
is complaining about next
parameter, declared and never used. I agree, but if I remove it express
doesn't render the error page.
Why this behavior?
This is dangerous for me because I can't trust anymore eslint or my coding degree? I'm surely missing something. But what?