Skip to content

Commit c5c3790

Browse files
chore: Remove jsdoc hyphens (#1947)
1 parent f3bc961 commit c5c3790

19 files changed

+96
-91
lines changed

eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export default [
3333
*/
3434
jsdoc.configs['flat/recommended'],
3535

36+
/**
37+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-hyphen-before-param-description.md
38+
*/
39+
{ rules: { 'jsdoc/require-hyphen-before-param-description': ['error', 'never', { tags: { '*': 'never' } }] } },
40+
3641
/**
3742
* Do not require JSDoc on "main world" injected scripts, which have definitions
3843
* which make them look reusable but are only used by the `inject()` util.

src/features/mass_privater/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const dateTimeFormat = new Intl.DateTimeFormat(document.documentElement.lang, {
2222
/**
2323
* Adds string elements between an array's items to format it as an English prose list.
2424
* The Oxford comma is included.
25-
* @param {any[]} array - Input array of any number of items
26-
* @param {string} andOr - String 'and' or 'or', used before the last item
25+
* @param {any[]} array Input array of any number of items
26+
* @param {string} andOr String 'and' or 'or', used before the last item
2727
* @returns {any[]} An array alternating between the input items and strings
2828
*/
2929
const elementsAsList = (array, andOr) =>

src/utils/control_buttons.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ $('.xkit-control-button-container').remove();
88

99
/**
1010
* Create a button template that can be cloned with cloneControlButton() for inserting into the controls of a post.
11-
* @param {string} symbolId - The name of the RemixIcon to use
12-
* @param {string} buttonClass - An extra class to identify the extension that added the button
13-
* @param {string} label - Descriptive text to be set as the button aria-label property and tooltip
11+
* @param {string} symbolId The name of the RemixIcon to use
12+
* @param {string} buttonClass An extra class to identify the extension that added the button
13+
* @param {string} label Descriptive text to be set as the button aria-label property and tooltip
1414
* @returns {HTMLDivElement} A button that can be cloned with cloneControlButton()
1515
*/
1616
export const createControlButtonTemplate = function (symbolId, buttonClass, label = '') {
@@ -25,10 +25,10 @@ export const createControlButtonTemplate = function (symbolId, buttonClass, labe
2525

2626
/**
2727
* Create a deep-level clone of a button template that is ready to add to the page
28-
* @param {HTMLDivElement} template - A button template as returned by createControlButtonTemplate()
29-
* @param {object} events - An object of DOM Event names and handler functions,
28+
* @param {HTMLDivElement} template A button template as returned by createControlButtonTemplate()
29+
* @param {object} events An object of DOM Event names and handler functions,
3030
* e.g. { click: () => { alert('Hello!'); } }
31-
* @param {boolean} disabled - Whether to disable the button clone
31+
* @param {boolean} disabled Whether to disable the button clone
3232
* @returns {HTMLDivElement} A clone of the button template, with the specified event handlers attached
3333
*/
3434
export const cloneControlButton = function (template, events, disabled = false) {
@@ -43,7 +43,7 @@ const secondaryFooterRowClass = 'xkit-controls-row';
4343

4444
/**
4545
* Adds a secondary footer row above the footer control buttons, similar to the one in the pre-2025 footer layout on editable posts.
46-
* @param {HTMLElement} postElement - The target post element
46+
* @param {HTMLElement} postElement The target post element
4747
* @returns {HTMLDivElement} The inserted element
4848
*/
4949
const addSecondaryFooterRow = postElement => {
@@ -57,9 +57,9 @@ const addSecondaryFooterRow = postElement => {
5757

5858
/**
5959
* Inserts a control button into the post footer.
60-
* @param {HTMLElement} postElement - The target post element
61-
* @param {HTMLDivElement} clonedControlButton - Control button element to insert
62-
* @param {string} buttonClass - Button HTML class
60+
* @param {HTMLElement} postElement The target post element
61+
* @param {HTMLDivElement} clonedControlButton Control button element to insert
62+
* @param {string} buttonClass Button HTML class
6363
* @returns {Promise<void>} Resolves when finished
6464
*/
6565
export const insertControlButton = async (postElement, clonedControlButton, buttonClass) => {

src/utils/crypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const getRandomHexString = () => {
1010
/**
1111
* Get a hexadecimal SHA-256 hash of a given string
1212
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string
13-
* @param {string} data - A USVString containing the data to hash
13+
* @param {string} data A USVString containing the data to hash
1414
* @returns {Promise<string>} Hexadecimal string representing the data's SHA-256 digest
1515
*/
1616
export const sha256 = async data => {

src/utils/css_map.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { inject } from './inject.js';
33
export const cssMap = await inject('/main_world/css_map.js');
44

55
/**
6-
* @param {...string} keys - One or more element source names
6+
* @param {...string} keys One or more element source names
77
* @returns {string[]} An array of generated classnames from the CSS map
88
*/
99
export const keyToClasses = (...keys) => keys.flatMap(key => cssMap[key]).filter(Boolean);
1010

1111
/**
12-
* @param {...string} keys - One or more element source names
13-
* @returns {string} - A CSS :is() selector which targets all elements that match any of the given source names
12+
* @param {...string} keys One or more element source names
13+
* @returns {string} A CSS :is() selector which targets all elements that match any of the given source names
1414
*/
1515
export const keyToCss = function (...keys) {
1616
const classes = keyToClasses(...keys);

src/utils/dom.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
/**
66
* Create elements with simple syntax
7-
* @param {string} tagName - Type of element to create
8-
* @param {Attributes} [attributes] - Property-value pairs to set as HTML/XML attributes (e.g. { href: '/' })
9-
* @param {Events} [events] - Property-value pairs to set as event listeners (e.g. { click: () => {} })
10-
* @param {Children} [children] - Zero or more valid children
7+
* @param {string} tagName Type of element to create
8+
* @param {Attributes} [attributes] Property-value pairs to set as HTML/XML attributes (e.g. { href: '/' })
9+
* @param {Events} [events] Property-value pairs to set as event listeners (e.g. { click: () => {} })
10+
* @param {Children} [children] Zero or more valid children
1111
* @returns {HTMLElement | SVGElement | MathMLElement} Element created to specification
1212
*/
1313
export function dom (tagName, attributes = {}, events = {}, children = []) {

src/utils/inject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* This permits access to variables exposed by the Tumblr web platform that are normally inaccessible
44
* in the content script sandbox.
55
* See the src/main_world directory and [../main_world/index.js](../main_world/index.js).
6-
* @param {string} path - Absolute path of script to inject (will be fed to `runtime.getURL()`)
7-
* @param {Array} [args] - Array of arguments to pass to the script
8-
* @param {Element} [target] - Target element; will be accessible as the `this` value in the injected function.
6+
* @param {string} path Absolute path of script to inject (will be fed to `runtime.getURL()`)
7+
* @param {Array} [args] Array of arguments to pass to the script
8+
* @param {Element} [target] Target element; will be accessible as the `this` value in the injected function.
99
* @returns {Promise<any>} The transmitted result of the script
1010
*/
1111
export const inject = (path, args = [], target = document.documentElement) =>

src/utils/interface.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ export const getPopoverWrapper = element => {
3737

3838
/**
3939
* @typedef {object} PostFilterOptions
40-
* @property {string} [excludeClass] - Classname to exclude and add
41-
* @property {Function|Function[]} [timeline] - Filter results to matching timeline element children
42-
* @property {boolean} [noBlogView] - Whether to exclude posts in the blog view modal
43-
* @property {boolean} [includeFiltered] - Whether to include filtered posts
40+
* @property {string} [excludeClass] Classname to exclude and add
41+
* @property {Function|Function[]} [timeline] Filter results to matching timeline element children
42+
* @property {boolean} [noBlogView] Whether to exclude posts in the blog view modal
43+
* @property {boolean} [includeFiltered] Whether to include filtered posts
4444
*/
4545

4646
/**
47-
* @param {Element[]} postElements - Post elements (or descendants) to filter
48-
* @param {PostFilterOptions} [postFilterOptions] - Post filter options
47+
* @param {Element[]} postElements Post elements (or descendants) to filter
48+
* @param {PostFilterOptions} [postFilterOptions] Post filter options
4949
* @returns {HTMLDivElement[]} Matching post elements
5050
*/
5151
export const filterPostElements = function (postElements, { excludeClass, timeline, noBlogView = false, includeFiltered = false } = {}) {
@@ -82,23 +82,23 @@ export const filterPostElements = function (postElements, { excludeClass, timeli
8282
};
8383

8484
/**
85-
* @param {PostFilterOptions} postFilterOptions - Post filter options
85+
* @param {PostFilterOptions} postFilterOptions Post filter options
8686
* @returns {HTMLDivElement[]} Matching post elements on the page
8787
*/
8888
export const getPostElements = postFilterOptions => filterPostElements([...document.querySelectorAll(postSelector)], postFilterOptions);
8989

9090
/**
91-
* @param {string} [css] - CSS rules to be included
91+
* @param {string} [css] CSS rules to be included
9292
* @returns {HTMLStyleElement} Style element containing the provided CSS
9393
*/
9494
export const buildStyle = (css = '') => dom('style', { class: 'xkit' }, null, [css]);
9595

9696
/**
9797
* Determine a post's legacy type
98-
* @param {object} post - Destructured into content and layout
99-
* @param {Array} [post.trail] - Full post trail
100-
* @param {Array} [post.content] - Post content array
101-
* @param {Array} [post.layout] - Post layout array
98+
* @param {object} post Destructured into content and layout
99+
* @param {Array} [post.trail] Full post trail
100+
* @param {Array} [post.content] Post content array
101+
* @param {Array} [post.layout] Post layout array
102102
* @returns {string} The determined legacy type of the post
103103
* @see https://github.com/tumblr/docs/blob/master/npf-spec.md#mapping-npf-post-content-to-legacy-post-types
104104
*/

src/utils/language_data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { inject } from './inject.js';
33
export const languageData = await inject('/main_world/language_data.js');
44

55
/**
6-
* @param {string} rootString - The English string to translate
7-
* @returns {string} - The translated string in the current Tumblr locale
6+
* @param {string} rootString The English string to translate
7+
* @returns {string} The translated string in the current Tumblr locale
88
*/
99
export const translate = rootString => languageData.translations[rootString] || rootString;

src/utils/meatballs.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const meatballItems = {
1515

1616
/**
1717
* Add a custom button to posts' meatball menus.
18-
* @param {object} options - Destructured
19-
* @param {string} options.id - Identifier for this button (must be unique)
20-
* @param {string|Function} options.label - Button text to display. May be a function accepting the timelineObject data of the post element being actioned on.
21-
* @param {Function} options.onclick - Button click listener function
22-
* @param {Function} [options.postFilter] - Filter function, called with the timelineObject data of the post element being actioned on. Must return true for button to be added
18+
* @param {object} options Destructured
19+
* @param {string} options.id Identifier for this button (must be unique)
20+
* @param {string|Function} options.label Button text to display. May be a function accepting the timelineObject data of the post element being actioned on.
21+
* @param {Function} options.onclick Button click listener function
22+
* @param {Function} [options.postFilter] Filter function, called with the timelineObject data of the post element being actioned on. Must return true for button to be added
2323
*/
2424
export const registerMeatballItem = function ({ id, label, onclick, postFilter }) {
2525
meatballItems.post[id] = { label, onclick, filter: postFilter };
@@ -33,11 +33,11 @@ export const unregisterMeatballItem = id => {
3333

3434
/**
3535
* Add a custom button to blogs' meatball menus in blog cards and the blog view header.
36-
* @param {object} options - Destructured
37-
* @param {string} options.id - Identifier for this button (must be unique)
38-
* @param {string|Function} options.label - Button text to display. May be a function accepting the blog data of the post element being actioned on.
39-
* @param {Function} options.onclick - Button click listener function
40-
* @param {Function} [options.blogFilter] - Filter function, called with the blog data of the menu element being actioned on. Must return true for button to be added. Some blog data fields, such as "followed", are not available in blog cards.
36+
* @param {object} options Destructured
37+
* @param {string} options.id Identifier for this button (must be unique)
38+
* @param {string|Function} options.label Button text to display. May be a function accepting the blog data of the post element being actioned on.
39+
* @param {Function} options.onclick Button click listener function
40+
* @param {Function} [options.blogFilter] Filter function, called with the blog data of the menu element being actioned on. Must return true for button to be added. Some blog data fields, such as "followed", are not available in blog cards.
4141
*/
4242
export const registerBlogMeatballItem = function ({ id, label, onclick, blogFilter }) {
4343
meatballItems.blog[id] = { label, onclick, filter: blogFilter };

0 commit comments

Comments
 (0)