Skip to content

Commit af6aa76

Browse files
committed
- Linting (ESLint): Avoid "useless" catch error; adhere to stricter jsdoc context checking
- Minor fixes for template files for gitignore/package.json/README - npm: update devDeps
1 parent b3a5346 commit af6aa76

File tree

12 files changed

+646
-122
lines changed

12 files changed

+646
-122
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
},
66
extends: [
77
'@passport-next/eslint-config-passport-next/sauron-node.js',
8-
// Override ash-nazg's current preference for ESM
8+
// Override eslint-config-passport-next's current preference for ESM
99
'plugin:node/recommended-script'
1010
],
1111
settings: {
@@ -74,7 +74,7 @@ module.exports = {
7474
// Disable until ready to tackle
7575
'require-jsdoc': 0,
7676

77-
// Disable current preferences of ash-nazg
77+
// Disable current preferences of eslint-config-passport-next
7878
'import/no-commonjs': 0,
7979
'node/exports-style': 0,
8080

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
reports/
22
docs/jsdoc
3-
.github/docs/jsdoc
43
var/
54

65

lib/http/request.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const req = exports = module.exports = {};
3232
* try {
3333
* await req.logIn(user);
3434
* } catch (err) {
35+
* console.error(err);
3536
* throw err;
3637
* }
3738
* // session saved

lib/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ const SessionStrategy = require('./strategies/session');
3232
* @typedef {external:HttpServerResponse} Response
3333
*/
3434

35+
/**
36+
* @external ConnectNextCallback
37+
*/
38+
3539
/**
3640
* This middleware conforms to Connect/Express middleware by
3741
* the arguments it accepts.
3842
* @see Conforms to {@link external:ConnectMiddleware}
3943
* @callback ConnectMiddleware
4044
* @param {Request} req
4145
* @param {Response} res
42-
* @param {Function} next
46+
* @param {ConnectNextCallback} next
4347
* @returns {void}
4448
*/
4549

lib/middleware/authenticate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const AuthenticationError = require('../errors/authenticationerror');
1818
* @param {Error|null} error
1919
* @param {false|User} user Set to the authenticated user on a successful
2020
* authentication attempt, or `false` otherwise.
21-
* @param {*} [info] Contains additional details provided by the strategy's verify
21+
* @param {Any} [info] Contains additional details provided by the strategy's verify
2222
* callback - this could be information about a successful authentication or a
2323
* challenge message for a failed authentication.
24-
* @param {*} [status] Passed when authentication fails - this could
24+
* @param {Any} [status] Passed when authentication fails - this could
2525
* be an HTTP response code for a remote authentication failure or similar.
2626
* @returns {void}
2727
* @example
@@ -329,6 +329,7 @@ module.exports = function authenticate(passport, name, options, callback) {
329329
if (options.authInfo !== false) {
330330
try {
331331
const tinfo = await passport.transformAuthInfo(info, req);
332+
// eslint-disable-next-line require-atomic-updates
332333
req.authInfo = tinfo;
333334
complete();
334335
} catch (err) {

lib/sessionmanager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class SessionManager {
5555
}
5656
return;
5757
}
58+
/* eslint-disable require-atomic-updates */
5859
if (!req._passport.session) {
5960
req._passport.session = {};
6061
}
@@ -63,6 +64,7 @@ class SessionManager {
6364
req.session = {};
6465
}
6566
req.session[this._key] = req._passport.session;
67+
/* eslint-enable require-atomic-updates */
6668
// eslint-disable-next-line no-unused-expressions
6769
cb && cb();
6870
}

lib/strategies/session.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class SessionStrategy extends Strategy {
8585
} else {
8686
// TODO: Remove instance access (set by `initialize`)
8787
const property = req._passport.instance._userProperty || 'user';
88+
// eslint-disable-next-line require-atomic-updates
8889
req[property] = user;
8990
}
9091
this.pass();

0 commit comments

Comments
 (0)