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

refactor: prefix unused params with underscores #165

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fastifyAwilixPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function plugin (fastify, opts, next) {
fastify.decorate('diContainer', resolvedContainer)
fastify.decorateRequest('diScope', null)

fastify.addHook('onRequest', (request, reply, done) => {
fastify.addHook('onRequest', (request, _reply, done) => {
request.diScope = resolvedContainer.createScope()
done()
})
Expand Down Expand Up @@ -82,7 +82,7 @@ function plugin (fastify, opts, next) {
}

if (disposeOnResponse) {
fastify.addHook('onResponse', (request, reply, done) => {
fastify.addHook('onResponse', (request, _reply, done) => {
if (request.diScope) {
request.diScope.dispose().then(done, done)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const app: FastifyInstance = fastify()

app.register(fastifyAwilixPlugin, {})

app.addHook('onRequest', (request, reply, done) => {
app.addHook('onRequest', (request, _reply, done) => {
request.diScope.register({
user: asValue({
name: 'John Doe',
Expand Down
10 changes: 5 additions & 5 deletions test/fastifyAwilixPlugin.dispose.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('fastifyAwilixPlugin', () => {

variations.forEach((variation) => {
describe(variation.injectionMode, () => {
const endpoint = async (req, res) => {
const endpoint = async (_req, res) => {
const userRepository = app.diContainer.resolve('userRepository')
storedUserRepository = userRepository

Expand Down Expand Up @@ -140,7 +140,7 @@ describe('fastifyAwilixPlugin', () => {

it('do not attempt to dispose request scope if response was returned before it was even created', async () => {
app = fastify({ logger: true })
await app.addHook('onRequest', (request, reply) => {
await app.addHook('onRequest', (_request, reply) => {
return reply.send('OK')
})

Expand All @@ -157,7 +157,7 @@ describe('fastifyAwilixPlugin', () => {
})

let storedError = null
app.setErrorHandler((err, request, reply) => {
app.setErrorHandler((err, _request, reply) => {
storedError = err
return reply.send('Error')
})
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('fastifyAwilixPlugin', () => {
dispose: (service) => service.dispose()
})
})
app.addHook('onRequest', (request, reply, done) => {
app.addHook('onRequest', (request, _reply, done) => {
request.diScope.register({
userRepositoryScoped: asClass(UserRepository, {
lifetime: Lifetime.SCOPED,
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('fastifyAwilixPlugin', () => {
dispose: (service) => service.dispose()
})
})
app.addHook('onRequest', (request, reply, done) => {
app.addHook('onRequest', (request, _reply, done) => {
request.diScope.register({
userRepositoryScoped: asClass(UserRepository, {
lifetime: Lifetime.SCOPED,
Expand Down
Loading