Skip to content

Commit

Permalink
refactor: prefix unused params with underscores
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jan 7, 2025
1 parent 01d9e14 commit 3c458b0
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fastify.get('/interaction/callback/google', function (request, reply) {
Authorization: 'Bearer ' + result.token.access_token
},
json: true
}, function (err, res, data) {
}, function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fastify.get('/login/facebook/callback', function (request, reply) {
Authorization: 'Bearer ' + result.access_token
},
json: true
}, function (err, res, data) {
}, function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fastify.get('/login/github/verifyAccessToken', function (request, reply) {
body: JSON.stringify({ access_token: accessToken }),
json: true
},
function (err, res, data) {
function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/google-with-pkce.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fastify.get('/interaction/callback/google', function (request, reply) {
Authorization: 'Bearer ' + result.token.access_token
},
json: true
}, function (err, res, data) {
}, function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fastify.get('/login/google/callback', function (request, reply) {
Authorization: 'Bearer ' + result.token.access_token
},
json: true
}, function (err, res, data) {
}, function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/linkedin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fastify.get('/login/linkedin/callback', function (request, reply) {
},
json: true
},
function (err, res, data) {
function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/vatsim-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fastify.get('/login/vatsim/callback', function (request, reply) {
},
json: true
},
function (err, res, data) {
function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/vatsim.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fastify.get('/login/vatsim/callback', function (request, reply) {
},
json: true
},
function (err, res, data) {
function (err, _res, data) {
if (err) {
reply.send(err)
return
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const random = (bytes = 32) => randomBytes(bytes).toString('base64url')
const codeVerifier = random
const codeChallenge = verifier => createHash('sha256').update(verifier).digest('base64url')

function defaultGenerateStateFunction (request, callback) {
function defaultGenerateStateFunction (_request, callback) {
callback(null, random(16))
}

Expand Down Expand Up @@ -607,7 +607,7 @@ fastifyOauth2.APPLE_CONFIGURATION = {
//
// Symbol used in here because we would not like the user to modify this behavior and
// do not want to mess up with property name collision
[kGenerateCallbackUriParams]: function (callbackUriParams, requestObject, scope, state) {
[kGenerateCallbackUriParams]: function (callbackUriParams, _requestObject, scope, _state) {
const stringifyScope = Array.isArray(scope) ? scope.join(' ') : scope
// This behavior is not documented on Apple Developer Docs, but it displays through runtime error.
// Related Docs: https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms
Expand Down
18 changes: 9 additions & 9 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ t.test('fastify-oauth2', t => {
scope: ['notifications']
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -350,7 +350,7 @@ t.test('fastify-oauth2', t => {
userAgent: 'test/1.2.3'
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -394,7 +394,7 @@ t.test('fastify-oauth2', t => {
userAgent: 'test/1.2.3'
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -433,7 +433,7 @@ t.test('fastify-oauth2', t => {
userAgent: false
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -2602,7 +2602,7 @@ t.test('options.generateStateFunction', t => {
auth: fastifyOauth2.GITHUB_CONFIGURATION
},
callbackUri: '/callback',
generateStateFunction: function (request) {
generateStateFunction: function () {
return Promise.reject(new Error('generate state failed'))
},
checkStateFunction: () => true,
Expand Down Expand Up @@ -2644,7 +2644,7 @@ t.test('options.generateStateFunction', t => {
},
callbackUri: '/callback',
startRedirectPath: '/gh',
generateStateFunction: function (request) {
generateStateFunction: function () {
return Promise.reject(new Error('generate state failed'))
},
checkStateFunction: () => true,
Expand Down Expand Up @@ -2716,7 +2716,7 @@ t.test('options.checkStateFunction', t => {
scope: ['notifications']
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -2760,7 +2760,7 @@ t.test('options.checkStateFunction', t => {
scope: ['notifications']
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down Expand Up @@ -2804,7 +2804,7 @@ t.test('options.checkStateFunction', t => {
scope: ['notifications']
})

fastify.get('/', function (request, reply) {
fastify.get('/', function (request) {
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
.then(result => {
// attempts to refresh the token
Expand Down

0 comments on commit 3c458b0

Please sign in to comment.