Lints some errors and warnings (#76)
parent
2fce1637b4
commit
06e41167d0
|
@ -61,4 +61,5 @@ buck-out/
|
|||
/vendor/bundle/
|
||||
|
||||
# Testing
|
||||
coverage/
|
||||
coverage/
|
||||
junit.xml
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
NavigationModel,
|
||||
NavigationTabModel,
|
||||
} from './../../../src/state/models/navigation'
|
||||
import {NavigationModel} from './../../../src/state/models/navigation'
|
||||
import * as flags from '../../../src/build-flags'
|
||||
|
||||
describe('NavigationModel', () => {
|
||||
|
|
|
@ -3,8 +3,6 @@ import {Keyboard} from 'react-native'
|
|||
import {CreateAccount} from '../../../../src/view/com/login/CreateAccount'
|
||||
import {cleanup, fireEvent, render} from '../../../../jest/test-utils'
|
||||
import {
|
||||
mockedLogStore,
|
||||
mockedRootStore,
|
||||
mockedSessionStore,
|
||||
mockedShellStore,
|
||||
} from '../../../../__mocks__/state-mock'
|
||||
|
|
|
@ -3,8 +3,6 @@ import {Signin} from '../../../../src/view/com/login/Signin'
|
|||
import {cleanup, fireEvent, render} from '../../../../jest/test-utils'
|
||||
import {SessionServiceClient, sessionClient as AtpApi} from '@atproto/api'
|
||||
import {
|
||||
mockedLogStore,
|
||||
mockedRootStore,
|
||||
mockedSessionStore,
|
||||
mockedShellStore,
|
||||
} from '../../../../__mocks__/state-mock'
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import React from 'react'
|
||||
import {Menu} from '../../../../src/view/shell/mobile/Menu'
|
||||
import {cleanup, fireEvent, render} from '../../../../jest/test-utils'
|
||||
import {
|
||||
mockedNavigationStore,
|
||||
mockedShellStore,
|
||||
} from '../../../../__mocks__/state-mock'
|
||||
import {mockedNavigationStore} from '../../../../__mocks__/state-mock'
|
||||
|
||||
describe('Menu', () => {
|
||||
const onCloseMock = jest.fn()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react'
|
||||
import {Animated, Share} from 'react-native'
|
||||
import {Animated} from 'react-native'
|
||||
import {TabsSelector} from '../../../../src/view/shell/mobile/TabsSelector'
|
||||
import {cleanup, fireEvent, render} from '../../../../jest/test-utils'
|
||||
import {mockedNavigationStore} from '../../../../__mocks__/state-mock'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global jest */
|
||||
|
||||
import 'react-native-gesture-handler/jestSetup'
|
||||
jest.mock('@react-native-async-storage/async-storage', () =>
|
||||
require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
|
||||
|
|
|
@ -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…
Reference in New Issue