From fa997d8c2c52dc38497382ff911b794892a61116 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 27 May 2019 11:44:43 +0800 Subject: [PATCH] - Linting; Avoid need for settings with new ash-nazg defaults; disable require-jsdoc for tests; use new preference for "object" over "Object" - npm: Update devDeps --- .eslintrc.js | 8 +----- lib/authenticator.js | 11 ++++++--- lib/middleware/authenticate.js | 7 +++--- package-lock.json | 45 ++++++++++++++++++++-------------- package.json | 12 +++++---- 5 files changed, 46 insertions(+), 37 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4802dcd9..8b4dc4ae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,13 +8,6 @@ module.exports = { // Override ash-nazg's current preference for ESM 'plugin:node/recommended-script' ], - settings: { - jsdoc: { - // For `jsdoc/check-examples` in `ash-nazg` - matchingFileName: 'dummy.md', - rejectExampleCodeRegex: '^`', - } - }, overrides: [ { files: ['test/**'], @@ -26,6 +19,7 @@ module.exports = { expect: 'readonly' }, rules: { + 'jsdoc/require-jsdoc': 'off' // 'jest/no-disabled-tests': [2], // 'jest/no-focused-tests': [2], // 'jest/no-identical-title': [2], diff --git a/lib/authenticator.js b/lib/authenticator.js index 2d7e4bce..e0f9b443 100644 --- a/lib/authenticator.js +++ b/lib/authenticator.js @@ -103,7 +103,7 @@ class Authenticator { * * passport.framework(require('hapi-passport')()); * - * @param {Object} fw + * @param {object} fw * @returns {Authenticator} for chaining * @public */ @@ -167,7 +167,7 @@ class Authenticator { * }); * * @param {string} strategy - * @param {Object} options + * @param {object} options * @param {Function} callback * @returns {Function} middleware * @public @@ -192,7 +192,7 @@ class Authenticator { * passport.authorize('twitter-authz', { failureRedirect: '/account' }); * * @param {string} strategy - * @param {Object} options + * @param {object} options * @param {Function} callback * @returns {Function} middleware * @public @@ -230,7 +230,7 @@ class Authenticator { * app.use(passport.initialize()); * app.use(passport.session()); * - * @param {Object} options + * @param {object} options * @returns {Function} middleware * @public */ @@ -297,6 +297,7 @@ class Authenticator { } + // eslint-disable-next-line jsdoc/require-jsdoc function serialized(e, o) { pass(i + 1, e, o); } @@ -363,6 +364,7 @@ class Authenticator { } + // eslint-disable-next-line jsdoc/require-jsdoc function deserialized(e, u) { pass(i + 1, e, u); } @@ -453,6 +455,7 @@ class Authenticator { } + // eslint-disable-next-line jsdoc/require-jsdoc function transformed(e, t) { pass(i + 1, e, t); } diff --git a/lib/middleware/authenticate.js b/lib/middleware/authenticate.js index b3a07912..b9fa6c42 100644 --- a/lib/middleware/authenticate.js +++ b/lib/middleware/authenticate.js @@ -65,7 +65,7 @@ const AuthenticationError = require('../errors/authenticationerror'); * * @param {Authenticator} passport * @param {string|Array} name - * @param {Object} options + * @param {object} options * @param {Function} callback * @returns {Function} * @public @@ -98,6 +98,7 @@ module.exports = function authenticate(passport, name, options, callback) { // accumulator for failures from each strategy in the chain const failures = []; + // eslint-disable-next-line jsdoc/require-jsdoc function redirect(url) { if (req.session && req.session.save && typeof req.session.save === 'function') { return req.session.save(() => res.redirect(url)); @@ -105,7 +106,7 @@ module.exports = function authenticate(passport, name, options, callback) { return res.redirect(url); } - // eslint-disable-next-line consistent-return + // eslint-disable-next-line consistent-return, jsdoc/require-jsdoc function allFailed() { if (callback) { if (!multi) { @@ -254,7 +255,7 @@ module.exports = function authenticate(passport, name, options, callback) { req.logIn(user, options, (err) => { if (err) { return next(err); } - // eslint-disable-next-line consistent-return + // eslint-disable-next-line consistent-return, jsdoc/require-jsdoc function complete() { if (options.successReturnToOrRedirect) { let url = options.successReturnToOrRedirect; diff --git a/package-lock.json b/package-lock.json index 6b132837..2dbea522 100644 --- a/package-lock.json +++ b/package-lock.json @@ -641,9 +641,9 @@ } }, "eslint-config-ash-nazg": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-4.0.0.tgz", - "integrity": "sha512-LUroSU/VqempjeWSIgMDu3byW8iWKfwj4aqEGm0W8oqHe4HCP87Ny0MVChOXjSoz9lDEC2PjXmnxL2Zt03Mfog==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-6.0.1.tgz", + "integrity": "sha512-kar5/5XS6WBnuGCBgLgAiRU7h89BS8YsIvcZLnY3kVE5xr5yuup2VE/yDK465IBPvkBXgOwSYKjXjCQDUrjeiQ==", "dev": true }, "eslint-config-standard": { @@ -747,9 +747,9 @@ "dev": true }, "eslint-plugin-import": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz", - "integrity": "sha512-m+cSVxM7oLsIpmwNn2WXTJoReOF9f/CtLMo7qOVmKd1KntBy0hEcuNZ3erTmWjx+DxRO0Zcrm5KwAvI9wHcV5g==", + "version": "2.17.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.17.3.tgz", + "integrity": "sha512-qeVf/UwXFJbeyLbxuY8RgqDyEKCkqV7YC+E5S5uOjAp4tOc8zj01JP3ucoBM8JcEqd1qRasJSg6LLlisirfy0Q==", "dev": true, "requires": { "array-includes": "^3.0.3", @@ -762,7 +762,7 @@ "lodash": "^4.17.11", "minimatch": "^3.0.4", "read-pkg-up": "^2.0.0", - "resolve": "^1.10.0" + "resolve": "^1.11.0" }, "dependencies": { "debug": { @@ -789,13 +789,22 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true + }, + "resolve": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", + "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } } } }, "eslint-plugin-jsdoc": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-4.8.3.tgz", - "integrity": "sha512-lKOaphUUzv0qKJrAdEwQGEWcNN2Foae5W111u1ASKQeliyJkKXCVxia0dakATuI/s2ojr6Q3FVzWwT6uE1icBg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-7.0.2.tgz", + "integrity": "sha512-iqPdJsBy88FLrr8ru69Ab+SKPrjNEQwK2vicGXrBbDA6aia8IRVz2J2LPCfwdyuSxrI91bd4Za1Z57TC5tUp2w==", "dev": true, "requires": { "comment-parser": "^0.5.4", @@ -827,9 +836,9 @@ } }, "eslint-plugin-node": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.0.1.tgz", - "integrity": "sha512-fljT5Uyy3lkJzuqhxrYanLSsvaILs9I7CmQ31atTtZ0DoIzRbbvInBh4cQ1CrthFHInHYBQxfPmPt6KLHXNXdw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.1.0.tgz", + "integrity": "sha512-ZwQYGm6EoV2cfLpE1wxJWsfnKUIXfM/KM09/TlorkukgCAwmkgajEJnPCmyzoFPQQkmvo5DrW/nyKutNIw36Mw==", "dev": true, "requires": { "eslint-plugin-es": "^1.4.0", @@ -837,13 +846,13 @@ "ignore": "^5.1.1", "minimatch": "^3.0.4", "resolve": "^1.10.1", - "semver": "^6.0.0" + "semver": "^6.1.0" }, "dependencies": { "semver": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz", - "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz", + "integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==", "dev": true } } @@ -2486,7 +2495,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, diff --git a/package.json b/package.json index 3f34c424..7854b97f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "homepage": "https://github.com/passport-next/passport", "license": "MIT", "main": "./lib", - "browserslist": ["node >= 8.0.0"], + "browserslist": [ + "node >= 8.0.0" + ], "dependencies": { "@passport-next/passport-strategy": "1.x.x" }, @@ -37,15 +39,15 @@ "chai-connect-middleware": "0.x.x", "eslint": "^5.16.0", "eslint-config-airbnb-base": "13.x.x", - "eslint-config-ash-nazg": "^4.0.0", + "eslint-config-ash-nazg": "^6.0.1", "eslint-config-standard": "^12.0.0", "eslint-plugin-compat": "^3.1.1", "eslint-plugin-eslint-comments": "^3.1.1", - "eslint-plugin-import": "^2.17.2", - "eslint-plugin-jsdoc": "^4.8.3", + "eslint-plugin-import": "^2.17.3", + "eslint-plugin-jsdoc": "^7.0.2", "eslint-plugin-markdown": "^1.0.0", "eslint-plugin-no-use-extend-native": "^0.4.0", - "eslint-plugin-node": "^9.0.1", + "eslint-plugin-node": "^9.1.0", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-unicorn": "^8.0.2",