Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Staab committed Aug 16, 2024
1 parent 6796f1c commit 4cba0d9
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 94 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default [
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{args: "none", destructuredArrayIgnorePattern: "^_d?$"},
{args: "none", destructuredArrayIgnorePattern: "^_d?$", caughtErrors: "none"},
],
},
},
Expand Down
3 changes: 1 addition & 2 deletions src/app/base.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {derived, writable} from "svelte/store"
import {derived} from "svelte/store"
import {memoize, assoc} from "@welshman/lib"
import type {CustomEvent} from "@welshman/util"
import {Repository, createEvent, Relay} from "@welshman/util"
import {withGetter} from "@welshman/store"
import {NetworkContext, Tracker} from "@welshman/net"
import type {ISigner} from "@welshman/signer"
import {Nip46Broker, Nip46Signer, Nip07Signer, Nip01Signer} from "@welshman/signer"
import {synced} from "@lib/util"
import type {Session} from "@app/types"
Expand Down
14 changes: 2 additions & 12 deletions src/app/commands.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import {goto} from "$app/navigation"
import {append, uniqBy, now} from "@welshman/lib"
import {uniqBy, now} from "@welshman/lib"
import {GROUPS, asDecryptedEvent, readList, editList, makeList, createList} from "@welshman/util"
import {pushToast} from "@app/toast"
import {pk, signer, repository, INDEXER_RELAYS} from "@app/base"
import {
splitGroupId,
loadRelay,
loadGroup,
getWriteRelayUrls,
loadRelaySelections,
publish,
ensurePlaintext,
} from "@app/state"
import {getWriteRelayUrls, loadRelaySelections, publish, ensurePlaintext} from "@app/state"

export type ModifyTags = (tags: string[][]) => string[][]

Expand Down
1 change: 0 additions & 1 deletion src/app/components/GroupNote.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import {repository} from "@app/base"
import {deriveProfile, deriveEvent} from "@app/state"
export let event: CustomEvent
Expand Down
2 changes: 0 additions & 2 deletions src/app/components/InfoNostr.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts">
import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import {clip} from "@app/toast"
</script>

<div class="column gap-4">
Expand Down
5 changes: 1 addition & 4 deletions src/app/components/LogIn.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<script lang="ts">
import {nip19} from "nostr-tools"
import {makeSecret, Nip46Broker} from "@welshman/signer"
import Icon from "@lib/components/Icon.svelte"
import Field from "@lib/components/Field.svelte"
import Button from "@lib/components/Button.svelte"
import Spinner from "@lib/components/Spinner.svelte"
import CardButton from "@lib/components/CardButton.svelte"
import InfoNostr from "@app/components/LogIn.svelte"
import {pushModal, clearModal} from "@app/modal"
import {pushToast} from "@app/toast"
Expand All @@ -17,7 +15,6 @@
const tryLogin = async () => {
const secret = makeSecret()
const handle = await loadHandle(`${username}@${handler.domain}`)
console.log(handle)
if (!handle?.pubkey) {
return pushToast({
Expand All @@ -26,7 +23,7 @@
})
}
const {pubkey, relays = []} = handle
const {pubkey} = handle
const broker = Nip46Broker.get(pubkey, secret, handler)
if (await broker.connect()) {
Expand Down
14 changes: 1 addition & 13 deletions src/app/components/PrimaryNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,13 @@

<script lang="ts">
import {page} from "$app/stores"
import {goto} from "$app/navigation"
import {derived} from "svelte/store"
import {tweened} from "svelte/motion"
import {quintOut} from "svelte/easing"
import {identity, nth} from "@welshman/lib"
import Icon from "@lib/components/Icon.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import PrimaryNavItem from "@lib/components/PrimaryNavItem.svelte"
import SpaceAdd from "@app/components/SpaceAdd.svelte"
import {session} from "@app/base"
import {
userProfile,
userGroupsByNom,
makeGroupId,
loadGroup,
deriveProfile,
qualifiedGroupsById,
splitGroupId,
} from "@app/state"
import {userProfile, userGroupsByNom} from "@app/state"
import {pushModal} from "@app/modal"
import {getPrimaryNavItemIndex} from "@app/routes"
Expand Down
9 changes: 1 addition & 8 deletions src/app/components/SpaceExit.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<script lang="ts">
import {goto} from "$app/navigation"
import {append, uniqBy} from "@welshman/lib"
import {GROUPS} from "@welshman/util"
import CardButton from "@lib/components/CardButton.svelte"
import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte"
import Icon from "@lib/components/Icon.svelte"
import SpaceCreateFinish from "@app/components/SpaceCreateFinish.svelte"
import {pushModal} from "@app/modal"
import {pushToast} from "@app/toast"
import {GROUP_DELIMITER, splitGroupId, loadRelay, loadGroup, deriveGroup} from "@app/state"
import {deriveGroup} from "@app/state"
import {removeGroupMemberships} from "@app/commands"
export let nom
Expand Down
6 changes: 1 addition & 5 deletions src/app/components/SpaceJoin.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<script lang="ts">
import {goto} from "$app/navigation"
import {append, uniqBy} from "@welshman/lib"
import {GROUPS} from "@welshman/util"
import CardButton from "@lib/components/CardButton.svelte"
import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte"
import Icon from "@lib/components/Icon.svelte"
import SpaceCreateFinish from "@app/components/SpaceCreateFinish.svelte"
import {pushModal} from "@app/modal"
import {pushToast} from "@app/toast"
import {GROUP_DELIMITER, splitGroupId, loadRelay, loadGroup} from "@app/state"
import {splitGroupId, loadRelay, loadGroup} from "@app/state"
import {addGroupMemberships} from "@app/commands"
const back = () => history.back()
Expand Down
28 changes: 4 additions & 24 deletions src/app/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {get, writable, readable, derived} from "svelte/store"
import type {Maybe} from "@welshman/lib"
import {
max,
uniq,
between,
uniqBy,
groupBy,
Expand All @@ -21,9 +20,7 @@ import {
getIdFilters,
getIdentifier,
getRelayTags,
getRelayTagValues,
normalizeRelayUrl,
getPubkeyTagValues,
GROUP_META,
PROFILE,
RELAYS,
Expand All @@ -34,34 +31,17 @@ import {
readProfile,
readList,
asDecryptedEvent,
editList,
makeList,
createList,
GROUP_JOIN,
GROUP_ADD_USER,
} from "@welshman/util"
import type {
Filter,
SignedEvent,
CustomEvent,
PublishedProfile,
PublishedList,
} from "@welshman/util"
import type {SignedEvent, CustomEvent, PublishedProfile, PublishedList} from "@welshman/util"
import type {SubscribeRequest, PublishRequest} from "@welshman/net"
import {publish as basePublish, subscribe} from "@welshman/net"
import {decrypt} from "@welshman/signer"
import {deriveEvents, deriveEventsMapped, getter, withGetter} from "@welshman/store"
import {parseJson, createSearch} from "@lib/util"
import type {Session, Handle, Relay} from "@app/types"
import {
INDEXER_RELAYS,
DUFFLEPUD_URL,
repository,
pk,
getSession,
getSigner,
signer,
} from "@app/base"
import {createSearch} from "@lib/util"
import type {Handle, Relay} from "@app/types"
import {INDEXER_RELAYS, DUFFLEPUD_URL, repository, pk, getSession, getSigner} from "@app/base"

// Utils

Expand Down
4 changes: 1 addition & 3 deletions src/app/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import type {IDBPDatabase} from "idb"
import {throttle} from "throttle-debounce"
import {writable} from "svelte/store"
import type {Unsubscriber, Writable} from "svelte/store"
import {isNil, randomInt} from "@welshman/lib"
import {randomInt} from "@welshman/lib"
import {withGetter} from "@welshman/store"
import {getJson, setJson} from "@lib/util"
import {pk, sessions, repository} from "@app/base"

export type Item = Record<string, any>

Expand Down
3 changes: 1 addition & 2 deletions src/app/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {verifiedSymbol} from "nostr-tools"
import type {Nip46Handler} from "@welshman/signer"
import type {SignedEvent, TrustedEvent, RelayProfile} from "@welshman/util"
import type {RelayProfile} from "@welshman/util"

export type Session = {
method: string
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</style>

<script lang="ts">
import cx from "classnames"
import {switcher} from "@welshman/lib"
import AddSquare from "@assets/icons/Add Square.svg?dataurl"
import AddCircle from "@assets/icons/Add Circle.svg?dataurl"
Expand Down
2 changes: 0 additions & 2 deletions src/lib/components/ModalBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@

<script lang="ts">
import {onMount} from "svelte"
import {slide} from "svelte/transition"
import {quintOut} from "svelte/easing"
import {tweened} from "svelte/motion"
import {last} from "@welshman/lib"
export let component
export let props = {}
Expand Down
5 changes: 2 additions & 3 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import {onMount} from "svelte"
import {page} from "$app/stores"
import {createEventStore} from "@welshman/store"
import {fly} from "@lib/transition"
import ModalBox from "@lib/components/ModalBox.svelte"
import Toast from "@app/components/Toast.svelte"
import Landing from "@app/components/Landing.svelte"
import PrimaryNav from "@app/components/PrimaryNav.svelte"
import {modals, clearModal} from "@app/modal"
import {theme} from "@app/theme"
import {session, sessions, pk, repository} from "@app/base"
import {plaintext, relays, handles} from "@app/state"
import {session, repository} from "@app/base"
import {relays, handles} from "@app/state"
import {initStorage} from "@app/storage"
let ready: Promise<void>
Expand Down
4 changes: 1 addition & 3 deletions src/routes/discover/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<script lang="ts">
import {onMount} from "svelte"
import Masonry from "svelte-bricks"
import {append, remove} from "@welshman/lib"
import {GROUP_META, displayRelayUrl} from "@welshman/util"
import Icon from "@lib/components/Icon.svelte"
import {makeSpacePath} from "@app/routes"
import {load, relays, groups, searchGroups, relayUrlsByNom, userMembership} from "@app/state"
import {addGroupMemberships} from "@app/commands"
import {load, relays, searchGroups, relayUrlsByNom, userMembership} from "@app/state"
const getRelayUrls = (nom: string): string[] => $relayUrlsByNom.get(nom) || []
Expand Down
2 changes: 0 additions & 2 deletions src/routes/spaces/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import {goto} from "$app/navigation"
import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Page from "@lib/components/Page.svelte"
Expand All @@ -12,7 +11,6 @@
import SpaceExit from "@app/components/SpaceExit.svelte"
import {deriveGroup} from "@app/state"
import {pushModal} from "@app/modal"
import {removeGroupMemberships} from "@app/commands"
export let nom
Expand Down
9 changes: 3 additions & 6 deletions src/routes/spaces/[nom]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script lang="ts">
import {sleep, sortBy} from "@welshman/lib"
import {sortBy} from "@welshman/lib"
import type {CustomEvent} from "@welshman/util"
import {page} from "$app/stores"
import {fly} from "@lib/transition"
import {formatTimestampAsDate} from "@lib/util"
import Spinner from "@lib/components/Spinner.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import GroupNote from "@app/components/GroupNote.svelte"
import {deriveGroup, deriveGroupConversation} from "@app/state"
import {deriveGroupConversation} from "@app/state"
$: group = deriveGroup($page.params.nom)
$: conversation = deriveGroupConversation($page.params.nom)
const assertEvent = (e: any) => e as CustomEvent
Expand All @@ -31,7 +28,7 @@
let previousPubkey
for (const {event} of sortBy(m => m.event.created_at, $conversation?.messages || [])) {
const {id, kind, pubkey, created_at} = event
const {id, pubkey, created_at} = event
const date = formatTimestampAsDate(created_at)
if (date !== previousDate) {
Expand Down

0 comments on commit 4cba0d9

Please sign in to comment.