Commit 6c53cf39 authored by 张烨's avatar 张烨

style: fix lint

parent 464533fe
......@@ -12,7 +12,7 @@ module.exports = {
'styled-components',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
['import', { libraryName: 'antd', style: true }]
['import', { libraryName: 'antd', style: true }],
],
env: {
production: {
......
......@@ -15,7 +15,7 @@ module.exports = options => ({
module: {
rules: [
{
test: /\.jsx?$/,
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
......@@ -42,7 +42,6 @@ module.exports = options => ({
loader: 'css-loader',
options: {
modules: {
// localIdentName: '[name]__[local]___[hash:base64:5]'
// modules: true,
getLocalIdent: (context, _, localName) => {
......@@ -53,22 +52,24 @@ module.exports = options => ({
) {
return localName;
}
const match = context.resourcePath.match(/src(.*)/);
if (match && match[1]) {
const antdProPath = match[1].replace('.less', '');
const arr = slash(antdProPath)
.split('/')
.map(a => a.replace(/([A-Z])/g, '-$1'))
.map(a => a.toLowerCase());
return `panda-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
return `panda-pro${arr.join('-')}-${localName}`.replace(
/--/g,
'-',
);
}
return localName;
},
}
},
},
},
{
......
......@@ -49,7 +49,7 @@ module.exports = require('./webpack.base.babel')({
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
child_process: 'empty',
},
performance: {
hints: false,
......
......@@ -37,7 +37,7 @@ if (module.hot) {
render();
});
}
if(MOUNT_NODE) {
if (MOUNT_NODE) {
render();
}
......
......@@ -7,10 +7,7 @@ import styles from './index.less';
const HeaderDropdown = ({ overlayClassName: cls, ...restProps }) => (
<Dropdown
overlayClassName={classNames(
styles.container,
cls,
)}
overlayClassName={classNames(styles.container, cls)}
{...restProps}
/>
);
......
import React, { useRef } from 'react';
import {
AutoComplete,
Input,
} from 'antd';
import { AutoComplete, Input } from 'antd';
import classNames from 'classnames';
import PropType from 'prop-types';
import useMergeValue from 'use-merge-value';
......@@ -35,19 +32,13 @@ const HeaderSearch = props => {
onChange: onVisibleChange,
});
const inputClass = classNames(
styles.input,
{
[styles.show]: searchMode,
},
);
const inputClass = classNames(styles.input, {
[styles.show]: searchMode,
});
return (
<div
className={classNames(
className,
styles.headerSearch,
)}
className={classNames(className, styles.headerSearch)}
onClick={() => {
setSearchMode(true);
if (searchMode && inputRef.current) {
......
import React from 'react';
import {
Badge,
Spin,
Tabs,
} from 'antd';
import { Badge, Spin, Tabs } from 'antd';
import classNames from 'classnames';
import useMergeValue from 'use-merge-value';
......@@ -78,14 +74,9 @@ const NoticeIcon = props => {
value: props.popupVisible,
onChange: props.onPopupVisibleChange,
});
const noticeButtonClass = classNames(
className,
styles.noticeButton,
);
const noticeButtonClass = classNames(className, styles.noticeButton);
const notificationBox = getNotificationBox();
const NoticeBellIcon = bell || (
<BellOutlined className={styles.icon} />
);
const NoticeBellIcon = bell || <BellOutlined className={styles.icon} />;
const trigger = (
<span className={classNames(noticeButtonClass, { opened: visible })}>
<Badge
......
import { routerMiddleware } from 'connected-react-router/immutable';
import { Iterable } from 'immutable';
import {
applyMiddleware,
compose,
createStore,
} from 'redux';
import { applyMiddleware, compose, createStore } from 'redux';
import { createLogger } from 'redux-logger';
import createSagaMiddleware from 'redux-saga';
import thunk from 'redux-thunk';
......
......@@ -2,20 +2,14 @@ import React from 'react';
import { Helmet } from 'react-helmet';
import { renderRoutes } from 'react-router-config';
import {
BrowserRouter as Router,
Switch,
} from 'react-router-dom';
import { BrowserRouter as Router, Switch } from 'react-router-dom';
import config from '../../routes/config';
export default function App() {
return (
<>
<Helmet
titleTemplate="%s - 运维平台"
defaultTitle="运维平台"
>
<Helmet titleTemplate="%s - 运维平台" defaultTitle="运维平台">
<meta name="description" content="运维平台" />
</Helmet>
<Router>
......
import {
LOAD_REPOS,
LOAD_REPOS_ERROR,
LOAD_REPOS_SUCCESS,
} from './constants';
import { LOAD_REPOS, LOAD_REPOS_ERROR, LOAD_REPOS_SUCCESS } from './constants';
export function loadRepos() {
return {
......@@ -10,7 +6,6 @@ export function loadRepos() {
};
}
export function reposLoaded(repos, username) {
return {
type: LOAD_REPOS_SUCCESS,
......
import { fromJS } from 'immutable';
import {
LOAD_REPOS,
LOAD_REPOS_ERROR,
LOAD_REPOS_SUCCESS,
} from './constants';
import { LOAD_REPOS, LOAD_REPOS_ERROR, LOAD_REPOS_SUCCESS } from './constants';
export const initialState = fromJS({
loading: false,
......@@ -23,25 +19,25 @@ const appReducer = (state = initialState, action) => {
loading: true,
error: false,
userData: {
repositories: false
}
})
repositories: false,
},
});
case LOAD_REPOS_SUCCESS:
return state.merge({
loading: false,
currentUser: action.username,
userData: {
repositories: action.repos
}
})
repositories: action.repos,
},
});
case LOAD_REPOS_ERROR:
return state.merge({
error: action.error,
loading: false
})
loading: false,
});
default:
return state;
}
}
};
export default appReducer;
import React from 'react';
import {
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { renderRoutes } from 'react-router-config';
import {
......@@ -38,16 +35,16 @@ const UserLayout = props => {
</Helmet>
<div className={styles.container}>
<div className={styles.lang}>
{/* <SelectLang /> */}
</div>
<div className={styles.lang}>{/* <SelectLang /> */}</div>
<div className={styles.content}>
<div className={styles.top}>
<div className={styles.header}>
<img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>Ant Design</span>
<img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>Ant Design</span>
</div>
<div className={styles.desc}>
Ant Design 是西湖区最具影响力的 Web 设计规范
</div>
<div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
</div>
{renderRoutes(route.routes)}
</div>
......
import React from 'react';
import { Alert, Card, Typography } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { connect } from 'react-redux';
import styles from './Welcome.less';
const CodePreview = ({ children }) => (
......@@ -14,7 +12,9 @@ const CodePreview = ({ children }) => (
</pre>
);
export default () => (
const mapState = store => store;
export default connect(mapState)(() => (
<PageContainer>
<Card>
<Alert
......@@ -29,4 +29,4 @@ export default () => (
/>
</Card>
</PageContainer>
);
));
import React from 'react';
import {
Button,
Result,
} from 'antd';
import { Button, Result } from 'antd';
export default () => (
<Result
......@@ -13,8 +10,6 @@ export default () => (
background: 'none',
}}
subTitle="Sorry, you don't have access to this page."
extra={
<Button type="primary">Back to home</Button>
}
extra={<Button type="primary">Back to home</Button>}
/>
);
\ No newline at end of file
);
import React from 'react';
import {
Button,
Result,
} from 'antd';
import { Button, Result } from 'antd';
export default () => (
<Result
......@@ -13,8 +10,6 @@ export default () => (
background: 'none',
}}
subTitle="Sorry, the page you visited does not exist."
extra={
<Button type="primary">Back Home</Button>
}
extra={<Button type="primary">Back Home</Button>}
/>
);
\ No newline at end of file
);
import React from 'react';
import {
Form,
Input,
} from 'antd';
import { Form, Input } from 'antd';
import LoginContext from './LoginContext';
import ItemMap from './map';
......
import React from 'react';
import {
Button,
Form,
} from 'antd';
import { Button, Form } from 'antd';
import classNames from 'classnames';
import styles from './index.less';
......@@ -11,10 +8,7 @@ import styles from './index.less';
const FormItem = Form.Item;
const LoginSubmit = ({ className, ...rest }) => {
const clsString = classNames(
styles.submit,
className,
);
const clsString = classNames(styles.submit, className);
return (
<FormItem>
<Button
......
......@@ -19,12 +19,7 @@ const Login = props => {
});
return (
<LoginContext.Provider>
<div
className={classNames(
className,
styles.login,
)}
>
<div className={classNames(className, styles.login)}>
<Form
form={props.from}
onFinish={values => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment