From ea517f839e9d7a17a16b0a31913d70474eb7a0fc Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 18 Dec 2023 19:42:45 +0000 Subject: [PATCH] style: jsdoc comments must be complete sentences --- .eslintrc.js | 1 + scripts/license-checker.js | 2 +- src/routes/redirect/index.js | 2 +- src/server.js | 6 +++--- src/server.test.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c548e074..9a8de79e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -47,6 +47,7 @@ module.exports = { "@eslint-community/eslint-comments/require-description": "error", "import/no-extraneous-dependencies": "error", "jsdoc/check-syntax": "error", + "jsdoc/require-description-complete-sentence": "error", "jsdoc/require-hyphen-before-param-description": "error", "no-multiple-empty-lines": ["error", { max: 1 }], "prefer-destructuring": ["error", { object: true, array: false }], diff --git a/scripts/license-checker.js b/scripts/license-checker.js index 9c9ce70f..a51281f2 100644 --- a/scripts/license-checker.js +++ b/scripts/license-checker.js @@ -18,7 +18,7 @@ async function checkLicenses() { console.log("Checking licenses of direct production dependencies..."); /** - * List of deprecated copyleft license identifiers + * List of deprecated copyleft license identifiers. * @see {@link https://spdx.org/licenses/#deprecated | SPDX Deprecated License Identifiers} */ const deprecatedLicenseList = [ diff --git a/src/routes/redirect/index.js b/src/routes/redirect/index.js index f81ea130..84a118f2 100644 --- a/src/routes/redirect/index.js +++ b/src/routes/redirect/index.js @@ -57,7 +57,7 @@ async function route(server, options) { /** * Unable to use WHATWG URL API here to serialise URL, * as the API treats hashes in shebangs as the start - * of a fragment + * of a fragment. */ const espUrl = options.redirectUrl + fastStringify(req.query); server.log.debug(espUrl); diff --git a/src/server.js b/src/server.js index 9a51ad3c..4c95c1b7 100644 --- a/src/server.js +++ b/src/server.js @@ -119,7 +119,7 @@ async function plugin(server, config) { /** * Encapsulate the docs routes into a child context, so that the * CSP can be relaxed, and cache enabled, without affecting - * security of other routes + * security of other routes. */ .register(async (publicContext) => { const relaxedHelmetConfig = structuredClone(config.helmet); @@ -173,13 +173,13 @@ async function plugin(server, config) { /** * Catch 5xx errors, log them, and return a generic 500 * response. This avoids leaking internal server error details - * to the client + * to the client. */ if ( (err.statusCode >= 500 && err.statusCode !== 503) || /** * Uncaught errors will have a res.statusCode but not - * an err.statusCode as @fastify/sensible sets that + * an err.statusCode as @fastify/sensible sets that. */ (res.statusCode === 200 && !err.statusCode) ) { diff --git a/src/server.test.js b/src/server.test.js index 50fdbf22..61404e9f 100644 --- a/src/server.test.js +++ b/src/server.test.js @@ -739,7 +739,7 @@ describe("Server deployment", () => { }); }); - /** @todo fix this impacting the API documentation `describe` block, and move it back to running before it */ + /** @todo Fix this impacting the API documentation `describe` block, and move it back to running before it. */ describe("Query string API key auth enabled", () => { let config; /** @type {Fastify.FastifyInstance} */