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 #374

Merged
merged 1 commit into from
Jan 7, 2025
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
2 changes: 1 addition & 1 deletion benchmarks/0http.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const cero = require('0http')
const { router, server } = cero()

router.get('/', (req, res) => {
router.get('/', (_req, res) => {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bare.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const server = require('node:http').createServer(function (req, res) {
const server = require('node:http').createServer(function (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/connect-router.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const connect = require('connect')
const router = require('router')()

const app = connect()
router.get('/', function (req, res) {
router.get('/', function (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/connect.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const connect = require('connect')

const app = connect()
app.use(function (req, res) {
app.use(function (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/express-with-middlewares.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use(require('hsts')())
app.use(require('ienoopen')())
app.use(require('x-xss-protection')())

app.get('/', function (req, res) {
app.get('/', function (_req, res) {
res.json({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/express.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const app = express()
app.disable('etag')
app.disable('x-powered-by')

app.get('/', function (req, res) {
app.get('/', function (_req, res) {
res.json({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fastify-big-json.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Employee ({ id = null, title = null, employer = null } = {}) {
this.employer = employer
}

fastify.get('/', opts, function (request, reply) {
fastify.get('/', opts, function (_request, reply) {
const jobs = []

for (let i = 0; i < 200; i += 1) {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fastify.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const schema = {
}
}

fastify.get('/', schema, function (req, reply) {
fastify.get('/', schema, function (_req, reply) {
reply.send({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/hapi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function start () {
},
state: { parse: false }
},
handler: function (request, h) {
handler: function () {
return { hello: 'world' }
}
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/micro-route.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const http = require('http')
const { send, serve } = require('micro')
const dispatch = require('micro-route/dispatch')

const handler = (req, res) => send(res, 200, { hello: 'world' })
const handler = (_req, res) => send(res, 200, { hello: 'world' })

const server = new http.Server(serve(dispatch('/', 'GET', handler)))

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/micro.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const http = require('http')
const { serve } = require('micro')

const server = new http.Server(
serve(async function (req, res) {
serve(async function () {
return { hello: 'world' }
})
)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/microrouter.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const http = require('http')
const { serve, send } = require('micro')
const { router, get } = require('microrouter')

const hello = async function (req, res) {
const hello = async function (_req, res) {
return send(res, 200, { hello: 'world' })
}
const server = new http.Server(serve(router(get('/', hello))))
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/polka.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const polka = require('polka')

const app = polka()

app.get('/', (req, res) => {
app.get('/', (_req, res) => {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/polkadot.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const polkadot = require('polkadot')

polkadot(function (req, res) {
polkadot(function (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
}).listen(3000)
2 changes: 1 addition & 1 deletion benchmarks/rayo.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async function run () {

const app = rayo({ port: 3000 })

app.get('/', (req, res) => {
app.get('/', (_req, res) => {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.end(JSON.stringify({ hello: 'world' }))
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/restana.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const restana = require('restana')

const app = restana()

app.get('/', (req, res) => {
app.get('/', (_req, res) => {
res.send({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/restify.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const restify = require('restify')

const server = restify.createServer()
server.get('/', function (req, res, next) {
server.get('/', function (_req, res, next) {
res.send({ hello: 'world' })
return next()
})
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/server-base-router.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require('node:http')
ctx.middlewareFunctions = []
},
'/': {
get (req, res) {
get (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.json({ hello: 'world' })
}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/server-base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require('server-base')({
ctx.middlewareFunctions = []
},
'/': {
get (req, res) {
get (_req, res) {
res.setHeader('content-type', 'application/json; charset=utf-8')
res.json({ hello: 'world' })
}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/take-five.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Five = require('take-five')

const server = new Five()

server.get('/', function (req, res, ctx) {
server.get('/', function (_req, _res, ctx) {
return ctx.send({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/tinyhttp.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { App } from '@tinyhttp/app'

const app = new App()

app.get('/', (_, res) => {
app.get('/', (_req, res) => {
res.send('Hello World!')
})

Expand Down
Loading