Skip to content

Commit 3b91cb0

Browse files
author
Beatriz Rizental
authored
Add jsdoc rules to linter and fix errors (#12)
1 parent b35dcf8 commit 3b91cb0

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@
1717
}
1818
],
1919
"semi": ["error", "always"],
20-
"no-debugger": ["error"]
20+
"no-debugger": ["error"],
21+
"jsdoc/no-types": "off",
22+
"jsdoc/require-param-type": "off",
23+
"jsdoc/require-returns-type": "off"
2124
},
25+
"extends": [
26+
"plugin:jsdoc/recommended"
27+
],
2228
"parser": "@typescript-eslint/parser",
2329
"plugins": [
2430
"@typescript-eslint",

src/storage/persistent/webext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class WebExtStore implements Store {
4444
*
4545
* @param index The index to the given entry on the storage.
4646
*
47-
* @return The query object.
47+
* @returns The query object.
4848
*/
4949
private _buildQuery(index: StorageIndex): WebExtStoreQuery {
5050
let partialQuery = null;

src/utils.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,38 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5+
/**
6+
* Checks whether or not `v` is a simple data object.
7+
*
8+
* @param v The value to verify.
9+
*
10+
* @returns A special Typescript value (which compiles down to a boolean)
11+
* stating wether `v` is a valid data object.
12+
*/
513
export function isObject(v: unknown): v is Record<string | number | symbol, unknown> {
614
return (v && typeof v === "object" && v.constructor === Object);
715
}
816

17+
/**
18+
* Checks whether or not `v` is undefined.
19+
*
20+
* @param v The value to verify.
21+
*
22+
* @returns A special Typescript value (which compiles down to a boolean)
23+
* stating wether `v` is undefined.
24+
*/
925
export function isUndefined(v: unknown): v is undefined {
1026
return typeof v === "undefined";
1127
}
1228

29+
/**
30+
* Checks whether or not `v` is a string.
31+
*
32+
* @param v The value to verify.
33+
*
34+
* @returns A special Typescript value (which compiles down to a boolean)
35+
* stating wether `v` is a string.
36+
*/
1337
export function isString(v: unknown): v is string {
1438
return (v && (typeof v === "string" || (v === "object" && v.constructor === String)));
1539
}

tests/utils/webext/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export async function setupFirefox(headless: boolean): Promise<WebDriver> {
6565
* @param browser A Webdriver where we will run this proxied script
6666
* @param method The method which we want to execute.
6767
* This array will work exactly like the StorageIndex.
68+
*
69+
* @returns A proxy function for the given browser method.
6870
*/
6971
export function webExtensionAPIProxyBuilder(browser: WebDriver, method: string[]) {
7072
return async function (...args: never[]): Promise<any> {

0 commit comments

Comments
 (0)