diff --git a/.eslintrc.json b/.eslintrc.json index 7b51200f..a1a02aad 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,11 +3,13 @@ "eslint:all", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:jsdoc/recommended-typescript-error", "prettier" ], "parser": "@typescript-eslint/parser", "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "jsdoc" ], "root": true, "parserOptions": { diff --git a/package-lock.json b/package-lock.json index 94f49356..8d9c9bbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "devDependencies": { "@types/addons-linter": "^6.16.0", "@types/webextension-polyfill": "^0.10.4", + "eslint-plugin-jsdoc": "^48.2.1", "knip": "^5.0.0" } }, @@ -249,6 +250,20 @@ "node": ">=4" } }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.42.0.tgz", + "integrity": "sha512-R1w57YlVA6+YE01wch3GPYn6bCsrOV3YW/5oGGE2tmX6JcL9Nr+b5IikrjMPF+v9CV3ay+obImEdsDhovhJrzw==", + "dev": true, + "dependencies": { + "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", @@ -1954,6 +1969,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/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -2285,6 +2309,18 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -2770,6 +2806,15 @@ "node": "^12.20.0 || >=14" } }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/common-tags": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", @@ -3513,6 +3558,39 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-jsdoc": { + "version": "48.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.2.1.tgz", + "integrity": "sha512-iUvbcyDZSO/9xSuRv2HQBw++8VkV/pt3UWtX9cpPH0l7GKPq78QC/6+PmyQHHvNZaTjAce6QVciEbnc6J/zH5g==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.42.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.0", + "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/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/eslint-plugin-no-unsanitized": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.0.2.tgz", @@ -4635,6 +4713,21 @@ "node": ">=8" } }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-ci": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", @@ -4940,6 +5033,15 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, + "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", diff --git a/package.json b/package.json index b0863a93..d55183d2 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "devDependencies": { "@types/addons-linter": "^6.16.0", "@types/webextension-polyfill": "^0.10.4", + "eslint-plugin-jsdoc": "^48.2.1", "knip": "^5.0.0" } } diff --git a/src/ts/background.ts b/src/ts/background.ts index ceac2e12..fcb2a260 100644 --- a/src/ts/background.ts +++ b/src/ts/background.ts @@ -23,7 +23,6 @@ const onUpdated = (details: browser.Runtime.OnInstalledDetailsType, isJapanese: /** * This function is called when the extension is installed. * This function opens the onboarding page. - * @param isJapanese if the user's language is Japanese */ const onInstalled = (): void => { const url = browser.runtime.getURL(ONBOARDING_PATH); diff --git a/src/ts/components/sbsMessage.ts b/src/ts/components/sbsMessage.ts index c09fd7f7..10e6b3ff 100644 --- a/src/ts/components/sbsMessage.ts +++ b/src/ts/components/sbsMessage.ts @@ -44,10 +44,6 @@ class SbsMessage extends LitElement { @property({ reflect: true, type: String }) public textColor = "white"; - /** - * This is a comment to disable Knip. - * @public - */ public static styles = css` * { font-family: sans-serif; diff --git a/src/ts/core/parser/parserBase.ts b/src/ts/core/parser/parserBase.ts index 46fd34af..eba3d29e 100644 --- a/src/ts/core/parser/parserBase.ts +++ b/src/ts/core/parser/parserBase.ts @@ -16,6 +16,7 @@ class ParserBase { /** * Get the React props. + * @param element element to parse * @returns React props */ protected getProps(element: Element = this.sourceElement): unknown { diff --git a/src/ts/core/translationKeyProvider.ts b/src/ts/core/translationKeyProvider.ts index 95573bd6..25457691 100644 --- a/src/ts/core/translationKeyProvider.ts +++ b/src/ts/core/translationKeyProvider.ts @@ -16,7 +16,7 @@ class TranslationKeyProvider { /** * Get the message summary from the tweet analysis result. - * @param status tweet analysis result + * @param analyzer tweet analysis result * @returns message summary */ private static summarizeForTweet(analyzer: TweetAnalysisResult): TranslationKey { @@ -61,6 +61,11 @@ class TranslationKeyProvider { return formattedText; } + /** + * Get the account details from the tweet analysis result. + * @param analyzer tweet analysis result + * @returns account details + */ private static getAccountDetails(analyzer: TweetAnalysisResult): SbsMessageDetails { const accountStatus = analyzer.user.shadowbanned ? "accountIsShadowbannedOrFlaggedAsSensitive"