From 412989e6affdb58f83bae2064ff9fe48004cd136 Mon Sep 17 00:00:00 2001 From: Nicolas Cantu Date: Tue, 6 Jan 2026 11:30:23 +0100 Subject: [PATCH] lint fix wip --- components/AlbyInstaller.tsx | 14 +++--- components/ArticleCard.tsx | 6 +-- components/ArticleEditor.tsx | 8 ++-- components/ArticleEditorForm.tsx | 20 ++++----- components/ArticleField.tsx | 6 +-- components/ArticleFilters.tsx | 10 ++--- components/ArticleFormButtons.tsx | 2 +- components/ArticlePreview.tsx | 2 +- components/ArticleReviews.tsx | 8 ++-- components/ArticlesList.tsx | 8 ++-- components/AuthorCard.tsx | 2 +- components/AuthorFilter.tsx | 6 +-- components/AuthorFilterButton.tsx | 10 ++--- components/AuthorFilterDropdown.tsx | 10 ++--- components/AuthorFilterHooks.tsx | 24 ++++++++--- components/AuthorPresentationEditor.tsx | 13 +++--- components/AuthorsList.tsx | 8 ++-- components/CategorySelect.tsx | 2 +- components/CategoryTabs.tsx | 2 +- components/ClearButton.tsx | 2 +- components/ConditionalPublishButton.tsx | 4 +- components/ConnectButton.tsx | 4 +- components/ConnectedUserMenu.tsx | 2 +- components/CreateAccountModal.tsx | 2 +- components/CreateAccountModalComponents.tsx | 10 ++--- components/CreateAccountModalSteps.tsx | 8 ++-- components/DocsContent.tsx | 2 +- components/DocsSidebar.tsx | 2 +- components/Footer.tsx | 2 +- components/FundingGauge.tsx | 8 ++-- components/Nip95ConfigManager.tsx | 3 +- components/NotificationPanelHeader.tsx | 2 +- components/PageHeader.tsx | 4 +- components/PaymentModal.tsx | 31 ++++++++------ components/SearchBar.tsx | 6 +-- components/UserArticlesList.tsx | 4 +- eslint.config.mjs | 21 +++++++-- hooks/useArticleEditing.ts | 18 ++++++-- hooks/useArticlePayment.ts | 17 +++++--- hooks/useArticlePublishing.ts | 8 +++- hooks/useArticles.ts | 14 ++++-- hooks/useAuthorPresentation.ts | 11 ++++- hooks/useAuthorsProfiles.ts | 2 +- hooks/useDocs.ts | 11 +++-- hooks/useI18n.ts | 8 +++- hooks/useNostrAuth.ts | 13 ++++-- hooks/useNotifications.ts | 23 ++++++---- hooks/useUserArticles.ts | 14 ++++-- lib/articleMutations.ts | 8 ++-- lib/articlePublisher.ts | 7 ++- lib/articlePublisherHelpersPresentation.ts | 4 +- lib/configStorage.ts | 4 +- lib/keyManagement.ts | 4 +- lib/keyManagementStorage.ts | 2 +- lib/keyManagementTwoLevel.ts | 16 +++---- lib/mempoolSpace.ts | 6 +-- lib/mempoolSpaceVerification.ts | 2 +- lib/metadataExtractor.ts | 46 ++++++++++---------- lib/nip95.ts | 2 +- lib/nip98.ts | 6 +-- lib/nostr.ts | 4 +- lib/nostrEventParsing.ts | 16 +++---- lib/nostrPrivateMessages.ts | 2 +- lib/nostrRemoteSigner.ts | 2 +- lib/nostrTagSystemBuild.ts | 8 ++-- lib/notifications.ts | 2 +- lib/objectCache.ts | 4 +- lib/paymentPollingCore.ts | 2 +- lib/paymentPollingTracking.ts | 4 +- lib/platformTracking.ts | 2 +- lib/presentationParsing.ts | 2 +- lib/reviewRewardTransfer.ts | 2 +- lib/sponsoring.ts | 2 +- lib/sponsoringTracking.ts | 3 +- lib/storage/indexedDB.ts | 8 ++-- lib/urlGenerator.ts | 2 +- lib/userConfirm.ts | 9 ++++ pages/api/nip95-upload.ts | 10 ++--- pages/author/[pubkey].tsx | 25 +++++++---- pages/docs.tsx | 2 +- pages/index.tsx | 47 +++++++++++++++++---- pages/legal.tsx | 18 ++++---- pages/presentation.tsx | 8 ++-- pages/privacy.tsx | 26 ++++++------ pages/profile.tsx | 29 ++++++++++--- pages/publish.tsx | 10 ++--- pages/series/[id].tsx | 16 ++++--- pages/settings.tsx | 2 +- pages/terms.tsx | 24 +++++------ scripts/lint.js | 17 ++++++-- types/nostr-tools-extended.ts | 2 +- 91 files changed, 506 insertions(+), 328 deletions(-) create mode 100644 lib/userConfirm.ts diff --git a/components/AlbyInstaller.tsx b/components/AlbyInstaller.tsx index ec79d2b..a425df5 100644 --- a/components/AlbyInstaller.tsx +++ b/components/AlbyInstaller.tsx @@ -5,7 +5,7 @@ interface AlbyInstallerProps { onInstalled?: () => void } -function InfoIcon() { +function InfoIcon(): JSX.Element { return ( void } -function InstallerActions({ onInstalled, markInstalled }: InstallerActionsProps) { +function InstallerActions({ onInstalled, markInstalled }: InstallerActionsProps): JSX.Element { const connect = useCallback(() => { const alby = getAlbyService() void alby.enable().then(() => { @@ -60,7 +60,7 @@ function InstallerActions({ onInstalled, markInstalled }: InstallerActionsProps) ) } -function InstallerBody({ onInstalled, markInstalled }: InstallerActionsProps) { +function InstallerBody({ onInstalled, markInstalled }: InstallerActionsProps): JSX.Element { return (

Alby Extension Required

@@ -78,12 +78,12 @@ function InstallerBody({ onInstalled, markInstalled }: InstallerActionsProps) { ) } -function useAlbyStatus(onInstalled?: () => void) { +function useAlbyStatus(onInstalled?: () => void): { isInstalled: boolean; isChecking: boolean; markInstalled: () => void } { const [isInstalled, setIsInstalled] = useState(false) const [isChecking, setIsChecking] = useState(true) useEffect(() => { - const checkAlby = () => { + const checkAlby = (): void => { try { const alby = getAlbyService() const installed = alby.isEnabled() @@ -101,14 +101,14 @@ function useAlbyStatus(onInstalled?: () => void) { checkAlby() }, [onInstalled]) - const markInstalled = () => { + const markInstalled = (): void => { setIsInstalled(true) } return { isInstalled, isChecking, markInstalled } } -export function AlbyInstaller({ onInstalled }: AlbyInstallerProps) { +export function AlbyInstaller({ onInstalled }: AlbyInstallerProps): JSX.Element | null { const { isInstalled, isChecking, markInstalled } = useAlbyStatus(onInstalled) if (isChecking || isInstalled) { diff --git a/components/ArticleCard.tsx b/components/ArticleCard.tsx index 182b1fe..31de68e 100644 --- a/components/ArticleCard.tsx +++ b/components/ArticleCard.tsx @@ -11,7 +11,7 @@ interface ArticleCardProps { onUnlock?: (article: Article) => void } -function ArticleHeader({ article }: { article: Article }) { +function ArticleHeader({ article }: { article: Article }): JSX.Element { return (

{article.title}

@@ -37,7 +37,7 @@ function ArticleMeta({ paymentInvoice: ReturnType['paymentInvoice'] onClose: () => void onPaymentComplete: () => void -}) { +}): JSX.Element { return ( <> {error &&

{error}

} @@ -55,7 +55,7 @@ function ArticleMeta({ ) } -export function ArticleCard({ article, onUnlock }: ArticleCardProps) { +export function ArticleCard({ article, onUnlock }: ArticleCardProps): JSX.Element { const { pubkey, connect } = useNostrAuth() const { loading, diff --git a/components/ArticleEditor.tsx b/components/ArticleEditor.tsx index eee80bb..f50c52f 100644 --- a/components/ArticleEditor.tsx +++ b/components/ArticleEditor.tsx @@ -12,7 +12,7 @@ interface ArticleEditorProps { } -function SuccessMessage() { +function SuccessMessage(): JSX.Element { return (

Article Published!

@@ -21,7 +21,7 @@ function SuccessMessage() { ) } -export function ArticleEditor({ onPublishSuccess, onCancel, seriesOptions, onSelectSeries }: ArticleEditorProps) { +export function ArticleEditor({ onPublishSuccess, onCancel, seriesOptions, onSelectSeries }: ArticleEditorProps): JSX.Element { const { connected, pubkey, connect } = useNostrAuth() const { loading, error, success, publishArticle } = useArticlePublishing(pubkey ?? null) const [draft, setDraft] = useState({ @@ -61,8 +61,8 @@ function buildSubmitHandler( onPublishSuccess?: (articleId: string) => void, connect?: () => Promise, connected?: boolean -) { - return async () => { +): () => Promise { + return async (): Promise => { if (!connected && connect) { await connect() return diff --git a/components/ArticleEditorForm.tsx b/components/ArticleEditorForm.tsx index 14d5386..d3ec9b1 100644 --- a/components/ArticleEditorForm.tsx +++ b/components/ArticleEditorForm.tsx @@ -25,7 +25,7 @@ function CategoryField({ }: { value: ArticleDraft['category'] onChange: (value: import('@/types/nostr').ArticleCategory | undefined) => void -}) { +}): JSX.Element { return ( void seriesOptions?: { id: string; title: string }[] | undefined onSelectSeries?: ((seriesId: string | undefined) => void) | undefined -}) => ( +}): JSX.Element => (
) -function ArticleTitleField({ draft, onDraftChange }: { draft: ArticleDraft; onDraftChange: (draft: ArticleDraft) => void }) { +function ArticleTitleField({ draft, onDraftChange }: { draft: ArticleDraft; onDraftChange: (draft: ArticleDraft) => void }): JSX.Element { return ( void -}) { +}): JSX.Element { return ( void seriesOptions: { id: string; title: string }[] onSelectSeries?: ((seriesId: string | undefined) => void) | undefined -}) { +}): JSX.Element { const handleChange = buildSeriesChangeHandler(draft, onDraftChange, onSelectSeries) return ( @@ -169,8 +169,8 @@ function buildSeriesChangeHandler( draft: ArticleDraft, onDraftChange: (draft: ArticleDraft) => void, onSelectSeries?: ((seriesId: string | undefined) => void) | undefined -) { - return (e: React.ChangeEvent) => { +): (e: React.ChangeEvent) => void { + return (e: React.ChangeEvent): void => { const value = e.target.value || undefined const nextDraft = { ...draft } if (value) { @@ -189,7 +189,7 @@ const ArticleFieldsRight = ({ }: { draft: ArticleDraft onDraftChange: (draft: ArticleDraft) => void -}) => ( +}): JSX.Element => (
{t('article.editor.content.label')}
@@ -230,7 +230,7 @@ export function ArticleEditorForm({ onCancel, seriesOptions, onSelectSeries, -}: ArticleEditorFormProps) { +}: ArticleEditorFormProps): JSX.Element { return (

{t('article.editor.title')}

diff --git a/components/ArticleField.tsx b/components/ArticleField.tsx index 04ff855..0de08c3 100644 --- a/components/ArticleField.tsx +++ b/components/ArticleField.tsx @@ -30,7 +30,7 @@ function NumberOrTextInput({ min?: number className: string onChange: (value: string | number) => void -}) { +}): JSX.Element { const inputProps = { id, type, @@ -64,7 +64,7 @@ function TextAreaInput({ rows?: number className: string onChange: (value: string | number) => void -}) { +}): JSX.Element { const areaProps = { id, value, @@ -81,7 +81,7 @@ function TextAreaInput({ ) } -export function ArticleField(props: ArticleFieldProps) { +export function ArticleField(props: ArticleFieldProps): JSX.Element { const { id, label, value, onChange, required = false, type = 'text', rows, placeholder, helpText, min } = props const inputClass = diff --git a/components/ArticleFilters.tsx b/components/ArticleFilters.tsx index 143d7f4..43ddfd3 100644 --- a/components/ArticleFilters.tsx +++ b/components/ArticleFilters.tsx @@ -46,8 +46,8 @@ function FiltersGrid({ data: FiltersData filters: ArticleFilters onFiltersChange: (filters: ArticleFilters) => void -}) { - const update = (patch: Partial) => onFiltersChange({ ...filters, ...patch }) +}): JSX.Element { + const update = (patch: Partial): void => onFiltersChange({ ...filters, ...patch }) return (
@@ -63,7 +63,7 @@ function FiltersHeader({ }: { hasActiveFilters: boolean onClear: () => void -}) { +}): JSX.Element { return (

{t('filters.sort')}

@@ -83,7 +83,7 @@ function SortFilter({ }: { value: SortOption onChange: (value: SortOption) => void -}) { +}): JSX.Element { return (