From 385eb838932e96f14cb75353c860af2da975a821 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 13 Jul 2023 13:58:47 +0200 Subject: [PATCH] [Glitch] Upgrade to Prettier 3 Port 9094a65fd45f713bc66adf477c674ef7d33803a0 to glitch-soc --- .../glitch/components/animated_number.tsx | 2 +- .../flavours/glitch/components/avatar.tsx | 4 ++-- .../flavours/glitch/components/counters.tsx | 6 +++--- .../flavours/glitch/components/gifv.tsx | 2 +- .../glitch/components/relative_timestamp.tsx | 14 +++++++------- .../flavours/glitch/components/short_number.tsx | 4 ++-- .../glitch/features/emoji/emoji_compressed.d.ts | 4 ++-- .../flavours/glitch/polyfills/base_polyfills.ts | 2 +- app/javascript/flavours/glitch/reducers/index.ts | 2 +- app/javascript/flavours/glitch/reducers/modal.ts | 14 +++++++------- app/javascript/flavours/glitch/scroll.ts | 4 ++-- app/javascript/flavours/glitch/store/index.ts | 2 +- .../glitch/store/middlewares/loading_bar.ts | 2 +- .../flavours/glitch/styles/basics.scss | 16 +++++++++++++--- .../glitch/styles/components/columns.scss | 4 +++- .../glitch/styles/components/compose_form.scss | 4 +++- .../glitch/styles/components/drawer.scss | 6 ++++-- app/javascript/flavours/glitch/utils/numbers.ts | 2 +- 18 files changed, 55 insertions(+), 39 deletions(-) diff --git a/app/javascript/flavours/glitch/components/animated_number.tsx b/app/javascript/flavours/glitch/components/animated_number.tsx index edf232bf14..2beb6efbe4 100644 --- a/app/javascript/flavours/glitch/components/animated_number.tsx +++ b/app/javascript/flavours/glitch/components/animated_number.tsx @@ -33,7 +33,7 @@ export const AnimatedNumber: React.FC = ({ value, obfuscate }) => { const willEnter = useCallback(() => ({ y: -1 * direction }), [direction]); const willLeave = useCallback( () => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), - [direction] + [direction], ); if (reduceMotion) { diff --git a/app/javascript/flavours/glitch/components/avatar.tsx b/app/javascript/flavours/glitch/components/avatar.tsx index 11253a8e94..92d8a135b0 100644 --- a/app/javascript/flavours/glitch/components/avatar.tsx +++ b/app/javascript/flavours/glitch/components/avatar.tsx @@ -33,7 +33,7 @@ export const Avatar: React.FC = ({ if (account) { style.backgroundImage = `url(${account.get( - hovering ? 'avatar' : 'avatar_static' + hovering ? 'avatar' : 'avatar_static', )})`; } @@ -42,7 +42,7 @@ export const Avatar: React.FC = ({ className={classNames( 'account__avatar', { 'account__avatar-inline': inline }, - className + className, )} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} diff --git a/app/javascript/flavours/glitch/components/counters.tsx b/app/javascript/flavours/glitch/components/counters.tsx index e0c818f247..35b0ad8d60 100644 --- a/app/javascript/flavours/glitch/components/counters.tsx +++ b/app/javascript/flavours/glitch/components/counters.tsx @@ -4,7 +4,7 @@ import { FormattedMessage } from 'react-intl'; export const StatusesCounter = ( displayNumber: React.ReactNode, - pluralReady: number + pluralReady: number, ) => ( ( ( = ({ onClick(); } }, - [onClick] + [onClick], ); return ( diff --git a/app/javascript/flavours/glitch/components/relative_timestamp.tsx b/app/javascript/flavours/glitch/components/relative_timestamp.tsx index e4a8437d0e..ac3ab0fb4d 100644 --- a/app/javascript/flavours/glitch/components/relative_timestamp.tsx +++ b/app/javascript/flavours/glitch/components/relative_timestamp.tsx @@ -108,7 +108,7 @@ export const timeAgoString = ( now: number, year: number, timeGiven: boolean, - short?: boolean + short?: boolean, ) => { const delta = now - date.getTime(); @@ -118,28 +118,28 @@ export const timeAgoString = ( relativeTime = intl.formatMessage(messages.today); } else if (delta < 10 * SECOND) { relativeTime = intl.formatMessage( - short ? messages.just_now : messages.just_now_full + short ? messages.just_now : messages.just_now_full, ); } else if (delta < 7 * DAY) { if (delta < MINUTE) { relativeTime = intl.formatMessage( short ? messages.seconds : messages.seconds_full, - { number: Math.floor(delta / SECOND) } + { number: Math.floor(delta / SECOND) }, ); } else if (delta < HOUR) { relativeTime = intl.formatMessage( short ? messages.minutes : messages.minutes_full, - { number: Math.floor(delta / MINUTE) } + { number: Math.floor(delta / MINUTE) }, ); } else if (delta < DAY) { relativeTime = intl.formatMessage( short ? messages.hours : messages.hours_full, - { number: Math.floor(delta / HOUR) } + { number: Math.floor(delta / HOUR) }, ); } else { relativeTime = intl.formatMessage( short ? messages.days : messages.days_full, - { number: Math.floor(delta / DAY) } + { number: Math.floor(delta / DAY) }, ); } } else if (date.getFullYear() === year) { @@ -158,7 +158,7 @@ const timeRemainingString = ( intl: IntlShape, date: Date, now: number, - timeGiven = true + timeGiven = true, ) => { const delta = date.getTime() - now; diff --git a/app/javascript/flavours/glitch/components/short_number.tsx b/app/javascript/flavours/glitch/components/short_number.tsx index 010586c04f..928e371bd8 100644 --- a/app/javascript/flavours/glitch/components/short_number.tsx +++ b/app/javascript/flavours/glitch/components/short_number.tsx @@ -6,7 +6,7 @@ import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers'; type ShortNumberRenderer = ( displayNumber: JSX.Element, - pluralReady: number + pluralReady: number, ) => JSX.Element; interface ShortNumberProps { @@ -25,7 +25,7 @@ export const ShortNumberRenderer: React.FC = ({ if (children && renderer) { console.warn( - 'Both renderer prop and renderer as a child provided. This is a mistake and you really should fix that. Only renderer passed as a child will be used.' + 'Both renderer prop and renderer as a child provided. This is a mistake and you really should fix that. Only renderer passed as a child will be used.', ); } diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.d.ts b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.d.ts index 30c1bf2fb9..2b3375ccc4 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.d.ts +++ b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.d.ts @@ -25,7 +25,7 @@ export type SearchData = [ BaseEmoji['native'], Emoji['short_names'], Search, - Emoji['unified'] + Emoji['unified'], ]; export interface ShortCodesToEmojiData { @@ -38,7 +38,7 @@ export type EmojiCompressed = [ Skins, Category[], Data['aliases'], - EmojisWithoutShortCodes + EmojisWithoutShortCodes, ]; /* diff --git a/app/javascript/flavours/glitch/polyfills/base_polyfills.ts b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts index 3cde1b1ede..c35ba0d382 100644 --- a/app/javascript/flavours/glitch/polyfills/base_polyfills.ts +++ b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts @@ -12,7 +12,7 @@ if (!HTMLCanvasElement.prototype.toBlob) { this: HTMLCanvasElement, callback: BlobCallback, type = 'image/png', - quality: unknown + quality: unknown, ) { const dataURL: string = this.toDataURL(type, quality); let data; diff --git a/app/javascript/flavours/glitch/reducers/index.ts b/app/javascript/flavours/glitch/reducers/index.ts index 0bc2660b06..32694cc23f 100644 --- a/app/javascript/flavours/glitch/reducers/index.ts +++ b/app/javascript/flavours/glitch/reducers/index.ts @@ -105,7 +105,7 @@ const initialRootState = Object.fromEntries( reducer(undefined, { // empty action }), - ]) + ]), ); const RootStateRecord = ImmutableRecord(initialRootState, 'RootState'); diff --git a/app/javascript/flavours/glitch/reducers/modal.ts b/app/javascript/flavours/glitch/reducers/modal.ts index 6afbcc367c..dab1e8301c 100644 --- a/app/javascript/flavours/glitch/reducers/modal.ts +++ b/app/javascript/flavours/glitch/reducers/modal.ts @@ -35,7 +35,7 @@ interface PopModalOption { } const popModal = ( state: State, - { modalType, ignoreFocus }: PopModalOption + { modalType, ignoreFocus }: PopModalOption, ): State => { if ( modalType === undefined || @@ -52,12 +52,12 @@ const popModal = ( const pushModal = ( state: State, modalType: ModalType, - modalProps: ModalProps + modalProps: ModalProps, ): State => { return state.withMutations((record) => { record.set('ignoreFocus', false); record.update('stack', (stack) => - stack.unshift(Modal({ modalType, modalProps })) + stack.unshift(Modal({ modalType, modalProps })), ); }); }; @@ -68,14 +68,14 @@ export function modalReducer( modalType: ModalType; ignoreFocus: boolean; modalProps: Record; - }> + }>, ) { switch (action.type) { case openModal.type: return pushModal( state, action.payload.modalType, - action.payload.modalProps + action.payload.modalProps, ); case closeModal.type: return popModal(state, action.payload); @@ -85,8 +85,8 @@ export function modalReducer( return state.update('stack', (stack) => stack.filterNot( // @ts-expect-error TIMELINE_DELETE action is not typed yet. - (modal) => modal.get('modalProps').statusId === action.id - ) + (modal) => modal.get('modalProps').statusId === action.id, + ), ); default: return state; diff --git a/app/javascript/flavours/glitch/scroll.ts b/app/javascript/flavours/glitch/scroll.ts index 625aab0c04..4188f64753 100644 --- a/app/javascript/flavours/glitch/scroll.ts +++ b/app/javascript/flavours/glitch/scroll.ts @@ -3,12 +3,12 @@ const easingOutQuint = ( t: number, b: number, c: number, - d: number + d: number, ) => c * ((t = t / d - 1) * t * t * t * t + 1) + b; const scroll = ( node: Element, key: 'scrollTop' | 'scrollLeft', - target: number + target: number, ) => { const startTime = Date.now(); const offset = node[key]; diff --git a/app/javascript/flavours/glitch/store/index.ts b/app/javascript/flavours/glitch/store/index.ts index 1ef9cb8184..f748662794 100644 --- a/app/javascript/flavours/glitch/store/index.ts +++ b/app/javascript/flavours/glitch/store/index.ts @@ -30,7 +30,7 @@ export const store = configureStore({ .concat( loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'], - }) + }), ) .concat(errorsMiddleware) .concat(soundsMiddleware()), diff --git a/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts index 0f997fd349..03217b3824 100644 --- a/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts +++ b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts @@ -14,7 +14,7 @@ const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = [ ]; export const loadingBarMiddleware = ( - config: Config = {} + config: Config = {}, ): Middleware, RootState> => { const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; diff --git a/app/javascript/flavours/glitch/styles/basics.scss b/app/javascript/flavours/glitch/styles/basics.scss index 8ea3e78819..69f4b79e10 100644 --- a/app/javascript/flavours/glitch/styles/basics.scss +++ b/app/javascript/flavours/glitch/styles/basics.scss @@ -31,9 +31,19 @@ body { // Droid Sans => Older Androids (<4.0) // Helvetica Neue => Older macOS <10.11 // $font-sans-serif => web-font (Roboto) fallback and newer Androids (>=4.0) - font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', - Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', - $font-sans-serif, sans-serif; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Oxygen, + Ubuntu, + Cantarell, + 'Fira Sans', + 'Droid Sans', + 'Helvetica Neue', + $font-sans-serif, + sans-serif; } &.app-body { diff --git a/app/javascript/flavours/glitch/styles/components/columns.scss b/app/javascript/flavours/glitch/styles/components/columns.scss index a296a31613..2ca456191c 100644 --- a/app/javascript/flavours/glitch/styles/components/columns.scss +++ b/app/javascript/flavours/glitch/styles/components/columns.scss @@ -480,7 +480,9 @@ $ui-header-height: 55px; overflow: hidden; overflow-y: auto; color: $darker-text-color; - transition: max-height 150ms ease-in-out, opacity 300ms linear; + transition: + max-height 150ms ease-in-out, + opacity 300ms linear; opacity: 1; z-index: 1; position: relative; diff --git a/app/javascript/flavours/glitch/styles/components/compose_form.scss b/app/javascript/flavours/glitch/styles/components/compose_form.scss index d7b8281ee4..3b85dfbf15 100644 --- a/app/javascript/flavours/glitch/styles/components/compose_form.scss +++ b/app/javascript/flavours/glitch/styles/components/compose_form.scss @@ -26,7 +26,9 @@ } .no-reduce-motion .spoiler-input { - transition: height 0.4s ease, opacity 0.4s ease; + transition: + height 0.4s ease, + opacity 0.4s ease; } .spoiler-input { diff --git a/app/javascript/flavours/glitch/styles/components/drawer.scss b/app/javascript/flavours/glitch/styles/components/drawer.scss index af637b69be..587b0e28c8 100644 --- a/app/javascript/flavours/glitch/styles/components/drawer.scss +++ b/app/javascript/flavours/glitch/styles/components/drawer.scss @@ -253,14 +253,16 @@ @for $i from 0 through 3 { .mbstobon-#{$i} .drawer__inner__mastodon { @if $i == 3 { - background: url('~flavours/glitch/images/wave-drawer.png') + background: + url('~flavours/glitch/images/wave-drawer.png') no-repeat bottom / 100% auto, lighten($ui-base-color, 13%); } @else { - background: url('~flavours/glitch/images/wave-drawer-glitched.png') + background: + url('~flavours/glitch/images/wave-drawer-glitched.png') no-repeat bottom / 100% diff --git a/app/javascript/flavours/glitch/utils/numbers.ts b/app/javascript/flavours/glitch/utils/numbers.ts index 7dd8edff54..d2c729db75 100644 --- a/app/javascript/flavours/glitch/utils/numbers.ts +++ b/app/javascript/flavours/glitch/utils/numbers.ts @@ -55,7 +55,7 @@ export function toShortNumber(sourceNumber: number): ShortNumber { */ export function pluralReady( sourceNumber: number, - division: DecimalUnits + division: DecimalUnits, ): number { if (division == null || division < DECIMAL_UNITS.HUNDRED) { return sourceNumber;