Add eslint-plugin-jsdoc (#24719)
This commit is contained in:
		
							
								
								
									
										12
									
								
								.eslintrc.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								.eslintrc.js
									
									
									
									
									
								
							@@ -7,6 +7,7 @@ module.exports = {
 | 
			
		||||
    'plugin:jsx-a11y/recommended',
 | 
			
		||||
    'plugin:import/recommended',
 | 
			
		||||
    'plugin:promise/recommended',
 | 
			
		||||
    'plugin:jsdoc/recommended',
 | 
			
		||||
  ],
 | 
			
		||||
 | 
			
		||||
  env: {
 | 
			
		||||
@@ -238,6 +239,14 @@ module.exports = {
 | 
			
		||||
    'formatjs/no-useless-message': 'error',
 | 
			
		||||
    'formatjs/prefer-formatted-message': 'error',
 | 
			
		||||
    'formatjs/prefer-pound-in-plural': 'error',
 | 
			
		||||
 | 
			
		||||
    'jsdoc/check-types': 'off',
 | 
			
		||||
    'jsdoc/no-undefined-types': 'off',
 | 
			
		||||
    'jsdoc/require-jsdoc': 'off',
 | 
			
		||||
    'jsdoc/require-param-description': 'off',
 | 
			
		||||
    'jsdoc/require-property-description': 'off',
 | 
			
		||||
    'jsdoc/require-returns-description': 'off',
 | 
			
		||||
    'jsdoc/require-returns': 'off',
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  overrides: [
 | 
			
		||||
@@ -270,10 +279,13 @@ module.exports = {
 | 
			
		||||
        'plugin:import/recommended',
 | 
			
		||||
        'plugin:import/typescript',
 | 
			
		||||
        'plugin:promise/recommended',
 | 
			
		||||
        'plugin:jsdoc/recommended',
 | 
			
		||||
      ],
 | 
			
		||||
 | 
			
		||||
      rules: {
 | 
			
		||||
        '@typescript-eslint/no-explicit-any': 'off',
 | 
			
		||||
 | 
			
		||||
        'jsdoc/require-jsdoc': 'off',
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -183,6 +183,7 @@
 | 
			
		||||
    "eslint": "^8.38.0",
 | 
			
		||||
    "eslint-plugin-formatjs": "^4.9.0",
 | 
			
		||||
    "eslint-plugin-import": "~2.27.5",
 | 
			
		||||
    "eslint-plugin-jsdoc": "^43.1.1",
 | 
			
		||||
    "eslint-plugin-jsx-a11y": "~6.7.1",
 | 
			
		||||
    "eslint-plugin-promise": "~6.1.1",
 | 
			
		||||
    "eslint-plugin-react": "~7.32.2",
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ const redisUrlToClient = async (defaultConfig, redisUrl) => {
 | 
			
		||||
/**
 | 
			
		||||
 * @param {string} json
 | 
			
		||||
 * @param {any} req
 | 
			
		||||
 * @return {Object.<string, any>|null}
 | 
			
		||||
 * @returns {Object.<string, any>|null}
 | 
			
		||||
 */
 | 
			
		||||
const parseJSON = (json, req) => {
 | 
			
		||||
  try {
 | 
			
		||||
@@ -70,7 +70,7 @@ const parseJSON = (json, req) => {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {Object.<string, any>} env the `process.env` value to read configuration from
 | 
			
		||||
 * @return {Object.<string, any>} the configuration for the PostgreSQL connection
 | 
			
		||||
 * @returns {Object.<string, any>} the configuration for the PostgreSQL connection
 | 
			
		||||
 */
 | 
			
		||||
const pgConfigFromEnv = (env) => {
 | 
			
		||||
  const pgConfigs = {
 | 
			
		||||
@@ -124,7 +124,7 @@ const pgConfigFromEnv = (env) => {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {Object.<string, any>} env the `process.env` value to read configuration from
 | 
			
		||||
 * @return {Object.<string, any>} configuration for the Redis connection
 | 
			
		||||
 * @returns {Object.<string, any>} configuration for the Redis connection
 | 
			
		||||
 */
 | 
			
		||||
const redisConfigFromEnv = (env) => {
 | 
			
		||||
  const redisNamespace = env.REDIS_NAMESPACE || null;
 | 
			
		||||
@@ -171,7 +171,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string[]} channels
 | 
			
		||||
   * @return {function(): void}
 | 
			
		||||
   * @returns {function(): void}
 | 
			
		||||
   */
 | 
			
		||||
  const subscriptionHeartbeat = channels => {
 | 
			
		||||
    const interval = 6 * 60;
 | 
			
		||||
@@ -224,6 +224,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} channel
 | 
			
		||||
   * @param {function(string): void} callback
 | 
			
		||||
   */
 | 
			
		||||
  const unsubscribe = (channel, callback) => {
 | 
			
		||||
    log.silly(`Removing listener for ${channel}`);
 | 
			
		||||
@@ -255,7 +256,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} value
 | 
			
		||||
   * @return {boolean}
 | 
			
		||||
   * @returns {boolean}
 | 
			
		||||
   */
 | 
			
		||||
  const isTruthy = value =>
 | 
			
		||||
    value && !FALSE_VALUES.includes(value);
 | 
			
		||||
@@ -263,7 +264,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {any} res
 | 
			
		||||
   * @param {function(Error=): void}
 | 
			
		||||
   * @param {function(Error=): void} next
 | 
			
		||||
   */
 | 
			
		||||
  const allowCrossDomain = (req, res, next) => {
 | 
			
		||||
    res.header('Access-Control-Allow-Origin', '*');
 | 
			
		||||
@@ -276,7 +277,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {any} res
 | 
			
		||||
   * @param {function(Error=): void}
 | 
			
		||||
   * @param {function(Error=): void} next
 | 
			
		||||
   */
 | 
			
		||||
  const setRequestId = (req, res, next) => {
 | 
			
		||||
    req.requestId = uuid.v4();
 | 
			
		||||
@@ -288,7 +289,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {any} res
 | 
			
		||||
   * @param {function(Error=): void}
 | 
			
		||||
   * @param {function(Error=): void} next
 | 
			
		||||
   */
 | 
			
		||||
  const setRemoteAddress = (req, res, next) => {
 | 
			
		||||
    req.remoteAddress = req.connection.remoteAddress;
 | 
			
		||||
@@ -299,7 +300,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {string[]} necessaryScopes
 | 
			
		||||
   * @return {boolean}
 | 
			
		||||
   * @returns {boolean}
 | 
			
		||||
   */
 | 
			
		||||
  const isInScope = (req, necessaryScopes) =>
 | 
			
		||||
    req.scopes.some(scope => necessaryScopes.includes(scope));
 | 
			
		||||
@@ -307,7 +308,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} token
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @return {Promise.<void>}
 | 
			
		||||
   * @returns {Promise.<void>}
 | 
			
		||||
   */
 | 
			
		||||
  const accountFromToken = (token, req) => new Promise((resolve, reject) => {
 | 
			
		||||
    pgPool.connect((err, client, done) => {
 | 
			
		||||
@@ -345,8 +346,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {boolean=} required
 | 
			
		||||
   * @return {Promise.<void>}
 | 
			
		||||
   * @returns {Promise.<void>}
 | 
			
		||||
   */
 | 
			
		||||
  const accountFromRequest = (req) => new Promise((resolve, reject) => {
 | 
			
		||||
    const authorization = req.headers.authorization;
 | 
			
		||||
@@ -368,7 +368,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   * @returns {string}
 | 
			
		||||
   */
 | 
			
		||||
  const channelNameFromPath = req => {
 | 
			
		||||
    const { path, query } = req;
 | 
			
		||||
@@ -412,7 +412,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {string} channelName
 | 
			
		||||
   * @return {Promise.<void>}
 | 
			
		||||
   * @returns {Promise.<void>}
 | 
			
		||||
   */
 | 
			
		||||
  const checkScopes = (req, channelName) => new Promise((resolve, reject) => {
 | 
			
		||||
    log.silly(req.requestId, `Checking OAuth scopes for ${channelName}`);
 | 
			
		||||
@@ -477,7 +477,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {SystemMessageHandlers} eventHandlers
 | 
			
		||||
   * @return {function(string): void}
 | 
			
		||||
   * @returns {function(string): void}
 | 
			
		||||
   */
 | 
			
		||||
  const createSystemMessageListener = (req, eventHandlers) => {
 | 
			
		||||
    return message => {
 | 
			
		||||
@@ -565,14 +565,14 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {array} arr
 | 
			
		||||
   * @param {number=} shift
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   * @returns {string}
 | 
			
		||||
   */
 | 
			
		||||
  const placeholders = (arr, shift = 0) => arr.map((_, i) => `$${i + 1 + shift}`).join(', ');
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} listId
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @return {Promise.<void>}
 | 
			
		||||
   * @returns {Promise.<void>}
 | 
			
		||||
   */
 | 
			
		||||
  const authorizeListAccess = (listId, req) => new Promise((resolve, reject) => {
 | 
			
		||||
    const { accountId } = req;
 | 
			
		||||
@@ -602,7 +602,7 @@ const startServer = async () => {
 | 
			
		||||
   * @param {function(string, string): void} output
 | 
			
		||||
   * @param {function(string[], function(string): void): void} attachCloseHandler
 | 
			
		||||
   * @param {boolean=} needsFiltering
 | 
			
		||||
   * @return {function(string): void}
 | 
			
		||||
   * @returns {function(string): void}
 | 
			
		||||
   */
 | 
			
		||||
  const streamFrom = (ids, req, output, attachCloseHandler, needsFiltering = false) => {
 | 
			
		||||
    const accountId = req.accountId || req.remoteAddress;
 | 
			
		||||
@@ -765,7 +765,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {any} res
 | 
			
		||||
   * @return {function(string, string): void}
 | 
			
		||||
   * @returns {function(string, string): void}
 | 
			
		||||
   */
 | 
			
		||||
  const streamToHttp = (req, res) => {
 | 
			
		||||
    const accountId = req.accountId || req.remoteAddress;
 | 
			
		||||
@@ -792,7 +792,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {function(): void} [closeHandler]
 | 
			
		||||
   * @return {function(string[]): void}
 | 
			
		||||
   * @returns {function(string[]): void}
 | 
			
		||||
   */
 | 
			
		||||
  const streamHttpEnd = (req, closeHandler = undefined) => (ids) => {
 | 
			
		||||
    req.on('close', () => {
 | 
			
		||||
@@ -810,7 +810,7 @@ const startServer = async () => {
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {any} ws
 | 
			
		||||
   * @param {string[]} streamName
 | 
			
		||||
   * @return {function(string, string): void}
 | 
			
		||||
   * @returns {function(string, string): void}
 | 
			
		||||
   */
 | 
			
		||||
  const streamToWs = (req, ws, streamName) => (event, payload) => {
 | 
			
		||||
    if (ws.readyState !== ws.OPEN) {
 | 
			
		||||
@@ -885,7 +885,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @return {string[]}
 | 
			
		||||
   * @returns {string[]}
 | 
			
		||||
   */
 | 
			
		||||
  const channelsForUserStream = req => {
 | 
			
		||||
    const arr = [`timeline:${req.accountId}`];
 | 
			
		||||
@@ -910,7 +910,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} str
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   * @returns {string}
 | 
			
		||||
   */
 | 
			
		||||
  const foldToASCII = str => {
 | 
			
		||||
    const regex = new RegExp(NON_ASCII_CHARS.split('').join('|'), 'g');
 | 
			
		||||
@@ -923,7 +923,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} str
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   * @returns {string}
 | 
			
		||||
   */
 | 
			
		||||
  const normalizeHashtag = str => {
 | 
			
		||||
    return foldToASCII(str.normalize('NFKC').toLowerCase()).replace(/[^\p{L}\p{N}_\u00b7\u200c]/gu, '');
 | 
			
		||||
@@ -933,7 +933,7 @@ const startServer = async () => {
 | 
			
		||||
   * @param {any} req
 | 
			
		||||
   * @param {string} name
 | 
			
		||||
   * @param {StreamParams} params
 | 
			
		||||
   * @return {Promise.<{ channelIds: string[], options: { needsFiltering: boolean } }>}
 | 
			
		||||
   * @returns {Promise.<{ channelIds: string[], options: { needsFiltering: boolean } }>}
 | 
			
		||||
   */
 | 
			
		||||
  const channelNameToIds = (req, name, params) => new Promise((resolve, reject) => {
 | 
			
		||||
    switch (name) {
 | 
			
		||||
@@ -1041,7 +1041,7 @@ const startServer = async () => {
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string} channelName
 | 
			
		||||
   * @param {StreamParams} params
 | 
			
		||||
   * @return {string[]}
 | 
			
		||||
   * @returns {string[]}
 | 
			
		||||
   */
 | 
			
		||||
  const streamNameFromChannelName = (channelName, params) => {
 | 
			
		||||
    if (channelName === 'list') {
 | 
			
		||||
@@ -1149,7 +1149,7 @@ const startServer = async () => {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param {string|string[]} arrayOrString
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   * @returns {string}
 | 
			
		||||
   */
 | 
			
		||||
  const firstParam = arrayOrString => {
 | 
			
		||||
    if (Array.isArray(arrayOrString)) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								yarn.lock
									
									
									
									
									
								
							@@ -1218,6 +1218,15 @@
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46"
 | 
			
		||||
  integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==
 | 
			
		||||
 | 
			
		||||
"@es-joy/jsdoccomment@~0.37.1":
 | 
			
		||||
  version "0.37.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.37.1.tgz#fa32a41ba12097452693343e09ad4d26d157aedd"
 | 
			
		||||
  integrity sha512-5vxWJ1gEkEF0yRd0O+uK6dHJf7adrxwQSX8PuRiPfFSAbNLnY0ZJfXaZucoz14Jj2N11xn2DnlEPwWRpYpvRjg==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    comment-parser "1.3.1"
 | 
			
		||||
    esquery "^1.5.0"
 | 
			
		||||
    jsdoc-type-pratt-parser "~4.0.0"
 | 
			
		||||
 | 
			
		||||
"@eslint-community/eslint-utils@^4.2.0":
 | 
			
		||||
  version "4.2.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518"
 | 
			
		||||
@@ -2958,6 +2967,11 @@ anymatch@^3.0.3, anymatch@~3.1.1:
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
 | 
			
		||||
  integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==
 | 
			
		||||
 | 
			
		||||
are-docs-informative@^0.0.2:
 | 
			
		||||
  version "0.0.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/are-docs-informative/-/are-docs-informative-0.0.2.tgz#387f0e93f5d45280373d387a59d34c96db321963"
 | 
			
		||||
  integrity sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==
 | 
			
		||||
 | 
			
		||||
are-we-there-yet@^4.0.0:
 | 
			
		||||
  version "4.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-4.0.0.tgz#3ff397dc14f08b52dd8b2a64d3cee154ab8760d2"
 | 
			
		||||
@@ -4013,6 +4027,11 @@ commander@^7.2.0:
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
 | 
			
		||||
  integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
 | 
			
		||||
 | 
			
		||||
comment-parser@1.3.1:
 | 
			
		||||
  version "1.3.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.3.1.tgz#3d7ea3adaf9345594aedee6563f422348f165c1b"
 | 
			
		||||
  integrity sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==
 | 
			
		||||
 | 
			
		||||
common-tags@^1.8.0:
 | 
			
		||||
  version "1.8.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6"
 | 
			
		||||
@@ -5094,6 +5113,20 @@ eslint-plugin-import@~2.27.5:
 | 
			
		||||
    semver "^6.3.0"
 | 
			
		||||
    tsconfig-paths "^3.14.1"
 | 
			
		||||
 | 
			
		||||
eslint-plugin-jsdoc@^43.1.1:
 | 
			
		||||
  version "43.1.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-43.1.1.tgz#fc72ba21597cc99b1a0dc988aebb9bb57d0ec492"
 | 
			
		||||
  integrity sha512-J2kjjsJ5vBXSyNzqJhceeSGTAgVgZHcPSJKo3vD4tNjUdfky98rR2VfZUDsS1GKL6isyVa8GWvr+Az7Vyg2HXA==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    "@es-joy/jsdoccomment" "~0.37.1"
 | 
			
		||||
    are-docs-informative "^0.0.2"
 | 
			
		||||
    comment-parser "1.3.1"
 | 
			
		||||
    debug "^4.3.4"
 | 
			
		||||
    escape-string-regexp "^4.0.0"
 | 
			
		||||
    esquery "^1.5.0"
 | 
			
		||||
    semver "^7.5.0"
 | 
			
		||||
    spdx-expression-parse "^3.0.1"
 | 
			
		||||
 | 
			
		||||
eslint-plugin-jsx-a11y@~6.7.1:
 | 
			
		||||
  version "6.7.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz#fca5e02d115f48c9a597a6894d5bcec2f7a76976"
 | 
			
		||||
@@ -5231,7 +5264,7 @@ esprima@^4.0.0, esprima@^4.0.1:
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
 | 
			
		||||
  integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
 | 
			
		||||
 | 
			
		||||
esquery@^1.4.2:
 | 
			
		||||
esquery@^1.4.2, esquery@^1.5.0:
 | 
			
		||||
  version "1.5.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b"
 | 
			
		||||
  integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==
 | 
			
		||||
@@ -7384,6 +7417,11 @@ js-yaml@^4.1.0:
 | 
			
		||||
  dependencies:
 | 
			
		||||
    argparse "^2.0.1"
 | 
			
		||||
 | 
			
		||||
jsdoc-type-pratt-parser@~4.0.0:
 | 
			
		||||
  version "4.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz#136f0571a99c184d84ec84662c45c29ceff71114"
 | 
			
		||||
  integrity sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==
 | 
			
		||||
 | 
			
		||||
jsdom@^20.0.0:
 | 
			
		||||
  version "20.0.3"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db"
 | 
			
		||||
@@ -10268,7 +10306,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
 | 
			
		||||
  integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
 | 
			
		||||
 | 
			
		||||
semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7:
 | 
			
		||||
semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.0:
 | 
			
		||||
  version "7.5.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.0.tgz#ed8c5dc8efb6c629c88b23d41dc9bf40c1d96cd0"
 | 
			
		||||
  integrity sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==
 | 
			
		||||
@@ -10607,7 +10645,7 @@ spdx-exceptions@^2.1.0:
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d"
 | 
			
		||||
  integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==
 | 
			
		||||
 | 
			
		||||
spdx-expression-parse@^3.0.0:
 | 
			
		||||
spdx-expression-parse@^3.0.0, spdx-expression-parse@^3.0.1:
 | 
			
		||||
  version "3.0.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679"
 | 
			
		||||
  integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user