[Glitch] Add eslint-plugin-jsdoc
Port f22b4e556c
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
09054f5485
commit
51479f5c28
9 changed files with 35 additions and 38 deletions
|
@ -20,7 +20,7 @@ export const PICTURE_IN_PICTURE_REMOVE = 'PICTURE_IN_PICTURE_REMOVE';
|
||||||
* @param {string} accountId
|
* @param {string} accountId
|
||||||
* @param {string} playerType
|
* @param {string} playerType
|
||||||
* @param {MediaProps} props
|
* @param {MediaProps} props
|
||||||
* @return {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
export const deployPictureInPicture = (statusId, accountId, playerType, props) => {
|
export const deployPictureInPicture = (statusId, accountId, playerType, props) => {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
|
|
@ -27,7 +27,7 @@ const { messages } = getLocale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} max
|
* @param {number} max
|
||||||
* @return {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
const randomUpTo = max =>
|
const randomUpTo = max =>
|
||||||
Math.floor(Math.random() * Math.floor(max));
|
Math.floor(Math.random() * Math.floor(max));
|
||||||
|
@ -40,7 +40,7 @@ const randomUpTo = max =>
|
||||||
* @param {function(Function, Function): void} [options.fallback]
|
* @param {function(Function, Function): void} [options.fallback]
|
||||||
* @param {function(): void} [options.fillGaps]
|
* @param {function(): void} [options.fillGaps]
|
||||||
* @param {function(object): boolean} [options.accept]
|
* @param {function(object): boolean} [options.accept]
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) =>
|
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) =>
|
||||||
connectStream(channelName, params, (dispatch, getState) => {
|
connectStream(channelName, params, (dispatch, getState) => {
|
||||||
|
@ -132,7 +132,7 @@ const refreshHomeTimelineAndNotification = (dispatch, done) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectUserStream = () =>
|
export const connectUserStream = () =>
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
@ -141,7 +141,7 @@ export const connectUserStream = () =>
|
||||||
/**
|
/**
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @param {boolean} [options.onlyMedia]
|
* @param {boolean} [options.onlyMedia]
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
||||||
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
|
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
|
||||||
|
@ -151,7 +151,7 @@ export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
||||||
* @param {boolean} [options.onlyMedia]
|
* @param {boolean} [options.onlyMedia]
|
||||||
* @param {boolean} [options.onlyRemote]
|
* @param {boolean} [options.onlyRemote]
|
||||||
* @param {boolean} [options.allowLocalOnly]
|
* @param {boolean} [options.allowLocalOnly]
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectPublicStream = ({ onlyMedia, onlyRemote, allowLocalOnly } = {}) =>
|
export const connectPublicStream = ({ onlyMedia, onlyRemote, allowLocalOnly } = {}) =>
|
||||||
connectTimelineStream(`public${onlyRemote ? ':remote' : (allowLocalOnly ? ':allow_local_only' : '')}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : (allowLocalOnly ? ':allow_local_only' : '')}${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => fillPublicTimelineGaps({ onlyMedia, onlyRemote, allowLocalOnly }) });
|
connectTimelineStream(`public${onlyRemote ? ':remote' : (allowLocalOnly ? ':allow_local_only' : '')}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : (allowLocalOnly ? ':allow_local_only' : '')}${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => fillPublicTimelineGaps({ onlyMedia, onlyRemote, allowLocalOnly }) });
|
||||||
|
@ -161,20 +161,20 @@ export const connectPublicStream = ({ onlyMedia, onlyRemote, allowLocalOnly } =
|
||||||
* @param {string} tagName
|
* @param {string} tagName
|
||||||
* @param {boolean} onlyLocal
|
* @param {boolean} onlyLocal
|
||||||
* @param {function(object): boolean} accept
|
* @param {function(object): boolean} accept
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectHashtagStream = (columnId, tagName, onlyLocal, accept) =>
|
export const connectHashtagStream = (columnId, tagName, onlyLocal, accept) =>
|
||||||
connectTimelineStream(`hashtag:${columnId}${onlyLocal ? ':local' : ''}`, `hashtag${onlyLocal ? ':local' : ''}`, { tag: tagName }, { accept });
|
connectTimelineStream(`hashtag:${columnId}${onlyLocal ? ':local' : ''}`, `hashtag${onlyLocal ? ':local' : ''}`, { tag: tagName }, { accept });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectDirectStream = () =>
|
export const connectDirectStream = () =>
|
||||||
connectTimelineStream('direct', 'direct');
|
connectTimelineStream('direct', 'direct');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} listId
|
* @param {string} listId
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
export const connectListStream = listId =>
|
export const connectListStream = listId =>
|
||||||
connectTimelineStream(`list:${listId}`, 'list', { list: listId }, { fillGaps: () => fillListTimelineGaps(listId) });
|
connectTimelineStream(`list:${listId}`, 'list', { list: listId }, { fillGaps: () => fillListTimelineGaps(listId) });
|
||||||
|
|
|
@ -20,9 +20,8 @@ import PropTypes from 'prop-types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that is used to render blurred of blurhash string
|
* Component that is used to render blurred of blurhash string
|
||||||
*
|
|
||||||
* @param {BlurhashProps} param1 Props of the component
|
* @param {BlurhashProps} param1 Props of the component
|
||||||
* @returns Canvas which will render blurred region element to embed
|
* @returns {JSX.Element} Canvas which will render blurred region element to embed
|
||||||
*/
|
*/
|
||||||
function Blurhash({
|
function Blurhash({
|
||||||
hash,
|
hash,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns custom renderer for one of the common counter types
|
* Returns custom renderer for one of the common counter types
|
||||||
*
|
|
||||||
* @param {"statuses" | "following" | "followers"} counterType
|
* @param {"statuses" | "following" | "followers"} counterType
|
||||||
* Type of the counter
|
* Type of the counter
|
||||||
* @param {boolean} isBold Whether display number must be displayed in bold
|
* @param {boolean} isBold Whether display number must be displayed in bold
|
||||||
|
|
|
@ -35,7 +35,6 @@ class SilentErrorBoundary extends React.Component {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to render counter of how much people are talking about hashtag
|
* Used to render counter of how much people are talking about hashtag
|
||||||
*
|
|
||||||
* @type {(displayNumber: JSX.Element, pluralReady: number) => JSX.Element}
|
* @type {(displayNumber: JSX.Element, pluralReady: number) => JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const accountsCountRenderer = (displayNumber, pluralReady) => (
|
export const accountsCountRenderer = (displayNumber, pluralReady) => (
|
||||||
|
|
|
@ -24,7 +24,6 @@ import { FormattedMessage, FormattedNumber } from 'react-intl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that renders short big number to a shorter version
|
* Component that renders short big number to a shorter version
|
||||||
*
|
|
||||||
* @param {ShortNumberProps} param0 Props for the component
|
* @param {ShortNumberProps} param0 Props for the component
|
||||||
* @returns {JSX.Element} Rendered number
|
* @returns {JSX.Element} Rendered number
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +57,6 @@ ShortNumber.propTypes = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders short number into corresponding localizable react fragment
|
* Renders short number into corresponding localizable react fragment
|
||||||
*
|
|
||||||
* @param {ShortNumberCounterProps} param0 Props for the component
|
* @param {ShortNumberCounterProps} param0 Props for the component
|
||||||
* @returns {JSX.Element} FormattedMessage ready to be embedded in code
|
* @returns {JSX.Element} FormattedMessage ready to be embedded in code
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -125,9 +125,15 @@ const mapStateToProps = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
/** Set options in the redux store */
|
/**
|
||||||
|
* Set options in the redux store
|
||||||
|
* @param opts
|
||||||
|
*/
|
||||||
setOpt: (opts) => dispatch(doodleSet(opts)),
|
setOpt: (opts) => dispatch(doodleSet(opts)),
|
||||||
/** Submit doodle for upload */
|
/**
|
||||||
|
* Submit doodle for upload
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
submit: (file) => dispatch(uploadCompose([file])),
|
submit: (file) => dispatch(uploadCompose([file])),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -230,7 +236,10 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
/** Key up handler */
|
/**
|
||||||
|
* Key up handler
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
handleKeyUp = (e) => {
|
handleKeyUp = (e) => {
|
||||||
if (e.target.nodeName === 'INPUT') return;
|
if (e.target.nodeName === 'INPUT') return;
|
||||||
|
|
||||||
|
@ -256,7 +265,10 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Key down handler */
|
/**
|
||||||
|
* Key down handler
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
handleKeyDown = (e) => {
|
handleKeyDown = (e) => {
|
||||||
if (e.key === 'Control' || e.key === 'Meta') {
|
if (e.key === 'Control' || e.key === 'Meta') {
|
||||||
this.controlHeld = true;
|
this.controlHeld = true;
|
||||||
|
@ -292,7 +304,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
/**
|
/**
|
||||||
* Set reference to the canvas element.
|
* Set reference to the canvas element.
|
||||||
* This is called during component init
|
* This is called during component init
|
||||||
*
|
|
||||||
* @param elem - canvas element
|
* @param elem - canvas element
|
||||||
*/
|
*/
|
||||||
setCanvasRef = (elem) => {
|
setCanvasRef = (elem) => {
|
||||||
|
@ -334,7 +345,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the sketcher instance
|
* Set up the sketcher instance
|
||||||
*
|
|
||||||
* @param canvas - canvas element. Null if we're just resizing
|
* @param canvas - canvas element. Null if we're just resizing
|
||||||
*/
|
*/
|
||||||
initSketcher (canvas = null) {
|
initSketcher (canvas = null) {
|
||||||
|
@ -433,7 +443,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
/**
|
/**
|
||||||
* Palette left click.
|
* Palette left click.
|
||||||
* Selects Fg color (or Bg, if Control/Meta is held)
|
* Selects Fg color (or Bg, if Control/Meta is held)
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
onPaletteClick = (e) => {
|
onPaletteClick = (e) => {
|
||||||
|
@ -452,7 +461,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
/**
|
/**
|
||||||
* Palette right click.
|
* Palette right click.
|
||||||
* Selects Bg color
|
* Selects Bg color
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
onPaletteRClick = (e) => {
|
onPaletteRClick = (e) => {
|
||||||
|
@ -463,7 +471,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click on the Draw mode button
|
* Handle click on the Draw mode button
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
setModeDraw = (e) => {
|
setModeDraw = (e) => {
|
||||||
|
@ -473,7 +480,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click on the Fill mode button
|
* Handle click on the Fill mode button
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
setModeFill = (e) => {
|
setModeFill = (e) => {
|
||||||
|
@ -483,7 +489,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click on Smooth checkbox
|
* Handle click on Smooth checkbox
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
tglSmooth = (e) => {
|
tglSmooth = (e) => {
|
||||||
|
@ -493,7 +498,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click on Adaptive checkbox
|
* Handle click on Adaptive checkbox
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
tglAdaptive = (e) => {
|
tglAdaptive = (e) => {
|
||||||
|
@ -503,7 +507,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle change of the Weight input field
|
* Handle change of the Weight input field
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
setWeight = (e) => {
|
setWeight = (e) => {
|
||||||
|
@ -512,7 +515,6 @@ class DoodleModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set size - clalback from the select box
|
* Set size - clalback from the select box
|
||||||
*
|
|
||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
changeSize = (e) => {
|
changeSize = (e) => {
|
||||||
|
|
|
@ -17,10 +17,10 @@ let sharedConnection;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef StreamEvent
|
* @typedef StreamEvent
|
||||||
* @property {string} event
|
* @property {string} event
|
||||||
* @property {object} payload
|
* @property {object} payload
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array.<Subscription>}
|
* @type {Array.<Subscription>}
|
||||||
|
@ -126,7 +126,7 @@ const sharedCallbacks = {
|
||||||
/**
|
/**
|
||||||
* @param {string} channelName
|
* @param {string} channelName
|
||||||
* @param {Object.<string, string>} params
|
* @param {Object.<string, string>} params
|
||||||
* @return {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
const channelNameWithInlineParams = (channelName, params) => {
|
const channelNameWithInlineParams = (channelName, params) => {
|
||||||
if (Object.keys(params).length === 0) {
|
if (Object.keys(params).length === 0) {
|
||||||
|
@ -140,7 +140,7 @@ const channelNameWithInlineParams = (channelName, params) => {
|
||||||
* @param {string} channelName
|
* @param {string} channelName
|
||||||
* @param {Object.<string, string>} params
|
* @param {Object.<string, string>} params
|
||||||
* @param {function(Function, Function): { onConnect: (function(): void), onReceive: (function(StreamEvent): void), onDisconnect: (function(): void) }} callbacks
|
* @param {function(Function, Function): { onConnect: (function(): void), onReceive: (function(StreamEvent): void), onDisconnect: (function(): void) }} callbacks
|
||||||
* @return {function(): void}
|
* @returns {function(): void}
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
||||||
|
@ -227,7 +227,7 @@ const handleEventSourceMessage = (e, received) => {
|
||||||
* @param {string} accessToken
|
* @param {string} accessToken
|
||||||
* @param {string} channelName
|
* @param {string} channelName
|
||||||
* @param {{ connected: Function, received: function(StreamEvent): void, disconnected: Function, reconnected: Function }} callbacks
|
* @param {{ connected: Function, received: function(StreamEvent): void, disconnected: Function, reconnected: Function }} callbacks
|
||||||
* @return {WebSocketClient | EventSource}
|
* @returns {WebSocketClient | EventSource}
|
||||||
*/
|
*/
|
||||||
const createConnection = (streamingAPIBaseURL, accessToken, channelName, { connected, received, disconnected, reconnected }) => {
|
const createConnection = (streamingAPIBaseURL, accessToken, channelName, { connected, received, disconnected, reconnected }) => {
|
||||||
const params = channelName.split('&');
|
const params = channelName.split('&');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
let cachedScrollbarWidth = null;
|
let cachedScrollbarWidth = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
const getActualScrollbarWidth = () => {
|
const getActualScrollbarWidth = () => {
|
||||||
const outer = document.createElement('div');
|
const outer = document.createElement('div');
|
||||||
|
@ -20,7 +20,7 @@ const getActualScrollbarWidth = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export const getScrollbarWidth = () => {
|
export const getScrollbarWidth = () => {
|
||||||
if (cachedScrollbarWidth !== null) {
|
if (cachedScrollbarWidth !== null) {
|
||||||
|
|
Loading…
Reference in a new issue