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

style: fix lint

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