🌈 style(eslint): add eslint rules

This commit is contained in:
xuan
2022-11-26 14:35:05 +08:00
parent f3aa20f049
commit 99a920975f
245 changed files with 14909 additions and 14349 deletions
+18 -19
View File
@@ -1,29 +1,27 @@
import { CoverImage, View } from '@tarojs/components'
import { FC, useMemo, useState } from 'react'
import Taro, { useDidShow, useRouter } from '@tarojs/taro'
import type { FC } from 'react'
import { useMemo, useState } from 'react'
import classname from 'classnames'
import { useDispatch } from 'react-redux'
import type { Dispatch } from 'redux'
import styles from './index.module.scss'
import IconFont from '@/components/iconfont/iconfont'
import classname from 'classnames'
import Taro, { useDidShow, useRouter } from '@tarojs/taro'
import { useSelector } from '@/reducers/hooks'
import { useDispatch } from 'react-redux'
import { Dispatch } from 'redux'
import { TabBarType } from '@/constants/tabbar'
import { TabBarAction } from '@/reducers/tabBar'
import type { TabBarAction } from '@/reducers/tabBar'
type IconfontName = Parameters<typeof IconFont>['0']['name']
type TabBarIndexMap = {
[Property: number]: {
id: number
pagePath: string
text: string
iconPath: IconfontName
selectedIconPath: IconfontName
}
}
type TabBarIndexMap = Record<number, {
id: number
pagePath: string
text: string
iconPath: IconfontName
selectedIconPath: IconfontName
}>
const CustomTabBar: FC = () => {
const { selectedId, tabItem } = useSelector((state) => {
return state.tabBarData
})
@@ -41,7 +39,7 @@ const CustomTabBar: FC = () => {
const handleSelectTabItem = (id: TabBarIndexMap[number]['id']) => {
return () => {
setSelected(id)
Taro.switchTab({ url: tabItem?.find(item=>item.id === id)?.pagePath! })
Taro.switchTab({ url: tabItem?.find(item => item.id === id)?.pagePath! })
}
}
const setSelected = (id: TabBarIndexMap[number]['id']) => {
@@ -55,8 +53,9 @@ const CustomTabBar: FC = () => {
return (
<View
key={index}
className={classname(styles['customTabBar-item'], styles['customTabBar-item-title'], selectedId === item.id ? styles['selected'] : '')}
onClick={handleSelectTabItem(item.id)}>
className={classname(styles['customTabBar-item'], styles['customTabBar-item-title'], selectedId === item.id ? styles.selected : '')}
onClick={handleSelectTabItem(item.id)}
>
<IconFont name={Number(selectedId) === item.id ? item.selectedIconPath : item.iconPath} size={56} />
<View>{item.text}</View>