Skip to content

Commit

Permalink
style: 移除无用逗号
Browse files Browse the repository at this point in the history
  • Loading branch information
hesoso committed Dec 19, 2023
1 parent b85eb66 commit f3f9b0c
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 89 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ module.exports = {
'quotes': ['error', 'single'],
// 禁止使用分号结尾
'semi': ['error', 'never'],
// 禁止逗号
"comma-dangle": ["error", "never"]
},
}
2 changes: 1 addition & 1 deletion src/config/nprogress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NProgress.configure({
speed: 500, // 递增进度条的速度
showSpinner: true, // 是否显示加载ico
trickleSpeed: 200, // 自动递增间隔
minimum: 0.3, // 初始化时的最小百分比
minimum: 0.3 // 初始化时的最小百分比
})

export default NProgress
42 changes: 21 additions & 21 deletions src/constant/menus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
FormOutlined,
BugOutlined,
SmileOutlined,
TeamOutlined,
TeamOutlined
} from '@ant-design/icons'

const siderMenus = [
{
key: 'home',
label: '首页',
icon: <HomeOutlined />,
icon: <HomeOutlined />
},
{
key: 'comp',
Expand All @@ -22,30 +22,30 @@ const siderMenus = [
children: [
{
key: 'comp/pinyin',
label: '拼音',
},
],
label: '拼音'
}
]
},
{
key: 'editor',
label: '编辑器',
icon: <FormOutlined />,
icon: <FormOutlined />
},
{
key: 'exception',
label: '异常页面',
icon: <BugOutlined />,
icon: <BugOutlined />
},
{
key: 'tips',
label: '结果页面',
icon: <SmileOutlined />,
disabled: true,
disabled: true
},
{
key: 'auth',
label: '权限测试',
icon: <TeamOutlined />,
icon: <TeamOutlined />
},
{
key: 'setting',
Expand All @@ -54,40 +54,40 @@ const siderMenus = [
children: [
{
key: 'setting/users',
label: '用户管理',
label: '用户管理'
},
{
key: 'setting/roles',
label: '角色管理',
label: '角色管理'
},
{
key: 'setting/menus',
label: '菜单管理',
},
],
},
label: '菜单管理'
}
]
}
]

const userMenus: MenuProps['items'] = [
{
label: '江南无所有',
key: '0',
key: '0'
},
{
label: '聊赠一枝春',
key: '1',
key: '1'
},
{
label: '自定义主题',
key: '2',
key: '2'
},
{
type: 'divider',
type: 'divider'
},
{
label: '退出登录',
key: '3',
},
key: '3'
}
]

export { siderMenus, userMenus }
10 changes: 5 additions & 5 deletions src/constant/signals.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export const signals = [
{
upper: '天王盖地虎',
lower: ['宝塔镇河妖', '提莫一米五'],
lower: ['宝塔镇河妖', '提莫一米五']
},
{
upper: '力拔山兮气盖世',
lower: '时不利兮骓不逝',
lower: '时不利兮骓不逝'
},
{
upper: '地振高岗,一派溪山千古秀',
lower: '门朝大海,三河合水万里流',
lower: '门朝大海,三河合水万里流'
},
{
upper: '山有木兮木有枝',
lower: '心悦君兮君不知',
},
lower: '心悦君兮君不知'
}
]
2 changes: 1 addition & 1 deletion src/http/helper/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const RETRY_DELAY = 3 * 1000
const useRetry = (
axiosInstance: AxiosInstance,
error: WarpAxiosError,
callback: () => void,
callback: () => void
) => {
const config = error.config
// todoo 这里不同的请求是否会触发重试次数累计
Expand Down
10 changes: 5 additions & 5 deletions src/http/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios, {
AxiosInstance,
AxiosResponse,
InternalAxiosRequestConfig,
InternalAxiosRequestConfig
} from 'axios'
import nprogress from '@/config/nprogress'
import useRetry from './helper/retry'
Expand All @@ -11,7 +11,7 @@ import checkStatus from './helper/checkStatus'
const axiosInstance: AxiosInstance = axios.create({
baseURL: import.meta.env.VITE_API_URL,
timeout: 10000,
withCredentials: true,
withCredentials: true
})

axiosInstance.interceptors.request.use(
Expand All @@ -20,7 +20,7 @@ axiosInstance.interceptors.request.use(
canceler.add(config)
return config
},
(error) => Promise.reject(error),
(error) => Promise.reject(error)
)

axiosInstance.interceptors.response.use(
Expand All @@ -35,7 +35,7 @@ axiosInstance.interceptors.response.use(
canceler.remove(error.config)
error.response && checkStatus(error.response.status)
})
},
}
)

interface ResponseBase {
Expand All @@ -62,7 +62,7 @@ const http = {
},
delete<T>(url: string, params: object = {}): ReponsePromise<T> {
return axiosInstance.delete(url, { ...params })
},
}
}

export default http
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
<App />
</Provider>
</BrowserRouter>
</React.StrictMode>,
</React.StrictMode>
)
28 changes: 14 additions & 14 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,54 +31,54 @@ const lazyLood = (element: ReactNode) => {
const routes: RouteObject[] = [
{
path: '/',
element: <Navigate to="/home" />,
element: <Navigate to="/home" />
},
{
path: '/login',
element: <Login />,
element: <Login />
},
{
path: '/',
element: <Layout />,
children: [
{
path: '/home',
element: <Home />,
element: <Home />
},
{
path: '/comp/pinyin',
element: lazyLood(<LazyPinyin />),
element: lazyLood(<LazyPinyin />)
},
{
path: '/editor',
element: lazyLood(<LazyEditor />),
element: lazyLood(<LazyEditor />)
},
{
path: '/exception',
element: lazyLood(<LazyException />),
element: lazyLood(<LazyException />)
},
{
path: '/auth',
element: lazyLood(<LazyAuth />),
element: lazyLood(<LazyAuth />)
},
{
path: '/setting/users',
element: lazyLood(<LazyUsers />),
element: lazyLood(<LazyUsers />)
},
{
path: '/setting/roles',
element: lazyLood(<LazyRoles />),
element: lazyLood(<LazyRoles />)
},
{
path: '/setting/menus',
element: lazyLood(<LazyMenus />),
},
],
element: lazyLood(<LazyMenus />)
}
]
},
{
path: '*',
element: <Result status="404" title="404" subTitle="我的兜里一无所有" />,
},
element: <Result status="404" title="404" subTitle="我的兜里一无所有" />
}
]

const WrapperRoutes = () => useRoutes(routes)
Expand Down
10 changes: 5 additions & 5 deletions src/store/slice/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ export const menuSlice = createSlice({
name: 'menu',
initialState: {
value: {
breadcrumbs: [],
},
breadcrumbs: []
}
},
reducers: {
setMenu: (
state: { value: MenuState },
action: PayloadAction<MenuState>,
action: PayloadAction<MenuState>
) => {
state.value.breadcrumbs = action.payload.breadcrumbs
console.log(state.value.breadcrumbs, action.payload)
},
},
}
}
})

export const { setMenu } = menuSlice.actions
Expand Down
6 changes: 3 additions & 3 deletions src/views/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useAppSelector } from '../../hooks'

type Props = {
theme: BaseTheme;
onThemeChange: (theme: BaseTheme) => void;
};
onThemeChange: (theme: BaseTheme) => void
}

const Header: React.FC<Props> = ({ theme, onThemeChange }) => {
const changeTheme = (checked) => {
Expand All @@ -16,7 +16,7 @@ const Header: React.FC<Props> = ({ theme, onThemeChange }) => {
}

const breadcrumbsItems = useAppSelector(
(state) => state.menu.value.breadcrumbs,
(state) => state.menu.value.breadcrumbs
)

return (
Expand Down
10 changes: 5 additions & 5 deletions src/views/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ const Layouts = () => {
// colorBgContainer: '#fafafc', // 组件容器背景色
// colorBgElevated: '#32363e', // 悬浮容器背景色
// fontSize: 14,
colorPrimary: 'green',
colorPrimary: 'green'
}
}
}

useEffect(() => {
let compsConfig: ThemeConfig['components'] = {
Layout: {
headerHeight: 50,
},
headerHeight: 50
}
}
if (baseTheme === 'light') {
compsConfig = {
Layout: { headerBg: '#fafafc', headerHeight: 50 },
Menu: { itemBg: '#fafafc' },
Menu: { itemBg: '#fafafc' }
}
}
const config: ThemeConfig = {
algorithm: getThemeAlgorithm(baseTheme),
components: { ...compsConfig },
components: { ...compsConfig }
}
setThemeConfig(config)
}, [baseTheme])
Expand Down
12 changes: 6 additions & 6 deletions src/views/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Select,
Input,
ConfigProvider,
notification,
notification
} from 'antd'
import { useNavigate } from 'react-router-dom'
import { MehOutlined } from '@ant-design/icons'
Expand Down Expand Up @@ -38,7 +38,7 @@ export default function Login() {
message,
description: <Context.Consumer>{() => tips}</Context.Consumer>,
placement: 'topRight',
icon: <MehOutlined style={{ color: '#d14e24' }} />,
icon: <MehOutlined style={{ color: '#d14e24' }} />
})
}

Expand All @@ -64,13 +64,13 @@ export default function Login() {
<ConfigProvider
theme={{
token: {
colorPrimary: '#d14e24',
colorPrimary: '#d14e24'
},
components: {
Checkbox: {
colorText: '#d14e24',
},
},
colorText: '#d14e24'
}
}
}}
>
<Form
Expand Down
Loading

0 comments on commit f3f9b0c

Please sign in to comment.