From a7253075d10ee392fa12c69b0ffccdde6eee4062 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Thu, 13 Jul 2023 11:49:16 +0200 Subject: [PATCH 1/4] Upgrade to `typescript-eslint` v6 (#25904) --- .eslintrc.js | 7 +- app/javascript/mastodon/blurhash.ts | 5 +- .../components/autosuggest_hashtag.tsx | 4 +- app/javascript/mastodon/components/avatar.tsx | 2 +- .../mastodon/components/avatar_overlay.tsx | 4 +- .../mastodon/components/display_name.tsx | 2 +- .../mastodon/components/short_number.tsx | 4 +- .../features/emoji/emoji_compressed.d.ts | 7 +- .../features/emoji/emoji_mart_data_light.ts | 2 +- .../components/column_settings.tsx | 4 +- .../mastodon/locales/global_locale.ts | 12 +- .../mastodon/locales/load_locale.ts | 1 + .../mastodon/polyfills/base_polyfills.ts | 4 +- app/javascript/mastodon/polyfills/index.ts | 2 + app/javascript/mastodon/polyfills/intl.ts | 1 + app/javascript/mastodon/scroll.ts | 18 ++- .../mastodon/store/middlewares/loading_bar.ts | 4 +- .../mastodon/store/middlewares/sounds.ts | 6 +- app/javascript/mastodon/utils/filters.ts | 2 +- app/javascript/mastodon/utils/numbers.ts | 2 +- app/javascript/mastodon/uuid.ts | 3 +- package.json | 4 +- yarn.lock | 140 ++++++++++-------- 23 files changed, 133 insertions(+), 107 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 91dcd8e60..d5f0ae1ac 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -325,8 +325,8 @@ module.exports = { extends: [ 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/strict-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', 'plugin:react/recommended', 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', @@ -338,7 +338,7 @@ module.exports = { ], parserOptions: { - project: './tsconfig.json', + project: true, tsconfigRootDir: __dirname, }, @@ -348,6 +348,7 @@ module.exports = { '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], '@typescript-eslint/consistent-type-exports': 'error', '@typescript-eslint/consistent-type-imports': 'error', + "@typescript-eslint/prefer-nullish-coalescing": ['error', {ignorePrimitives: {boolean: true}}], 'jsdoc/require-jsdoc': 'off', diff --git a/app/javascript/mastodon/blurhash.ts b/app/javascript/mastodon/blurhash.ts index dadf2b7f2..cafe7b12d 100644 --- a/app/javascript/mastodon/blurhash.ts +++ b/app/javascript/mastodon/blurhash.ts @@ -86,10 +86,9 @@ const DIGIT_CHARACTERS = [ export const decode83 = (str: string) => { let value = 0; - let c, digit; + let digit; - for (let i = 0; i < str.length; i++) { - c = str[i]; + for (const c of str) { digit = DIGIT_CHARACTERS.indexOf(c); value = value * 83 + digit; } diff --git a/app/javascript/mastodon/components/autosuggest_hashtag.tsx b/app/javascript/mastodon/components/autosuggest_hashtag.tsx index 59d66ec87..e83d493c2 100644 --- a/app/javascript/mastodon/components/autosuggest_hashtag.tsx +++ b/app/javascript/mastodon/components/autosuggest_hashtag.tsx @@ -6,11 +6,11 @@ interface Props { tag: { name: string; url?: string; - history?: Array<{ + history?: { uses: number; accounts: string; day: string; - }>; + }[]; following?: boolean; type: 'hashtag'; }; diff --git a/app/javascript/mastodon/components/avatar.tsx b/app/javascript/mastodon/components/avatar.tsx index 8e5e165fe..5f9bb390e 100644 --- a/app/javascript/mastodon/components/avatar.tsx +++ b/app/javascript/mastodon/components/avatar.tsx @@ -5,7 +5,7 @@ import type { Account } from '../../types/resources'; import { autoPlayGif } from '../initial_state'; interface Props { - account: Account; + account: Account | undefined; // FIXME: remove `undefined` once we know for sure its always there size: number; style?: React.CSSProperties; inline?: boolean; diff --git a/app/javascript/mastodon/components/avatar_overlay.tsx b/app/javascript/mastodon/components/avatar_overlay.tsx index 602f9b4fa..61de9d0be 100644 --- a/app/javascript/mastodon/components/avatar_overlay.tsx +++ b/app/javascript/mastodon/components/avatar_overlay.tsx @@ -3,8 +3,8 @@ import type { Account } from '../../types/resources'; import { autoPlayGif } from '../initial_state'; interface Props { - account: Account; - friend: Account; + account: Account | undefined; // FIXME: remove `undefined` once we know for sure its always there + friend: Account | undefined; // FIXME: remove `undefined` once we know for sure its always there size?: number; baseSize?: number; overlaySize?: number; diff --git a/app/javascript/mastodon/components/display_name.tsx b/app/javascript/mastodon/components/display_name.tsx index c537cd24c..82a42bb02 100644 --- a/app/javascript/mastodon/components/display_name.tsx +++ b/app/javascript/mastodon/components/display_name.tsx @@ -78,7 +78,7 @@ export class DisplayName extends React.PureComponent { } else if (account) { let acct = account.get('acct'); - if (acct.indexOf('@') === -1 && localDomain) { + if (!acct.includes('@') && localDomain) { acct = `${acct}@${localDomain}`; } diff --git a/app/javascript/mastodon/components/short_number.tsx b/app/javascript/mastodon/components/short_number.tsx index 928e371bd..74c3c5d75 100644 --- a/app/javascript/mastodon/components/short_number.tsx +++ b/app/javascript/mastodon/components/short_number.tsx @@ -29,12 +29,12 @@ export const ShortNumberRenderer: React.FC = ({ ); } - const customRenderer = children || renderer || null; + const customRenderer = children ?? renderer ?? null; const displayNumber = ; return ( - customRenderer?.(displayNumber, pluralReady(value, division)) || + customRenderer?.(displayNumber, pluralReady(value, division)) ?? displayNumber ); }; diff --git a/app/javascript/mastodon/features/emoji/emoji_compressed.d.ts b/app/javascript/mastodon/features/emoji/emoji_compressed.d.ts index 333de7c82..9f0feba06 100644 --- a/app/javascript/mastodon/features/emoji/emoji_compressed.d.ts +++ b/app/javascript/mastodon/features/emoji/emoji_compressed.d.ts @@ -28,9 +28,10 @@ export type SearchData = [ Emoji['unified'], ]; -export interface ShortCodesToEmojiData { - [key: ShortCodesToEmojiDataKey]: [FilenameData, SearchData]; -} +export type ShortCodesToEmojiData = Record< + ShortCodesToEmojiDataKey, + [FilenameData, SearchData] +>; export type EmojisWithoutShortCodes = FilenameData[]; export type EmojiCompressed = [ diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.ts b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.ts index 62cb84baf..142605b4b 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.ts +++ b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.ts @@ -9,7 +9,7 @@ import emojiCompressed from './emoji_compressed'; import { unicodeToUnifiedName } from './unicode_to_unified_name'; type Emojis = { - [key in keyof ShortCodesToEmojiData]: { + [key in NonNullable]: { native: BaseEmoji['native']; search: Search; short_names: Emoji['short_names']; diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx b/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx index 477e94c9c..ca09d46c7 100644 --- a/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx +++ b/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx @@ -18,9 +18,9 @@ export const ColumnSettings: React.FC = () => { const dispatch = useAppDispatch(); const onChange = useCallback( (key: string, checked: boolean) => { - void dispatch(changeSetting(['home', ...key], checked)); + dispatch(changeSetting(['home', ...key], checked)); }, - [dispatch] + [dispatch], ); return ( diff --git a/app/javascript/mastodon/locales/global_locale.ts b/app/javascript/mastodon/locales/global_locale.ts index 01133ca23..2d4329c76 100644 --- a/app/javascript/mastodon/locales/global_locale.ts +++ b/app/javascript/mastodon/locales/global_locale.ts @@ -3,15 +3,19 @@ export interface LocaleData { messages: Record; } -let loadedLocale: LocaleData; +let loadedLocale: LocaleData | undefined; export function setLocale(locale: LocaleData) { loadedLocale = locale; } -export function getLocale() { - if (!loadedLocale && process.env.NODE_ENV === 'development') { - throw new Error('getLocale() called before any locale has been set'); +export function getLocale(): LocaleData { + if (!loadedLocale) { + if (process.env.NODE_ENV === 'development') { + throw new Error('getLocale() called before any locale has been set'); + } else { + return { locale: 'unknown', messages: {} }; + } } return loadedLocale; diff --git a/app/javascript/mastodon/locales/load_locale.ts b/app/javascript/mastodon/locales/load_locale.ts index 8a6912317..d21675b17 100644 --- a/app/javascript/mastodon/locales/load_locale.ts +++ b/app/javascript/mastodon/locales/load_locale.ts @@ -6,6 +6,7 @@ import { isLocaleLoaded, setLocale } from './global_locale'; const localeLoadingSemaphore = new Semaphore(1); export async function loadLocale() { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we want to match empty strings const locale = document.querySelector('html')?.lang || 'en'; // We use a Semaphore here so only one thing can try to load the locales at diff --git a/app/javascript/mastodon/polyfills/base_polyfills.ts b/app/javascript/mastodon/polyfills/base_polyfills.ts index c35ba0d38..71565236c 100644 --- a/app/javascript/mastodon/polyfills/base_polyfills.ts +++ b/app/javascript/mastodon/polyfills/base_polyfills.ts @@ -4,7 +4,7 @@ import 'core-js/features/symbol'; import 'core-js/features/promise/finally'; import { decode as decodeBase64 } from '../utils/base64'; -if (!HTMLCanvasElement.prototype.toBlob) { +if (!Object.hasOwn(HTMLCanvasElement.prototype, 'toBlob')) { const BASE64_MARKER = ';base64,'; Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { @@ -17,7 +17,7 @@ if (!HTMLCanvasElement.prototype.toBlob) { const dataURL: string = this.toDataURL(type, quality); let data; - if (dataURL.indexOf(BASE64_MARKER) >= 0) { + if (dataURL.includes(BASE64_MARKER)) { const [, base64] = dataURL.split(BASE64_MARKER); data = decodeBase64(base64); } else { diff --git a/app/javascript/mastodon/polyfills/index.ts b/app/javascript/mastodon/polyfills/index.ts index b2dbfdac0..e166c09d0 100644 --- a/app/javascript/mastodon/polyfills/index.ts +++ b/app/javascript/mastodon/polyfills/index.ts @@ -24,6 +24,7 @@ export function loadPolyfills() { // Latest version of Firefox and Safari do not have IntersectionObserver. // Edge does not have requestIdleCallback. // This avoids shipping them all the polyfills. + /* eslint-disable @typescript-eslint/no-unnecessary-condition -- those properties might not exist in old browsers, even if they are always here in types */ const needsExtraPolyfills = !( window.AbortController && window.IntersectionObserver && @@ -31,6 +32,7 @@ export function loadPolyfills() { 'isIntersecting' in IntersectionObserverEntry.prototype && window.requestIdleCallback ); + /* eslint-enable @typescript-eslint/no-unnecessary-condition */ return Promise.all([ loadIntlPolyfills(), diff --git a/app/javascript/mastodon/polyfills/intl.ts b/app/javascript/mastodon/polyfills/intl.ts index 4d5ee3ccf..b825da662 100644 --- a/app/javascript/mastodon/polyfills/intl.ts +++ b/app/javascript/mastodon/polyfills/intl.ts @@ -80,6 +80,7 @@ async function loadIntlPluralRulesPolyfills(locale: string) { // } export async function loadIntlPolyfills() { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we want to match empty strings const locale = document.querySelector('html')?.lang || 'en'; // order is important here diff --git a/app/javascript/mastodon/scroll.ts b/app/javascript/mastodon/scroll.ts index 4188f6475..35e13a452 100644 --- a/app/javascript/mastodon/scroll.ts +++ b/app/javascript/mastodon/scroll.ts @@ -38,11 +38,13 @@ const scroll = ( const isScrollBehaviorSupported = 'scrollBehavior' in document.documentElement.style; -export const scrollRight = (node: Element, position: number) => - isScrollBehaviorSupported - ? node.scrollTo({ left: position, behavior: 'smooth' }) - : scroll(node, 'scrollLeft', position); -export const scrollTop = (node: Element) => - isScrollBehaviorSupported - ? node.scrollTo({ top: 0, behavior: 'smooth' }) - : scroll(node, 'scrollTop', 0); +export const scrollRight = (node: Element, position: number) => { + if (isScrollBehaviorSupported) + node.scrollTo({ left: position, behavior: 'smooth' }); + else scroll(node, 'scrollLeft', position); +}; + +export const scrollTop = (node: Element) => { + if (isScrollBehaviorSupported) node.scrollTo({ top: 0, behavior: 'smooth' }); + else scroll(node, 'scrollTop', 0); +}; diff --git a/app/javascript/mastodon/store/middlewares/loading_bar.ts b/app/javascript/mastodon/store/middlewares/loading_bar.ts index 03217b382..379b3758a 100644 --- a/app/javascript/mastodon/store/middlewares/loading_bar.ts +++ b/app/javascript/mastodon/store/middlewares/loading_bar.ts @@ -16,7 +16,7 @@ const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = [ export const loadingBarMiddleware = ( config: Config = {}, ): Middleware, RootState> => { - const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; + const promiseTypeSuffixes = config.promiseTypeSuffixes ?? defaultTypeSuffixes; return ({ dispatch }) => (next) => @@ -32,7 +32,7 @@ export const loadingBarMiddleware = ( if (action.type.match(isPending)) { dispatch(showLoading()); } else if ( - action.type.match(isFulfilled) || + action.type.match(isFulfilled) ?? action.type.match(isRejected) ) { dispatch(hideLoading()); diff --git a/app/javascript/mastodon/store/middlewares/sounds.ts b/app/javascript/mastodon/store/middlewares/sounds.ts index 47b9fb8ba..092f403f5 100644 --- a/app/javascript/mastodon/store/middlewares/sounds.ts +++ b/app/javascript/mastodon/store/middlewares/sounds.ts @@ -38,7 +38,7 @@ export const soundsMiddleware = (): Middleware< Record, RootState > => { - const soundCache: { [key: string]: HTMLAudioElement } = {}; + const soundCache: Record = {}; void ready(() => { soundCache.boop = createAudio([ @@ -56,9 +56,9 @@ export const soundsMiddleware = (): Middleware< return () => (next) => (action: AnyAction & { meta?: { sound?: string } }) => { - const sound = action?.meta?.sound; + const sound = action.meta?.sound; - if (sound && soundCache[sound]) { + if (sound && Object.hasOwn(soundCache, sound)) { play(soundCache[sound]); } diff --git a/app/javascript/mastodon/utils/filters.ts b/app/javascript/mastodon/utils/filters.ts index e5c6422e0..d299e80c4 100644 --- a/app/javascript/mastodon/utils/filters.ts +++ b/app/javascript/mastodon/utils/filters.ts @@ -7,7 +7,7 @@ export const toServerSideType = (columnType: string) => { case 'account': return columnType; default: - if (columnType.indexOf('list:') > -1) { + if (columnType.includes('list:')) { return 'home'; } else { return 'public'; // community, account, hashtag diff --git a/app/javascript/mastodon/utils/numbers.ts b/app/javascript/mastodon/utils/numbers.ts index 4b98dfe60..0a73061f6 100644 --- a/app/javascript/mastodon/utils/numbers.ts +++ b/app/javascript/mastodon/utils/numbers.ts @@ -55,7 +55,7 @@ export function toShortNumber(sourceNumber: number): ShortNumber { */ export function pluralReady( sourceNumber: number, - division: DecimalUnits, + division: DecimalUnits | null, ): number { if (division == null || division < DECIMAL_UNITS.HUNDRED) { return sourceNumber; diff --git a/app/javascript/mastodon/uuid.ts b/app/javascript/mastodon/uuid.ts index 0b4d55beb..4d0a8a803 100644 --- a/app/javascript/mastodon/uuid.ts +++ b/app/javascript/mastodon/uuid.ts @@ -4,6 +4,5 @@ export function uuid(a?: string): string { (a as unknown as number) ^ ((Math.random() * 16) >> ((a as unknown as number) / 4)) ).toString(16) - : // eslint-disable-next-line @typescript-eslint/restrict-plus-operands - ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); + : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); } diff --git a/package.json b/package.json index ac2526da2..4f99f25f1 100644 --- a/package.json +++ b/package.json @@ -181,8 +181,8 @@ "@types/uuid": "^9.0.0", "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", - "@typescript-eslint/eslint-plugin": "^5.59.8", - "@typescript-eslint/parser": "^5.59.8", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "babel-jest": "^29.5.0", "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", diff --git a/yarn.lock b/yarn.lock index 5c76aa02a..074d17cdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1245,14 +1245,14 @@ esquery "^1.5.0" jsdoc-type-pratt-parser "~4.0.0" -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.3.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": +"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.5.0": version "4.5.1" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== @@ -2115,7 +2115,7 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.11", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== @@ -2468,59 +2468,63 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.59.8": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz#8d466aa21abea4c3f37129997b198d141f09e76f" - integrity sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg== +"@typescript-eslint/eslint-plugin@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.0.0.tgz#19ff4f1cab8d6f8c2c1825150f7a840bc5d9bdc4" + integrity sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A== dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.59.11" - "@typescript-eslint/type-utils" "5.59.11" - "@typescript-eslint/utils" "5.59.11" + "@eslint-community/regexpp" "^4.5.0" + "@typescript-eslint/scope-manager" "6.0.0" + "@typescript-eslint/type-utils" "6.0.0" + "@typescript-eslint/utils" "6.0.0" + "@typescript-eslint/visitor-keys" "6.0.0" debug "^4.3.4" grapheme-splitter "^1.0.4" - ignore "^5.2.0" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" + semver "^7.5.0" + ts-api-utils "^1.0.1" -"@typescript-eslint/parser@^5.59.8": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.11.tgz#af7d4b7110e3068ce0b97550736de455e4250103" - integrity sha512-s9ZF3M+Nym6CAZEkJJeO2TFHHDsKAM3ecNkLuH4i4s8/RCPnF5JRip2GyviYkeEAcwGMJxkqG9h2dAsnA1nZpA== +"@typescript-eslint/parser@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.0.0.tgz#46b2600fd1f67e62fc00a28093a75f41bf7effc4" + integrity sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg== dependencies: - "@typescript-eslint/scope-manager" "5.59.11" - "@typescript-eslint/types" "5.59.11" - "@typescript-eslint/typescript-estree" "5.59.11" + "@typescript-eslint/scope-manager" "6.0.0" + "@typescript-eslint/types" "6.0.0" + "@typescript-eslint/typescript-estree" "6.0.0" + "@typescript-eslint/visitor-keys" "6.0.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz#5d131a67a19189c42598af9fb2ea1165252001ce" - integrity sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q== +"@typescript-eslint/scope-manager@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz#8ede47a37cb2b7ed82d329000437abd1113b5e11" + integrity sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg== dependencies: - "@typescript-eslint/types" "5.59.11" - "@typescript-eslint/visitor-keys" "5.59.11" + "@typescript-eslint/types" "6.0.0" + "@typescript-eslint/visitor-keys" "6.0.0" -"@typescript-eslint/type-utils@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz#5eb67121808a84cb57d65a15f48f5bdda25f2346" - integrity sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g== +"@typescript-eslint/type-utils@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.0.0.tgz#0478d8a94f05e51da2877cc0500f1b3c27ac7e18" + integrity sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ== dependencies: - "@typescript-eslint/typescript-estree" "5.59.11" - "@typescript-eslint/utils" "5.59.11" + "@typescript-eslint/typescript-estree" "6.0.0" + "@typescript-eslint/utils" "6.0.0" debug "^4.3.4" - tsutils "^3.21.0" + ts-api-utils "^1.0.1" "@typescript-eslint/types@5.59.0": version "5.59.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.0.tgz#3fcdac7dbf923ec5251545acdd9f1d42d7c4fe32" integrity sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA== -"@typescript-eslint/types@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.11.tgz#1a9018fe3c565ba6969561f2a49f330cf1fe8db1" - integrity sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA== +"@typescript-eslint/types@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.0.0.tgz#19795f515f8decbec749c448b0b5fc76d82445a1" + integrity sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg== "@typescript-eslint/typescript-estree@5.59.0": version "5.59.0" @@ -2535,32 +2539,32 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz#b2caaa31725e17c33970c1197bcd54e3c5f42b9f" - integrity sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA== +"@typescript-eslint/typescript-estree@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz#1e09aab7320e404fb9f83027ea568ac24e372f81" + integrity sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ== dependencies: - "@typescript-eslint/types" "5.59.11" - "@typescript-eslint/visitor-keys" "5.59.11" + "@typescript-eslint/types" "6.0.0" + "@typescript-eslint/visitor-keys" "6.0.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" + semver "^7.5.0" + ts-api-utils "^1.0.1" -"@typescript-eslint/utils@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.11.tgz#9dbff49dc80bfdd9289f9f33548f2e8db3c59ba1" - integrity sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg== +"@typescript-eslint/utils@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.0.0.tgz#27a16d0d8f2719274a39417b9782f7daa3802db0" + integrity sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ== dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@types/json-schema" "^7.0.9" + "@eslint-community/eslint-utils" "^4.3.0" + "@types/json-schema" "^7.0.11" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.59.11" - "@typescript-eslint/types" "5.59.11" - "@typescript-eslint/typescript-estree" "5.59.11" + "@typescript-eslint/scope-manager" "6.0.0" + "@typescript-eslint/types" "6.0.0" + "@typescript-eslint/typescript-estree" "6.0.0" eslint-scope "^5.1.1" - semver "^7.3.7" + semver "^7.5.0" "@typescript-eslint/visitor-keys@5.59.0": version "5.59.0" @@ -2570,13 +2574,13 @@ "@typescript-eslint/types" "5.59.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.59.11": - version "5.59.11" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz#dca561ddad169dc27d62396d64f45b2d2c3ecc56" - integrity sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA== +"@typescript-eslint/visitor-keys@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz#0b49026049fbd096d2c00c5e784866bc69532a31" + integrity sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA== dependencies: - "@typescript-eslint/types" "5.59.11" - eslint-visitor-keys "^3.3.0" + "@typescript-eslint/types" "6.0.0" + eslint-visitor-keys "^3.4.1" "@webassemblyjs/ast@1.9.0": version "1.9.0" @@ -10313,6 +10317,13 @@ semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.1: dependencies: lru-cache "^6.0.0" +semver@^7.5.0: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -11404,6 +11415,11 @@ trim-newlines@^4.0.2: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-4.1.1.tgz#28c88deb50ed10c7ba6dc2474421904a00139125" integrity sha512-jRKj0n0jXWo6kh62nA5TEh3+4igKDXLvzBJcPpiizP7oOolUrYIxmVBG9TOtHYFHoddUk6YvAkGeGoSVTXfQXQ== +ts-api-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d" + integrity sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A== + tsconfig-paths@^3.14.1: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" From a4e6ff0d5395632562558caf459c5512c41bac1e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:19:54 +0200 Subject: [PATCH 2/4] Update dependency react-textarea-autosize to v8.5.2 (#25962) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 074d17cdf..e892d3680 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9749,9 +9749,9 @@ react-test-renderer@^18.2.0: scheduler "^0.23.0" react-textarea-autosize@*, react-textarea-autosize@^8.4.1: - version "8.5.0" - resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.5.0.tgz#bb0f7faf9849850f1c20b6e7fac0309d4b92f87b" - integrity sha512-cp488su3U9RygmHmGpJp0KEt0i/+57KCK33XVPH+50swVRBhIZYh0fGduz2YLKXwl9vSKBZ9HUXcg9PQXUXqIw== + version "8.5.2" + resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.5.2.tgz#6421df2b5b50b9ca8c5e96fd31be688ea7fa2f9d" + integrity sha512-uOkyjkEl0ByEK21eCJMHDGBAAd/BoFQBawYK5XItjAmCTeSbjxghd8qnt7nzsLYzidjnoObu6M26xts0YGKsGg== dependencies: "@babel/runtime" "^7.20.13" use-composed-ref "^1.3.0" From ba0649f04222bcec3b216f3ad48cf694cb0adc8c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:20:03 +0200 Subject: [PATCH 3/4] Update dependency postcss to v8.4.25 (#25961) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index e892d3680..8a8cf7e65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9236,9 +9236,9 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0: integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== postcss@^8.2.15, postcss@^8.4.24: - version "8.4.24" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.24.tgz#f714dba9b2284be3cc07dbd2fc57ee4dc972d2df" - integrity sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg== + version "8.4.25" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.25.tgz#4a133f5e379eda7f61e906c3b1aaa9b81292726f" + integrity sha512-7taJ/8t2av0Z+sQEvNzCkpDynl0tX3uJMCODi6nT3PfASC7dYCWV9aQ+uiCf+KBD4SEFcu+GvJdGdwzQ6OSjCw== dependencies: nanoid "^3.3.6" picocolors "^1.0.0" From 5a3f174d561cbdc79a597cd2b9502ed058d372da Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 13 Jul 2023 12:58:56 +0200 Subject: [PATCH 4/4] Fix follow link style in embeds (#25965) --- app/helpers/accounts_helper.rb | 2 +- app/javascript/styles/mastodon/statuses.scss | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/helpers/accounts_helper.rb b/app/helpers/accounts_helper.rb index c82dc492d..6301919a9 100644 --- a/app/helpers/accounts_helper.rb +++ b/app/helpers/accounts_helper.rb @@ -22,7 +22,7 @@ module AccountsHelper def account_action_button(account) return if account.memorial? || account.moved? - link_to ActivityPub::TagManager.instance.url_for(account), class: 'button', target: '_new' do + link_to ActivityPub::TagManager.instance.url_for(account), class: 'button logo-button', target: '_new' do safe_join([logo_as_symbol, t('accounts.follow')]) end end diff --git a/app/javascript/styles/mastodon/statuses.scss b/app/javascript/styles/mastodon/statuses.scss index e093bdf97..b6d4f98cc 100644 --- a/app/javascript/styles/mastodon/statuses.scss +++ b/app/javascript/styles/mastodon/statuses.scss @@ -77,6 +77,18 @@ } } +.button.logo-button svg { + width: 20px; + height: auto; + vertical-align: middle; + margin-inline-end: 5px; + fill: $primary-text-color; + + @media screen and (max-width: $no-gap-breakpoint) { + display: none; + } +} + .embed { .status__content[data-spoiler='folded'] { .e-content {