I am writing an Express application that I'm linting using the AirBnB eslint configuration. That lint configuration provides a no-params-reassign check, which flags reassignment of parameters and members of those parameters as errors. I personally like this, but I am unsure if there's a way to modify req and res in Express without mutating the function parameters.
For example, I want to rewrite part of the request in a middleware:
app.use((req, res, next) => {
  req.url = req.url.replace("regex", "replacement");
});
This sets off a lint error. I know I can make the error go away by doing this:
app.use((_req, res, next) => {
  req = _req;
  req.url = req.url.replace("regex", "replacement");
});
... but that seems like a kinda dumb solution. Is there a means of replacing the req and res variables for future middleware invocations in Express, or is the only way to persist changes to actually mutate them?
I know I can just override the no-params-reassign rule, but I wanted to see if it's possible for me to achieve this without doing so. Thanks!
 
     
    