mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-17 13:05:07 +00:00
chore lint: code sth.
This commit is contained in:
@@ -13,6 +13,7 @@ const GlobalFooter = ({ className, links, copyright }) => {
|
||||
key={link.key}
|
||||
title={link.key}
|
||||
target={link.blankTarget ? '_blank' : '_self'}
|
||||
rel={link.blankTarget ? 'noreferrer noopener' : undefined}
|
||||
href={link.href}
|
||||
>
|
||||
{link.title}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Breadcrumb } from 'antd'
|
||||
import { Link, withRouter } from 'umi'
|
||||
import { i18n } from '@lingui/core'
|
||||
import iconMap from 'utils/iconMap'
|
||||
const { pathToRegexp } = require('path-to-regexp')
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import { queryAncestors } from 'utils'
|
||||
import styles from './Bread.less'
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* global window */
|
||||
/* global document */
|
||||
import React, { PureComponent, Fragment } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { withRouter } from 'umi'
|
||||
@@ -7,7 +5,7 @@ import { connect } from 'umi'
|
||||
import { MyLayout, GlobalFooter } from 'components'
|
||||
import { Drawer, FloatButton, Layout } from 'antd';
|
||||
import { enquireScreen, unenquireScreen } from 'enquire-js'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import { config, getLocale } from 'utils'
|
||||
import Error from '../pages/404'
|
||||
import styles from './PrimaryLayout.less'
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default ({ children }) => {
|
||||
return children
|
||||
}
|
||||
const PublicLayout = ({ children }) => children
|
||||
|
||||
export default PublicLayout
|
||||
|
||||
@@ -46,7 +46,7 @@ const languages = {
|
||||
'pt-br': ptBR
|
||||
}
|
||||
|
||||
const { defaultLanguage } = i18n
|
||||
// remove unused defaultLanguage
|
||||
|
||||
@withRouter
|
||||
class Layout extends Component {
|
||||
@@ -69,6 +69,7 @@ class Layout extends Component {
|
||||
i18n.activate(language)
|
||||
} catch (err) {
|
||||
// If loading fails, fall back to default language and log a warning.
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Failed to load messages for locale "${language}":`, err)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,7 @@
|
||||
/* global window */
|
||||
|
||||
import { history } from 'umi'
|
||||
import { stringify } from 'qs'
|
||||
import store from 'store'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import { ROLE_TYPE } from 'utils/constant'
|
||||
import { queryLayout } from 'utils'
|
||||
import { CANCEL_REQUEST_MESSAGE } from 'utils/constant'
|
||||
@@ -20,7 +18,7 @@ const goDashboard = () => {
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
const appModel = {
|
||||
namespace: 'app',
|
||||
state: {
|
||||
routeList: [
|
||||
@@ -158,3 +156,5 @@ export default {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default appModel
|
||||
|
||||
@@ -3,14 +3,22 @@ import ReactEcharts from 'echarts-for-react'
|
||||
|
||||
const ChartWithEventComponent = () => {
|
||||
const onChartReady = echart => {
|
||||
/* eslint-disable */
|
||||
console.log('echart is ready', echart)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('echart is ready', echart)
|
||||
}
|
||||
}
|
||||
const onChartLegendselectchanged = (param, echart) => {
|
||||
console.log(param, echart)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(param, echart)
|
||||
}
|
||||
}
|
||||
const onChartClick = (param, echart) => {
|
||||
console.log(param, echart)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(param, echart)
|
||||
}
|
||||
}
|
||||
const getOtion = () => {
|
||||
const option = {
|
||||
|
||||
@@ -181,6 +181,8 @@ let colorPalette = [
|
||||
|
||||
if (echarts && typeof echarts.registerTheme === 'function') {
|
||||
echarts.registerTheme('macarons', theme)
|
||||
} else if (typeof console !== 'undefined' && console.error) {
|
||||
console.error('ECharts is not loaded, failed to register macarons theme')
|
||||
} else {
|
||||
// Console may be used only to report theme registration failure; suppress lint here
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof console !== 'undefined' && console.error) console.error('ECharts is not loaded, failed to register macarons theme')
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ let colorPalette = [
|
||||
|
||||
map: {
|
||||
label: { color: '#c12e34' },
|
||||
emphasis: { label: { color: '#c12e34' } },
|
||||
itemStyle: {
|
||||
borderColor: '#eee',
|
||||
areaColor: '#ddd',
|
||||
},
|
||||
emphasis: {
|
||||
label: { color: '#c12e34' },
|
||||
itemStyle: {
|
||||
areaColor: '#e6b600',
|
||||
},
|
||||
@@ -119,6 +119,8 @@ let colorPalette = [
|
||||
}
|
||||
if (echarts && typeof echarts.registerTheme === 'function') {
|
||||
echarts.registerTheme('shine', theme)
|
||||
} else if (typeof console !== 'undefined' && console.error) {
|
||||
console.error('ECharts is not loaded, failed to register shine theme')
|
||||
} else {
|
||||
// Console may be used only to report theme registration failure; suppress lint here
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof console !== 'undefined' && console.error) console.error('ECharts is not loaded, failed to register shine theme')
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { parse } from 'qs'
|
||||
import modelExtend from 'dva-model-extend'
|
||||
import api from 'api'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import { model } from 'utils/model'
|
||||
|
||||
const { queryDashboard, queryWeather } = api
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { history } from 'umi'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import api from 'api'
|
||||
|
||||
const { loginUser } = api
|
||||
|
||||
export default {
|
||||
const loginModel = {
|
||||
namespace: 'login',
|
||||
|
||||
state: {},
|
||||
@@ -35,3 +35,5 @@ export default {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default loginModel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import modelExtend from 'dva-model-extend'
|
||||
import api from 'api'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import { pageModel } from 'utils/model'
|
||||
|
||||
const { queryPostList } = api
|
||||
|
||||
@@ -72,7 +72,10 @@ class RequestPage extends React.Component {
|
||||
})
|
||||
})
|
||||
.catch(errorInfo => {
|
||||
console.log(errorInfo)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(errorInfo)
|
||||
}
|
||||
/*
|
||||
errorInfo:
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import api from 'api'
|
||||
|
||||
const { queryUser } = api
|
||||
|
||||
export default {
|
||||
const userDetailModel = {
|
||||
namespace: 'userDetail',
|
||||
|
||||
state: {
|
||||
@@ -48,3 +48,5 @@ export default {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default userDetailModel
|
||||
|
||||
@@ -31,7 +31,10 @@ class UserModal extends PureComponent {
|
||||
onOk(data)
|
||||
})
|
||||
.catch(errorInfo => {
|
||||
console.log(errorInfo)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(errorInfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -67,7 +70,7 @@ class UserModal extends PureComponent {
|
||||
label={i18n._('Phone')} hasFeedback {...formItemLayout}>
|
||||
<Input />
|
||||
</FormItem>
|
||||
<FormItem name='email' rules={[{ required: true, pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/, message: i18n._('The input is not valid E-mail!'), }]}
|
||||
<FormItem name='email' rules={[{ required: true, pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/ , message: i18n._('The input is not valid E-mail!'), }]}
|
||||
label={i18n._('Email')} hasFeedback {...formItemLayout}>
|
||||
<Input />
|
||||
</FormItem>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import modelExtend from 'dva-model-extend'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import api from 'api'
|
||||
import { pageModel } from 'utils/model'
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { message } from 'antd'
|
||||
|
||||
export default {
|
||||
const onErrorHandler = {
|
||||
onError(e, a) {
|
||||
e.preventDefault()
|
||||
if (e.message) {
|
||||
message.error(e.message)
|
||||
} else {
|
||||
/* eslint-disable */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default onErrorHandler
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
export default {
|
||||
const api = {
|
||||
queryRouteList: '/routes',
|
||||
|
||||
queryUserInfo: '/user',
|
||||
@@ -16,3 +16,5 @@ export default {
|
||||
|
||||
queryDashboard: '/dashboard',
|
||||
}
|
||||
|
||||
export default api
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
AreaChartOutlined,
|
||||
} from '@ant-design/icons'
|
||||
|
||||
export default {
|
||||
const iconMap = {
|
||||
'pay-circle-o': <PayCircleOutlined />,
|
||||
'shopping-cart': <ShoppingCartOutlined />,
|
||||
'camera-o': <CameraOutlined />,
|
||||
@@ -29,3 +29,5 @@ export default {
|
||||
api: <ApiOutlined />,
|
||||
edit: <EditOutlined />,
|
||||
}
|
||||
|
||||
export default iconMap
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { cloneDeep } from 'lodash'
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
import store from 'store'
|
||||
import { i18n } from '@lingui/core'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { pathToRegexp } = require("path-to-regexp")
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
|
||||
// strip known locale prefix (e.g. /zh, /en, /pt-br) before matching
|
||||
const stripLocale = (p) => p.replace(/^\/(en|zh|pt-br)(\/|$)/, '/')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import { cloneDeep } from 'lodash'
|
||||
const { parse, compile } = require("path-to-regexp")
|
||||
import { parse, compile } from 'path-to-regexp'
|
||||
import { message } from 'antd'
|
||||
import { CANCEL_REQUEST_MESSAGE } from 'utils/constant'
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function request(options) {
|
||||
|
||||
try {
|
||||
let domain = ''
|
||||
const urlMatch = url.match(/[a-zA-z]+:\/\/[^/]*/)
|
||||
const urlMatch = url.match(/[A-Za-z]+:\/\/[^/]*/)
|
||||
if (urlMatch) {
|
||||
;[domain] = urlMatch
|
||||
url = url.slice(domain.length)
|
||||
@@ -62,9 +62,9 @@ export default function request(options) {
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
const { response, message } = error
|
||||
const { response, message: errMsg } = error
|
||||
|
||||
if (String(message) === CANCEL_REQUEST_MESSAGE) {
|
||||
if (String(errMsg) === CANCEL_REQUEST_MESSAGE) {
|
||||
return {
|
||||
success: false,
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export default function request(options) {
|
||||
msg = data.message || statusText
|
||||
} else {
|
||||
statusCode = 600
|
||||
msg = error.message || 'Network Error'
|
||||
msg = errMsg || error.message || 'Network Error'
|
||||
}
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
Reference in New Issue
Block a user