Skip to content

Commit

Permalink
test: prefix unused params with underscores (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 11, 2025
1 parent 464b04a commit 26d60ea
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions test/issues/369/routes/.autohooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = async function (app, opts) {
app.addHook('onRequest', async (req, reply) => {
module.exports = async function (app) {
app.addHook('onRequest', async (req) => {
req.hooked = req.hooked || []
req.hooked.push('root')
})
Expand Down
4 changes: 2 additions & 2 deletions test/issues/369/routes/child/.autohooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = async function (app, opts) {
app.addHook('onRequest', async (req, reply) => {
module.exports = async function (app) {
app.addHook('onRequest', async (req) => {
req.hooked = req.hooked || []
req.hooked.push('child')
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/369/routes/child/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ hooked: req.hooked })
})
Expand Down
4 changes: 2 additions & 2 deletions test/issues/369/routes/promisified/.autohooks.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

module.exports = new Promise((resolve) => {
resolve(async function (app, opts) {
app.addHook('onRequest', async (req, reply) => {
resolve(async function (app) {
app.addHook('onRequest', async (req) => {
req.hooked = req.hooked || []
req.hooked.push('promisified')
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/369/routes/promisified/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ hooked: req.hooked })
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/369/routes/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ hooked: req.hooked })
})
Expand Down
4 changes: 2 additions & 2 deletions test/issues/374/routes/entity/.autohooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = async function (app, opts) {
app.addHook('onRequest', async (req, reply) => {
module.exports = async function (app) {
app.addHook('onRequest', async (req) => {
req.hooked = req.hooked || []
req.hooked.push('root')
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/374/routes/entity/_entity/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ path: req.url, hooked: req.hooked, params: req.params })
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/374/routes/entity/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ path: req.url, hooked: req.hooked })
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/374/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ path: req.url })
})
Expand Down
4 changes: 2 additions & 2 deletions test/issues/376/routes/entity/.autohooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = async function (app, opts) {
app.addHook('onRequest', async (req, reply) => {
module.exports = async function (app) {
app.addHook('onRequest', async (req) => {
req.hooked = req.hooked || []
req.hooked.push('root')
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/376/routes/entity/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ path: req.url, hooked: req.hooked })
})
Expand Down
2 changes: 1 addition & 1 deletion test/issues/376/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = async function (app, opts) {
module.exports = async function (app) {
app.get('/', async function (req, reply) {
reply.status(200).send({ path: req.url })
})
Expand Down
4 changes: 2 additions & 2 deletions test/issues/388/routes/foo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = async function (app, opts) {
app.get('/', async function (req, reply) {
module.exports = async function (app) {
app.get('/', async function (_req, reply) {
reply.status(200).send({ tsx: 'ok' })
})
}
2 changes: 1 addition & 1 deletion test/typescript-jest/basic/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FastifyPluginCallback } from 'fastify'
import { join } from 'node:path'
const fastifyAutoLoad = require('../../../index')

const app: FastifyPluginCallback = function (fastify, opts, next): void {
const app: FastifyPluginCallback = function (fastify, _opts, next): void {
fastify.register(fastifyAutoLoad, {
dir: join(__dirname, 'foo'),
})
Expand Down
4 changes: 2 additions & 2 deletions test/typescript-jest/basic/foo/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FastifyPluginCallback } from 'fastify'

const plugin: FastifyPluginCallback = function (fastify, opts, next): void {
fastify.get('/typescript', (request, reply): void => {
const plugin: FastifyPluginCallback = function (fastify, _opts, next): void {
fastify.get('/typescript', (_request, reply): void => {
reply.send({ script: 'type' })
})

Expand Down
2 changes: 1 addition & 1 deletion test/typescript-jest/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('integration test', function () {
test.concurrent.each(['ts-node', 'ts-node-dev'])(
'integration with %s',
async function (instance) {
await new Promise(function (resolve, reject) {
await new Promise(function (resolve) {
const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`)
let stderr = ''
child.stderr?.on('data', function (b) {
Expand Down
2 changes: 1 addition & 1 deletion test/typescript/basic/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FastifyPluginCallback } from 'fastify'
import { join } from 'node:path'
import fastifyAutoLoad from '../../../'

const app: FastifyPluginCallback = function (fastify, opts, next): void {
const app: FastifyPluginCallback = function (fastify, _opts, next): void {
fastify.register(fastifyAutoLoad, {
dir: join(__dirname, 'foo'),
})
Expand Down
4 changes: 2 additions & 2 deletions test/typescript/basic/foo/javascript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = function (fastify, opts, next) {
fastify.get('/javascript', (request, reply) => {
module.exports = function (fastify, _opts, next) {
fastify.get('/javascript', (_request, reply) => {
reply.send({ script: 'java' })
})

Expand Down
4 changes: 2 additions & 2 deletions test/typescript/basic/foo/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FastifyPluginCallback } from 'fastify'

const plugin: FastifyPluginCallback = function (fastify, opts, next): void {
fastify.get('/typescript', (request, reply): void => {
const plugin: FastifyPluginCallback = function (fastify, _opts, next): void {
fastify.get('/typescript', (_request, reply): void => {
reply.send({ script: 'type' })
})

Expand Down

0 comments on commit 26d60ea

Please sign in to comment.