From ca473d1c6008c100d21fdb584b5d402a5ba83cbb Mon Sep 17 00:00:00 2001 From: Clooooode Date: Thu, 3 Oct 2024 19:41:25 +0800 Subject: [PATCH] fix(lint): methodOverride cause lint fail --- tests/esm/fixtures/express/server.ts | 4 +++- tests/fixtures/custom/server.ts | 4 +++- tests/fixtures/express-dynamic-controllers/server.ts | 4 +++- tests/fixtures/express-openapi3/server.ts | 4 +++- tests/fixtures/express-router-with-custom-multer/server.ts | 4 +++- tests/fixtures/express-router/server.ts | 4 +++- tests/fixtures/express/server.ts | 4 +++- tests/fixtures/inversify-async/server.ts | 4 +++- tests/fixtures/inversify-cpg/server.ts | 4 +++- tests/fixtures/inversify-dynamic-container/server.ts | 4 +++- tests/fixtures/inversify/server.ts | 4 +++- 11 files changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/esm/fixtures/express/server.ts b/tests/esm/fixtures/express/server.ts index 0d10de936..67cb30b66 100644 --- a/tests/esm/fixtures/express/server.ts +++ b/tests/esm/fixtures/express/server.ts @@ -10,7 +10,9 @@ import { RegisterRoutes } from './routes.js'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true }) as RequestHandler); app.use(bodyParser.json() as RequestHandler); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); app.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/custom/server.ts b/tests/fixtures/custom/server.ts index 5c585bf71..9542c528e 100644 --- a/tests/fixtures/custom/server.ts +++ b/tests/fixtures/custom/server.ts @@ -20,7 +20,9 @@ import { RegisterRoutes } from './customRoutes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); app.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/express-dynamic-controllers/server.ts b/tests/fixtures/express-dynamic-controllers/server.ts index 982e625a8..2f153d02e 100644 --- a/tests/fixtures/express-dynamic-controllers/server.ts +++ b/tests/fixtures/express-dynamic-controllers/server.ts @@ -7,7 +7,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); app.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/express-openapi3/server.ts b/tests/fixtures/express-openapi3/server.ts index 2a3e904c0..3f1fc363e 100644 --- a/tests/fixtures/express-openapi3/server.ts +++ b/tests/fixtures/express-openapi3/server.ts @@ -23,7 +23,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); app.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/express-router-with-custom-multer/server.ts b/tests/fixtures/express-router-with-custom-multer/server.ts index c2f3bc2c9..ec46d06c2 100644 --- a/tests/fixtures/express-router-with-custom-multer/server.ts +++ b/tests/fixtures/express-router-with-custom-multer/server.ts @@ -10,7 +10,9 @@ export const router = express.Router(); app.use('/v1', router); router.use(bodyParser.urlencoded({ extended: true })); router.use(bodyParser.json()); -router.use(methodOverride()); +router.use((req, res, next) => { + methodOverride()(req, res, next); +}); router.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/express-router/server.ts b/tests/fixtures/express-router/server.ts index b613b7057..9fed34529 100644 --- a/tests/fixtures/express-router/server.ts +++ b/tests/fixtures/express-router/server.ts @@ -10,7 +10,9 @@ export const router = express.Router(); app.use('/v1', router); router.use(bodyParser.urlencoded({ extended: true })); router.use(bodyParser.json()); -router.use(methodOverride()); +router.use((req, res, next) => { + methodOverride()(req, res, next); +}); router.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/express/server.ts b/tests/fixtures/express/server.ts index 1cb1b9310..a15d2ffa5 100644 --- a/tests/fixtures/express/server.ts +++ b/tests/fixtures/express/server.ts @@ -31,7 +31,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); app.use((req: any, res: any, next: any) => { req.stringValue = 'fancyStringForContext'; next(); diff --git a/tests/fixtures/inversify-async/server.ts b/tests/fixtures/inversify-async/server.ts index d133dbd3a..47ae3b992 100644 --- a/tests/fixtures/inversify-async/server.ts +++ b/tests/fixtures/inversify-async/server.ts @@ -9,7 +9,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); RegisterRoutes(app); // It's important that this come after the main routes are registered diff --git a/tests/fixtures/inversify-cpg/server.ts b/tests/fixtures/inversify-cpg/server.ts index 007282acf..1f92f0980 100644 --- a/tests/fixtures/inversify-cpg/server.ts +++ b/tests/fixtures/inversify-cpg/server.ts @@ -8,7 +8,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); RegisterRoutes(app); // It's important that this come after the main routes are registered diff --git a/tests/fixtures/inversify-dynamic-container/server.ts b/tests/fixtures/inversify-dynamic-container/server.ts index 97e526b8f..6ca711bce 100644 --- a/tests/fixtures/inversify-dynamic-container/server.ts +++ b/tests/fixtures/inversify-dynamic-container/server.ts @@ -8,7 +8,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); RegisterRoutes(app); // It's important that this come after the main routes are registered diff --git a/tests/fixtures/inversify/server.ts b/tests/fixtures/inversify/server.ts index 9bddbe244..dbaf5a071 100644 --- a/tests/fixtures/inversify/server.ts +++ b/tests/fixtures/inversify/server.ts @@ -8,7 +8,9 @@ import { RegisterRoutes } from './routes'; export const app: express.Express = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(methodOverride()); +app.use((req, res, next) => { + methodOverride()(req, res, next); +}); RegisterRoutes(app); // It's important that this come after the main routes are registered