Lints some errors and warnings (#76)
This commit is contained in:
parent
2fce1637b4
commit
06e41167d0
22 changed files with 62 additions and 38 deletions
|
@ -199,7 +199,9 @@ export function enforceLen(str: string, len: number): string {
|
|||
}
|
||||
|
||||
export function cleanError(str: any): string {
|
||||
if (!str) return str
|
||||
if (!str) {
|
||||
return str
|
||||
}
|
||||
if (typeof str !== 'string') {
|
||||
str = str.toString()
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ export async function post(
|
|||
if (!embed && extLink) {
|
||||
let thumb
|
||||
if (extLink.localThumb) {
|
||||
onStateChange?.(`Uploading link thumbnail...`)
|
||||
onStateChange?.('Uploading link thumbnail...')
|
||||
let encoding
|
||||
if (extLink.localThumb.path.endsWith('.png')) {
|
||||
encoding = 'image/png'
|
||||
|
@ -140,7 +140,7 @@ export async function post(
|
|||
}
|
||||
|
||||
try {
|
||||
onStateChange?.(`Posting...`)
|
||||
onStateChange?.('Posting...')
|
||||
return await store.api.app.bsky.feed.post.create(
|
||||
{did: store.me.did || ''},
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ export class FeedModel {
|
|||
}
|
||||
this._xLoading()
|
||||
let numToFetch = this.feed.length
|
||||
let cursor = undefined
|
||||
let cursor
|
||||
try {
|
||||
do {
|
||||
const res: GetTimeline.Response = await this._getFeed({
|
||||
|
|
|
@ -366,7 +366,7 @@ export class NotificationsViewModel {
|
|||
}
|
||||
this._xLoading()
|
||||
let numToFetch = this.notifications.length
|
||||
let cursor = undefined
|
||||
let cursor
|
||||
try {
|
||||
do {
|
||||
const res: ListNotifications.Response =
|
||||
|
|
|
@ -50,7 +50,9 @@ export class OnboardModel {
|
|||
}
|
||||
|
||||
next() {
|
||||
if (!this.isOnboarding) return
|
||||
if (!this.isOnboarding) {
|
||||
return
|
||||
}
|
||||
let i = OnboardStageOrder.indexOf(this.stage)
|
||||
i++
|
||||
if (i >= OnboardStageOrder.length) {
|
||||
|
|
|
@ -48,12 +48,16 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => {
|
|||
setServiceDescription(undefined)
|
||||
store.session.describeService(serviceUrl).then(
|
||||
desc => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setServiceDescription(desc)
|
||||
setUserDomain(desc.availableUserDomains[0])
|
||||
},
|
||||
err => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
store.log.warn(
|
||||
`Failed to fetch service description for ${serviceUrl}`,
|
||||
err,
|
||||
|
|
|
@ -47,11 +47,15 @@ export const Signin = ({onPressBack}: {onPressBack: () => void}) => {
|
|||
setError('')
|
||||
store.session.describeService(serviceUrl).then(
|
||||
desc => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setServiceDescription(desc)
|
||||
},
|
||||
err => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
store.log.warn(
|
||||
`Failed to fetch service description for ${serviceUrl}`,
|
||||
err,
|
||||
|
|
|
@ -76,7 +76,7 @@ export function PostLoadingPlaceholder({
|
|||
strokeWidth={1.7}
|
||||
/>
|
||||
</View>
|
||||
<View style={s.flex1}></View>
|
||||
<View style={s.flex1} />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
@ -40,11 +40,15 @@ export function UserInfoText({
|
|||
let aborted = false
|
||||
store.profiles.getProfile(did).then(
|
||||
v => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setProfile(v.data)
|
||||
},
|
||||
_err => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setFailed(true)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -36,7 +36,7 @@ export const ViewHeader = observer(function ViewHeader({
|
|||
store.shell.setMainMenuOpen(true)
|
||||
}
|
||||
const onPressSearch = () => {
|
||||
store.nav.navigate(`/search`)
|
||||
store.nav.navigate('/search')
|
||||
}
|
||||
const onPressReconnect = () => {
|
||||
store.session.connect().catch(e => {
|
||||
|
|
|
@ -88,11 +88,21 @@ export function SwipeAndZoom({
|
|||
}
|
||||
|
||||
const canDir = (d: Dir) => {
|
||||
if (d === Dir.Left) return canSwipeLeft
|
||||
if (d === Dir.Right) return canSwipeRight
|
||||
if (d === Dir.Up) return canSwipeUp
|
||||
if (d === Dir.Down) return canSwipeDown
|
||||
if (d === Dir.Zoom) return zoomEnabled
|
||||
if (d === Dir.Left) {
|
||||
return canSwipeLeft
|
||||
}
|
||||
if (d === Dir.Right) {
|
||||
return canSwipeRight
|
||||
}
|
||||
if (d === Dir.Up) {
|
||||
return canSwipeUp
|
||||
}
|
||||
if (d === Dir.Down) {
|
||||
return canSwipeDown
|
||||
}
|
||||
if (d === Dir.Zoom) {
|
||||
return zoomEnabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
const isHorz = (d: Dir) => d === Dir.Left || d === Dir.Right
|
||||
|
|
|
@ -46,8 +46,11 @@ export function RichText({
|
|||
</Text>
|
||||
)
|
||||
}
|
||||
if (!style) style = []
|
||||
else if (!Array.isArray(style)) style = [style]
|
||||
if (!style) {
|
||||
style = []
|
||||
} else if (!Array.isArray(style)) {
|
||||
style = [style]
|
||||
}
|
||||
entities.sort(sortByIndex)
|
||||
const segments = Array.from(toSegments(text, entities))
|
||||
const els = []
|
||||
|
|
|
@ -15,7 +15,7 @@ export const Contacts = ({navIdx, visible, params}: ScreenParams) => {
|
|||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
store.nav.setTitle(navIdx, `Contacts`)
|
||||
store.nav.setTitle(navIdx, 'Contacts')
|
||||
}
|
||||
}, [store, visible])
|
||||
|
||||
|
|
|
@ -40,7 +40,9 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
|||
} else {
|
||||
store.nav.setTitle(navIdx, params.name)
|
||||
uiState.setup().then(() => {
|
||||
if (aborted) return
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setHasSetup(true)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export const Search = ({navIdx, visible, params}: ScreenParams) => {
|
|||
if (visible) {
|
||||
store.shell.setMinimalShellMode(false)
|
||||
autocompleteView.setup()
|
||||
store.nav.setTitle(navIdx, `Search`)
|
||||
store.nav.setTitle(navIdx, 'Search')
|
||||
}
|
||||
}, [store, visible, name])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue