From 421c2ef45e0cd16bde9a6833eaa3fb6cc934b70e Mon Sep 17 00:00:00 2001 From: Juuddi Date: Wed, 22 May 2024 11:36:12 -0500 Subject: [PATCH] Add jsdoc linter plugin + rules --- .eslintrc.js | 41 +++++++++++++++++- package-lock.json | 103 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 144 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index ce1e18d7..5f5df453 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,11 +1,50 @@ module.exports = { parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'jsdoc'], extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], parserOptions: { project: './tsconfig.base.json', }, rules: { '@typescript-eslint/no-explicit-any': 'off', + 'jsdoc/check-access': 1, // Recommended + 'jsdoc/check-alignment': 1, // Recommended + 'jsdoc/check-indentation': 1, + 'jsdoc/check-line-alignment': 1, + 'jsdoc/check-param-names': 1, // Recommended + 'jsdoc/check-property-names': 1, // Recommended + 'jsdoc/check-syntax': 1, + 'jsdoc/check-types': 1, // Recommended + 'jsdoc/check-values': 1, // Recommended + 'jsdoc/empty-tags': 1, // Recommended + 'jsdoc/implements-on-classes': 1, // Recommended + 'jsdoc/informative-docs': 1, + 'jsdoc/match-description': 1, + 'jsdoc/multiline-blocks': 1, // Recommended + 'jsdoc/no-bad-blocks': 1, + 'jsdoc/no-blank-block-descriptions': 1, + 'jsdoc/no-defaults': 1, + 'jsdoc/no-multi-asterisks': 1, // Recommended + 'jsdoc/no-types': 1, + 'jsdoc/no-undefined-types': 1, // Recommended + 'jsdoc/require-asterisk-prefix': 1, + 'jsdoc/require-description': 1, + 'jsdoc/require-description-complete-sentence': 1, + 'jsdoc/require-hyphen-before-param-description': 1, + 'jsdoc/require-jsdoc': 1, // Recommended + 'jsdoc/require-param': 1, // Recommended + 'jsdoc/require-param-description': 1, // Recommended + 'jsdoc/require-param-name': 1, // Recommended + 'jsdoc/require-property': 1, // Recommended + 'jsdoc/require-property-description': 1, // Recommended + 'jsdoc/require-property-name': 1, // Recommended + 'jsdoc/require-property-type': 1, // Recommended + 'jsdoc/require-returns': 1, // Recommended + 'jsdoc/require-returns-check': 1, // Recommended + 'jsdoc/require-returns-description': 1, // Recommended + 'jsdoc/require-throws': 1, + 'jsdoc/require-yields': 1, // Recommended + 'jsdoc/require-yields-check': 1, // Recommended + 'jsdoc/valid-types': 1, // Recommended }, }; diff --git a/package-lock.json b/package-lock.json index f5b92fa6..37cacc0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "eslint": "^8.57.0", "eslint-config-airbnb-typescript": "^18.0.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^48.2.5", "husky": "^9.0.11", "lint-staged": "^15.2.2", "mocha": "10.0.0", @@ -186,6 +187,23 @@ "resolved": "https://registry.npmjs.org/@brandonblack/musig/-/musig-0.0.1-alpha.1.tgz", "integrity": "sha512-00RbByQG85lSzrkDjCblzrUc2n1LJAPPrEMHS4oMg+QckE0kzjd26JytT6yx6tNU2+aOXfK7O4kGW/sKVL67cw==" }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.43.0.tgz", + "integrity": "sha512-Q1CnsQrytI3TlCB1IVWXWeqUIPGVEKGaE7IbVdt13Nq/3i0JESAkQQERrfiQkmlpijl+++qyqPgaS31Bvc1jRQ==", + "dev": true, + "dependencies": { + "@types/eslint": "^8.56.5", + "@types/estree": "^1.0.5", + "@typescript-eslint/types": "^7.2.0", + "comment-parser": "1.4.1", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -513,6 +531,16 @@ "@types/ms": "*" } }, + "node_modules/@types/eslint": { + "version": "8.56.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", + "integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -1010,6 +1038,15 @@ "node": ">= 8" } }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2215,6 +2252,41 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-jsdoc": { + "version": "48.2.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.2.5.tgz", + "integrity": "sha512-ZeTfKV474W1N9niWfawpwsXGu+ZoMXu4417eBROX31d7ZuOk8zyG66SO77DpJ2+A9Wa2scw/jRqBPnnQo7VbcQ==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.43.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.6.1", + "spdx-expression-parse": "^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -3502,6 +3574,15 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -5420,6 +5501,28 @@ "source-map": "^0.6.0" } }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", + "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", + "dev": true + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", diff --git a/package.json b/package.json index 383a4bf8..fd1e32c8 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "eslint": "^8.57.0", "eslint-config-airbnb-typescript": "^18.0.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^48.2.5", "husky": "^9.0.11", "lint-staged": "^15.2.2", "mocha": "10.0.0",