[Glitch] Add eslint-plugin-jsdoc

Port f22b4e556c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
local
Nick Schonning 1 year ago committed by Claire
parent 09054f5485
commit 51479f5c28
  1. 2
      app/javascript/flavours/glitch/actions/picture_in_picture.js
  2. 16
      app/javascript/flavours/glitch/actions/streaming.js
  3. 3
      app/javascript/flavours/glitch/components/blurhash.jsx
  4. 1
      app/javascript/flavours/glitch/components/common_counter.jsx
  5. 1
      app/javascript/flavours/glitch/components/hashtag.jsx
  6. 2
      app/javascript/flavours/glitch/components/short_number.jsx
  7. 30
      app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx
  8. 14
      app/javascript/flavours/glitch/stream.js
  9. 4
      app/javascript/flavours/glitch/utils/scrollbar.js

@ -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 })) });
@ -151,7 +151,7 @@ export const connectCommunityStream = ({ onlyMedia } = {}) =>
* @param {boolean} [options.onlyMedia]
* @param {boolean} [options.onlyRemote]
* @param {boolean} [options.allowLocalOnly]
* @return {function(): void}
* @returns {function(): void}
*/
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 }) });
@ -161,20 +161,20 @@ export const connectPublicStream = ({ onlyMedia, onlyRemote, allowLocalOnly } =
* @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

@ -35,7 +35,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
*/

@ -125,9 +125,15 @@ const mapStateToProps = state => ({
});
const mapDispatchToProps = dispatch => ({
/** Set options in the redux store */
/**
* Set options in the redux store
* @param opts
*/
setOpt: (opts) => dispatch(doodleSet(opts)),
/** Submit doodle for upload */
/**
* Submit doodle for upload
* @param file
*/
submit: (file) => dispatch(uploadCompose([file])),
});
@ -230,7 +236,10 @@ class DoodleModal extends ImmutablePureComponent {
//endregion
/** Key up handler */
/**
* Key up handler
* @param e
*/
handleKeyUp = (e) => {
if (e.target.nodeName === 'INPUT') return;
@ -256,7 +265,10 @@ class DoodleModal extends ImmutablePureComponent {
}
};
/** Key down handler */
/**
* Key down handler
* @param e
*/
handleKeyDown = (e) => {
if (e.key === 'Control' || e.key === 'Meta') {
this.controlHeld = true;
@ -292,7 +304,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Set reference to the canvas element.
* This is called during component init
*
* @param elem - canvas element
*/
setCanvasRef = (elem) => {
@ -334,7 +345,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Set up the sketcher instance
*
* @param canvas - canvas element. Null if we're just resizing
*/
initSketcher (canvas = null) {
@ -433,7 +443,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Palette left click.
* Selects Fg color (or Bg, if Control/Meta is held)
*
* @param e - event
*/
onPaletteClick = (e) => {
@ -452,7 +461,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Palette right click.
* Selects Bg color
*
* @param e - event
*/
onPaletteRClick = (e) => {
@ -463,7 +471,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Handle click on the Draw mode button
*
* @param e - event
*/
setModeDraw = (e) => {
@ -473,7 +480,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Handle click on the Fill mode button
*
* @param e - event
*/
setModeFill = (e) => {
@ -483,7 +489,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Handle click on Smooth checkbox
*
* @param e - event
*/
tglSmooth = (e) => {
@ -493,7 +498,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Handle click on Adaptive checkbox
*
* @param e - event
*/
tglAdaptive = (e) => {
@ -503,7 +507,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Handle change of the Weight input field
*
* @param e - event
*/
setWeight = (e) => {
@ -512,7 +515,6 @@ class DoodleModal extends ImmutablePureComponent {
/**
* Set size - clalback from the select box
*
* @param e - event
*/
changeSize = (e) => {

@ -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('&');

@ -2,7 +2,7 @@
let cachedScrollbarWidth = null;
/**
* @return {number}
* @returns {number}
*/
const getActualScrollbarWidth = () => {
const outer = document.createElement('div');
@ -20,7 +20,7 @@ const getActualScrollbarWidth = () => {
};
/**
* @return {number}
* @returns {number}
*/
export const getScrollbarWidth = () => {
if (cachedScrollbarWidth !== null) {

Loading…
Cancel
Save