Skip to content

Commit 61b1fa8

Browse files
authored
refactor: prefix unused params with underscores (#283)
1 parent 01d9e14 commit 61b1fa8

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

examples/discovery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fastify.get('/interaction/callback/google', function (request, reply) {
7575
Authorization: 'Bearer ' + result.token.access_token
7676
},
7777
json: true
78-
}, function (err, res, data) {
78+
}, function (err, _res, data) {
7979
if (err) {
8080
reply.send(err)
8181
return

examples/facebook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fastify.get('/login/facebook/callback', function (request, reply) {
3333
Authorization: 'Bearer ' + result.access_token
3434
},
3535
json: true
36-
}, function (err, res, data) {
36+
}, function (err, _res, data) {
3737
if (err) {
3838
reply.send(err)
3939
return

examples/github.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fastify.get('/login/github/verifyAccessToken', function (request, reply) {
7979
body: JSON.stringify({ access_token: accessToken }),
8080
json: true
8181
},
82-
function (err, res, data) {
82+
function (err, _res, data) {
8383
if (err) {
8484
reply.send(err)
8585
return

examples/google-with-pkce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fastify.get('/interaction/callback/google', function (request, reply) {
7070
Authorization: 'Bearer ' + result.token.access_token
7171
},
7272
json: true
73-
}, function (err, res, data) {
73+
}, function (err, _res, data) {
7474
if (err) {
7575
reply.send(err)
7676
return

examples/google.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fastify.get('/login/google/callback', function (request, reply) {
3434
Authorization: 'Bearer ' + result.token.access_token
3535
},
3636
json: true
37-
}, function (err, res, data) {
37+
}, function (err, _res, data) {
3838
if (err) {
3939
reply.send(err)
4040
return

examples/linkedin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fastify.get('/login/linkedin/callback', function (request, reply) {
4242
},
4343
json: true
4444
},
45-
function (err, res, data) {
45+
function (err, _res, data) {
4646
if (err) {
4747
reply.send(err)
4848
return

examples/vatsim-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fastify.get('/login/vatsim/callback', function (request, reply) {
3838
},
3939
json: true
4040
},
41-
function (err, res, data) {
41+
function (err, _res, data) {
4242
if (err) {
4343
reply.send(err)
4444
return

examples/vatsim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fastify.get('/login/vatsim/callback', function (request, reply) {
3838
},
3939
json: true
4040
},
41-
function (err, res, data) {
41+
function (err, _res, data) {
4242
if (err) {
4343
reply.send(err)
4444
return

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const random = (bytes = 32) => randomBytes(bytes).toString('base64url')
2121
const codeVerifier = random
2222
const codeChallenge = verifier => createHash('sha256').update(verifier).digest('base64url')
2323

24-
function defaultGenerateStateFunction (request, callback) {
24+
function defaultGenerateStateFunction (_request, callback) {
2525
callback(null, random(16))
2626
}
2727

@@ -607,7 +607,7 @@ fastifyOauth2.APPLE_CONFIGURATION = {
607607
//
608608
// Symbol used in here because we would not like the user to modify this behavior and
609609
// do not want to mess up with property name collision
610-
[kGenerateCallbackUriParams]: function (callbackUriParams, requestObject, scope, state) {
610+
[kGenerateCallbackUriParams]: function (callbackUriParams, _requestObject, scope, _state) {
611611
const stringifyScope = Array.isArray(scope) ? scope.join(' ') : scope
612612
// This behavior is not documented on Apple Developer Docs, but it displays through runtime error.
613613
// Related Docs: https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms

test/index.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ t.test('fastify-oauth2', t => {
272272
scope: ['notifications']
273273
})
274274

275-
fastify.get('/', function (request, reply) {
275+
fastify.get('/', function (request) {
276276
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
277277
.then(result => {
278278
// attempts to refresh the token
@@ -350,7 +350,7 @@ t.test('fastify-oauth2', t => {
350350
userAgent: 'test/1.2.3'
351351
})
352352

353-
fastify.get('/', function (request, reply) {
353+
fastify.get('/', function (request) {
354354
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
355355
.then(result => {
356356
// attempts to refresh the token
@@ -394,7 +394,7 @@ t.test('fastify-oauth2', t => {
394394
userAgent: 'test/1.2.3'
395395
})
396396

397-
fastify.get('/', function (request, reply) {
397+
fastify.get('/', function (request) {
398398
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
399399
.then(result => {
400400
// attempts to refresh the token
@@ -433,7 +433,7 @@ t.test('fastify-oauth2', t => {
433433
userAgent: false
434434
})
435435

436-
fastify.get('/', function (request, reply) {
436+
fastify.get('/', function (request) {
437437
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
438438
.then(result => {
439439
// attempts to refresh the token
@@ -2602,7 +2602,7 @@ t.test('options.generateStateFunction', t => {
26022602
auth: fastifyOauth2.GITHUB_CONFIGURATION
26032603
},
26042604
callbackUri: '/callback',
2605-
generateStateFunction: function (request) {
2605+
generateStateFunction: function () {
26062606
return Promise.reject(new Error('generate state failed'))
26072607
},
26082608
checkStateFunction: () => true,
@@ -2644,7 +2644,7 @@ t.test('options.generateStateFunction', t => {
26442644
},
26452645
callbackUri: '/callback',
26462646
startRedirectPath: '/gh',
2647-
generateStateFunction: function (request) {
2647+
generateStateFunction: function () {
26482648
return Promise.reject(new Error('generate state failed'))
26492649
},
26502650
checkStateFunction: () => true,
@@ -2716,7 +2716,7 @@ t.test('options.checkStateFunction', t => {
27162716
scope: ['notifications']
27172717
})
27182718

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

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

2807-
fastify.get('/', function (request, reply) {
2807+
fastify.get('/', function (request) {
28082808
return this.githubOAuth2.getAccessTokenFromAuthorizationCodeFlow(request)
28092809
.then(result => {
28102810
// attempts to refresh the token

0 commit comments

Comments
 (0)