Add eslint-plugin-jsdoc (#24719)
This commit is contained in:
parent
bfeccf6748
commit
f22b4e556c
12 changed files with 100 additions and 54 deletions
|
@ -20,7 +20,7 @@ export const PICTURE_IN_PICTURE_REMOVE = 'PICTURE_IN_PICTURE_REMOVE';
|
|||
* @param {string} accountId
|
||||
* @param {string} playerType
|
||||
* @param {MediaProps} props
|
||||
* @return {object}
|
||||
* @returns {object}
|
||||
*/
|
||||
export const deployPictureInPicture = (statusId, accountId, playerType, props) => {
|
||||
// @ts-expect-error
|
||||
|
|
|
@ -27,7 +27,7 @@ const { messages } = getLocale();
|
|||
|
||||
/**
|
||||
* @param {number} max
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
const randomUpTo = max =>
|
||||
Math.floor(Math.random() * Math.floor(max));
|
||||
|
@ -40,7 +40,7 @@ const randomUpTo = max =>
|
|||
* @param {function(Function, Function): void} [options.fallback]
|
||||
* @param {function(): void} [options.fillGaps]
|
||||
* @param {function(object): boolean} [options.accept]
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) =>
|
||||
connectStream(channelName, params, (dispatch, getState) => {
|
||||
|
@ -132,7 +132,7 @@ const refreshHomeTimelineAndNotification = (dispatch, done) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectUserStream = () =>
|
||||
// @ts-expect-error
|
||||
|
@ -141,7 +141,7 @@ export const connectUserStream = () =>
|
|||
/**
|
||||
* @param {Object} options
|
||||
* @param {boolean} [options.onlyMedia]
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
||||
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
|
||||
|
@ -150,7 +150,7 @@ export const connectCommunityStream = ({ onlyMedia } = {}) =>
|
|||
* @param {Object} options
|
||||
* @param {boolean} [options.onlyMedia]
|
||||
* @param {boolean} [options.onlyRemote]
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) =>
|
||||
connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => fillPublicTimelineGaps({ onlyMedia, onlyRemote }) });
|
||||
|
@ -160,20 +160,20 @@ export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) =>
|
|||
* @param {string} tagName
|
||||
* @param {boolean} onlyLocal
|
||||
* @param {function(object): boolean} accept
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectHashtagStream = (columnId, tagName, onlyLocal, accept) =>
|
||||
connectTimelineStream(`hashtag:${columnId}${onlyLocal ? ':local' : ''}`, `hashtag${onlyLocal ? ':local' : ''}`, { tag: tagName }, { accept });
|
||||
|
||||
/**
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectDirectStream = () =>
|
||||
connectTimelineStream('direct', 'direct');
|
||||
|
||||
/**
|
||||
* @param {string} listId
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
export const connectListStream = 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
|
||||
*
|
||||
* @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({
|
||||
hash,
|
||||
|
|
|
@ -4,7 +4,6 @@ import { FormattedMessage } from 'react-intl';
|
|||
|
||||
/**
|
||||
* Returns custom renderer for one of the common counter types
|
||||
*
|
||||
* @param {"statuses" | "following" | "followers"} counterType
|
||||
* Type of the counter
|
||||
* @param {boolean} isBold Whether display number must be displayed in bold
|
||||
|
|
|
@ -37,7 +37,6 @@ class SilentErrorBoundary extends React.Component {
|
|||
|
||||
/**
|
||||
* Used to render counter of how much people are talking about hashtag
|
||||
*
|
||||
* @type {(displayNumber: JSX.Element, pluralReady: number) => JSX.Element}
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param {ShortNumberProps} param0 Props for the component
|
||||
* @returns {JSX.Element} Rendered number
|
||||
*/
|
||||
|
@ -58,7 +57,6 @@ ShortNumber.propTypes = {
|
|||
|
||||
/**
|
||||
* Renders short number into corresponding localizable react fragment
|
||||
*
|
||||
* @param {ShortNumberCounterProps} param0 Props for the component
|
||||
* @returns {JSX.Element} FormattedMessage ready to be embedded in code
|
||||
*/
|
||||
|
|
|
@ -17,10 +17,10 @@ let sharedConnection;
|
|||
*/
|
||||
|
||||
/**
|
||||
* @typedef StreamEvent
|
||||
* @property {string} event
|
||||
* @property {object} payload
|
||||
*/
|
||||
* @typedef StreamEvent
|
||||
* @property {string} event
|
||||
* @property {object} payload
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Array.<Subscription>}
|
||||
|
@ -126,7 +126,7 @@ const sharedCallbacks = {
|
|||
/**
|
||||
* @param {string} channelName
|
||||
* @param {Object.<string, string>} params
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
const channelNameWithInlineParams = (channelName, params) => {
|
||||
if (Object.keys(params).length === 0) {
|
||||
|
@ -140,7 +140,7 @@ const channelNameWithInlineParams = (channelName, params) => {
|
|||
* @param {string} channelName
|
||||
* @param {Object.<string, string>} params
|
||||
* @param {function(Function, Function): { onConnect: (function(): void), onReceive: (function(StreamEvent): void), onDisconnect: (function(): void) }} callbacks
|
||||
* @return {function(): void}
|
||||
* @returns {function(): void}
|
||||
*/
|
||||
// @ts-expect-error
|
||||
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
||||
|
@ -227,7 +227,7 @@ const handleEventSourceMessage = (e, received) => {
|
|||
* @param {string} accessToken
|
||||
* @param {string} channelName
|
||||
* @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 params = channelName.split('&');
|
||||
|
|
|
@ -4,7 +4,7 @@ import { isMobile } from '../is_mobile';
|
|||
let cachedScrollbarWidth = null;
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
const getActualScrollbarWidth = () => {
|
||||
const outer = document.createElement('div');
|
||||
|
@ -22,7 +22,7 @@ const getActualScrollbarWidth = () => {
|
|||
};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
export const getScrollbarWidth = () => {
|
||||
if (cachedScrollbarWidth !== null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue