Skip to content

Commit 53d7da0

Browse files
✂️ dependency: remove plugin prettier (#31)
* ➕ dependency: remove plugin:prettier * up prettier verison * ➕ dependency: remove plugin:prettier * prettier all code
1 parent 144269d commit 53d7da0

File tree

41 files changed

+99
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+99
-104
lines changed

example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
1717
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
1818
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
19-
"lint:prettier": "check-prettier lint",
19+
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
2020
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
2121
"prettier": "prettier -c --write \"**/*\"",
2222
"start": "umi dev",
@@ -111,7 +111,7 @@
111111
"lint-staged": "^9.0.0",
112112
"mockjs": "^1.0.1-beta3",
113113
"node-fetch": "^2.6.0",
114-
"prettier": "^1.19.1",
114+
"prettier": "^2.0.1",
115115
"pro-download": "1.0.1",
116116
"stylelint": "^13.0.0",
117117
"umi-plugin-ga": "^1.1.3",

example/src/components/Authorized/CheckPermissions.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const checkPermissions = <T, K>(
3232
// 数组处理
3333
if (Array.isArray(authority)) {
3434
if (Array.isArray(currentAuthority)) {
35-
if (currentAuthority.some(item => authority.includes(item))) {
35+
if (currentAuthority.some((item) => authority.includes(item))) {
3636
return target;
3737
}
3838
} else if (authority.includes(currentAuthority)) {
@@ -43,7 +43,7 @@ const checkPermissions = <T, K>(
4343
// string 处理
4444
if (typeof authority === 'string') {
4545
if (Array.isArray(currentAuthority)) {
46-
if (currentAuthority.some(item => authority === item)) {
46+
if (currentAuthority.some((item) => authority === item)) {
4747
return target;
4848
}
4949
} else if (authority === currentAuthority) {

example/src/components/GlobalHeader/NoticeIconView.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
6262
return {};
6363
}
6464

65-
const newNotices = notices.map(notice => {
65+
const newNotices = notices.map((notice) => {
6666
const newNotice = { ...notice };
6767

6868
if (newNotice.datetime) {
@@ -101,15 +101,15 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
101101
const unreadMsg: {
102102
[key: string]: number;
103103
} = {};
104-
Object.keys(noticeData).forEach(key => {
104+
Object.keys(noticeData).forEach((key) => {
105105
const value = noticeData[key];
106106

107107
if (!unreadMsg[key]) {
108108
unreadMsg[key] = 0;
109109
}
110110

111111
if (Array.isArray(value)) {
112-
unreadMsg[key] = value.filter(item => !item.read).length;
112+
unreadMsg[key] = value.filter((item) => !item.read).length;
113113
}
114114
});
115115
return unreadMsg;
@@ -123,7 +123,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
123123
<NoticeIcon
124124
className={styles.action}
125125
count={currentUser && currentUser.unreadCount}
126-
onItemClick={item => {
126+
onItemClick={(item) => {
127127
this.changeReadState(item as NoticeItem);
128128
}}
129129
loading={fetchingNotices}

example/src/components/GlobalHeader/RightContent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface GlobalHeaderRightProps extends ConnectProps {
1414
layout: 'sidemenu' | 'topmenu';
1515
}
1616

17-
const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = props => {
17+
const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = (props) => {
1818
const { theme, layout } = props;
1919
let className = styles.right;
2020

example/src/components/HeaderSearch/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface HeaderSearchProps {
2020
value?: string;
2121
}
2222

23-
const HeaderSearch: React.FC<HeaderSearchProps> = props => {
23+
const HeaderSearch: React.FC<HeaderSearchProps> = (props) => {
2424
const {
2525
className,
2626
defaultValue,
@@ -87,7 +87,7 @@ const HeaderSearch: React.FC<HeaderSearchProps> = props => {
8787
defaultValue={defaultValue}
8888
aria-label={placeholder}
8989
placeholder={placeholder}
90-
onKeyDown={e => {
90+
onKeyDown={(e) => {
9191
if (e.key === 'Enter') {
9292
if (restProps.onSearch) {
9393
restProps.onSearch(value);

example/src/components/NoticeIcon/NoticeList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const NoticeList: React.SFC<NoticeIconTabProps> = ({
9797
) : null}
9898
{showViewMore ? (
9999
<div
100-
onClick={e => {
100+
onClick={(e) => {
101101
if (onViewMore) {
102102
onViewMore(e);
103103
}

example/src/components/NoticeIcon/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface NoticeIconProps {
4242

4343
const NoticeIcon: React.FC<NoticeIconProps> & {
4444
Tab: typeof NoticeList;
45-
} = props => {
45+
} = (props) => {
4646
const getNotificationBox = (): React.ReactNode => {
4747
const {
4848
children,

example/src/components/SelectLang/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface SelectLangProps {
1111
className?: string;
1212
}
1313

14-
const SelectLang: React.FC<SelectLangProps> = props => {
14+
const SelectLang: React.FC<SelectLangProps> = (props) => {
1515
const { className } = props;
1616
const selectedLang = getLocale();
1717

@@ -32,7 +32,7 @@ const SelectLang: React.FC<SelectLangProps> = props => {
3232
};
3333
const langMenu = (
3434
<Menu className={styles.menu} selectedKeys={[selectedLang]} onClick={changeLang}>
35-
{locales.map(locale => (
35+
{locales.map((locale) => (
3636
<Menu.Item key={locale}>
3737
<span role="img" aria-label={languageLabels[locale]}>
3838
{languageIcons[locale]}

example/src/e2e/baseLayout.e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
66
function formatter(routes, parentPath = '') {
77
const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
88
let result = [];
9-
routes.forEach(item => {
9+
routes.forEach((item) => {
1010
if (item.path) {
1111
result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
1212
}
@@ -16,7 +16,7 @@ function formatter(routes, parentPath = '') {
1616
);
1717
}
1818
});
19-
return uniq(result.filter(item => !!item));
19+
return uniq(result.filter((item) => !!item));
2020
}
2121

2222
beforeAll(async () => {
@@ -27,7 +27,7 @@ beforeAll(async () => {
2727
});
2828

2929
describe('Ant Design Pro E2E test', () => {
30-
const testPage = path => async () => {
30+
const testPage = (path) => async () => {
3131
await page.goto(`${BASE_URL}${path}`);
3232
await page.waitForSelector('footer', {
3333
timeout: 2000,
@@ -39,7 +39,7 @@ describe('Ant Design Pro E2E test', () => {
3939
};
4040

4141
const routers = formatter(RouterConfig);
42-
routers.forEach(route => {
42+
routers.forEach((route) => {
4343
it(`test pages ${route}`, testPage(route));
4444
});
4545
});

example/src/global.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (pwa) {
2525
// Send skip-waiting event to waiting SW with MessageChannel
2626
await new Promise((resolve, reject) => {
2727
const channel = new MessageChannel();
28-
channel.port1.onmessage = msgEvent => {
28+
channel.port1.onmessage = (msgEvent) => {
2929
if (msgEvent.data.error) {
3030
reject(msgEvent.data.error);
3131
} else {
@@ -62,20 +62,20 @@ if (pwa) {
6262
// unregister service worker
6363
const { serviceWorker } = navigator;
6464
if (serviceWorker.getRegistrations) {
65-
serviceWorker.getRegistrations().then(sws => {
66-
sws.forEach(sw => {
65+
serviceWorker.getRegistrations().then((sws) => {
66+
sws.forEach((sw) => {
6767
sw.unregister();
6868
});
6969
});
7070
}
71-
serviceWorker.getRegistration().then(sw => {
71+
serviceWorker.getRegistration().then((sw) => {
7272
if (sw) sw.unregister();
7373
});
7474

7575
// remove all caches
7676
if (window.caches && window.caches.keys) {
77-
caches.keys().then(keys => {
78-
keys.forEach(key => {
77+
caches.keys().then((keys) => {
78+
keys.forEach((key) => {
7979
caches.delete(key);
8080
});
8181
});

example/src/layouts/BasicLayout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
5454
*/
5555

5656
const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
57-
menuList.map(item => {
57+
menuList.map((item) => {
5858
const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
5959
return Authorized.check(item.authority, localItem, null) as MenuDataItem;
6060
});
@@ -111,7 +111,7 @@ const footerRender: BasicLayoutProps['footerRender'] = () => {
111111
);
112112
};
113113

114-
const BasicLayout: React.FC<BasicLayoutProps> = props => {
114+
const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
115115
const {
116116
dispatch,
117117
children,

example/src/layouts/UserLayout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface UserLayoutProps extends ConnectProps {
1515
};
1616
}
1717

18-
const UserLayout: React.FC<UserLayoutProps> = props => {
18+
const UserLayout: React.FC<UserLayoutProps> = (props) => {
1919
const {
2020
route = {
2121
routes: [],

example/src/models/global.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const GlobalModel: GlobalModelType = {
4848
payload: data,
4949
});
5050
const unreadCount: number = yield select(
51-
(state: ConnectState) => state.global.notices.filter(item => !item.read).length,
51+
(state: ConnectState) => state.global.notices.filter((item) => !item.read).length,
5252
);
5353
yield put({
5454
type: 'user/changeNotifyCount',
@@ -65,7 +65,7 @@ const GlobalModel: GlobalModelType = {
6565
});
6666
const count: number = yield select((state: ConnectState) => state.global.notices.length);
6767
const unreadCount: number = yield select(
68-
(state: ConnectState) => state.global.notices.filter(item => !item.read).length,
68+
(state: ConnectState) => state.global.notices.filter((item) => !item.read).length,
6969
);
7070
yield put({
7171
type: 'user/changeNotifyCount',
@@ -77,7 +77,7 @@ const GlobalModel: GlobalModelType = {
7777
},
7878
*changeNoticeReadState({ payload }, { put, select }) {
7979
const notices: NoticeItem[] = yield select((state: ConnectState) =>
80-
state.global.notices.map(item => {
80+
state.global.notices.map((item) => {
8181
const notice = { ...item };
8282
if (notice.id === payload) {
8383
notice.read = true;
@@ -95,7 +95,7 @@ const GlobalModel: GlobalModelType = {
9595
type: 'user/changeNotifyCount',
9696
payload: {
9797
totalCount: notices.length,
98-
unreadCount: notices.filter(item => !item.read).length,
98+
unreadCount: notices.filter((item) => !item.read).length,
9999
},
100100
});
101101
},

example/src/models/setting.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface SettingModelType {
99
};
1010
}
1111

12-
const updateColorWeak: (colorWeak: boolean) => void = colorWeak => {
12+
const updateColorWeak: (colorWeak: boolean) => void = (colorWeak) => {
1313
const root = document.getElementById('root');
1414
if (root) {
1515
root.className = colorWeak ? 'colorWeak' : '';

example/src/pages/DashboardAnalysis/_mock.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ const radarTitleMap = {
167167
contribute: '贡献',
168168
hot: '热度',
169169
};
170-
radarOriginData.forEach(item => {
171-
Object.keys(item).forEach(key => {
170+
radarOriginData.forEach((item) => {
171+
Object.keys(item).forEach((key) => {
172172
if (key !== 'name') {
173173
radarData.push({
174174
name: item.name,

example/src/pages/DashboardAnalysis/components/Charts/Gauge/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if (Shape.registerShape) {
6565
});
6666
}
6767

68-
const Gauge: React.FC<GaugeProps> = props => {
68+
const Gauge: React.FC<GaugeProps> = (props) => {
6969
const {
7070
title,
7171
height = 1,

example/src/pages/DashboardAnalysis/components/Charts/MiniArea/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface MiniAreaProps {
2828
}[];
2929
}
3030

31-
const MiniArea: React.FC<MiniAreaProps> = props => {
31+
const MiniArea: React.FC<MiniAreaProps> = (props) => {
3232
const {
3333
height = 1,
3434
data = [],

example/src/pages/DashboardAnalysis/components/Charts/MiniBar/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface MiniBarProps {
1515
style?: React.CSSProperties;
1616
}
1717

18-
const MiniBar: React.FC<MiniBarProps> = props => {
18+
const MiniBar: React.FC<MiniBarProps> = (props) => {
1919
const { height = 0, forceFit = true, color = '#1890FF', data = [] } = props;
2020

2121
const scale = {

example/src/pages/DashboardAnalysis/components/Charts/Pie/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ class Pie extends Component<PieProps, PieState> {
143143
const { legendData } = this.state;
144144
legendData[i] = newItem;
145145

146-
const filteredLegendData = legendData.filter(l => l.checked).map(l => l.x);
146+
const filteredLegendData = legendData.filter((l) => l.checked).map((l) => l.x);
147147

148148
if (this.chart) {
149-
this.chart.filter('x', val => filteredLegendData.indexOf(`${val}`) > -1);
149+
this.chart.filter('x', (val) => filteredLegendData.indexOf(`${val}`) > -1);
150150
}
151151

152152
this.setState({

example/src/pages/DashboardAnalysis/components/Charts/TimelineChart/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface TimelineChartProps {
2020
borderWidth?: number;
2121
}
2222

23-
const TimelineChart: React.FC<TimelineChartProps> = props => {
23+
const TimelineChart: React.FC<TimelineChartProps> = (props) => {
2424
const {
2525
title,
2626
height = 400,

example/src/pages/DashboardAnalysis/components/Charts/WaterWave/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ class WaterWave extends Component<WaterWaveProps> {
213213
return (
214214
<div
215215
className={styles.waterWave}
216-
ref={n => (this.root = n)}
216+
ref={(n) => (this.root = n)}
217217
style={{ transform: `scale(${radio})` }}
218218
>
219219
<div style={{ width: height, height, overflow: 'hidden' }}>
220220
<canvas
221221
className={styles.waterWaveCanvasWrapper}
222-
ref={n => (this.node = n)}
222+
ref={(n) => (this.node = n)}
223223
width={height * 2}
224224
height={height * 2}
225225
/>

example/src/pages/DashboardAnalysis/components/OfflineData.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const OfflineData = ({
5959
}) => (
6060
<Card loading={loading} className={styles.offlineCard} bordered={false} style={{ marginTop: 32 }}>
6161
<Tabs activeKey={activeKey} onChange={handleTabChange}>
62-
{offlineData.map(shop => (
62+
{offlineData.map((shop) => (
6363
<TabPane tab={<CustomTab data={shop} currentTabKey={activeKey} />} key={shop.name}>
6464
<div style={{ padding: '0 24px' }}>
6565
<TimelineChart

example/src/pages/DashboardAnalysis/components/ProportionSales.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const ProportionSales = ({
6262
subTitle={<FormattedMessage id="dashboardanalysis.analysis.sales" defaultMessage="Sales" />}
6363
total={() => <Yuan>{salesPieData.reduce((pre, now) => now.y + pre, 0)}</Yuan>}
6464
data={salesPieData}
65-
valueFormat={value => <Yuan>{value}</Yuan>}
65+
valueFormat={(value) => <Yuan>{value}</Yuan>}
6666
height={248}
6767
lineWidth={4}
6868
/>

example/src/pages/DashboardAnalysis/components/TopSearch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const TopSearch = ({
131131
</Col>
132132
</Row>
133133
<Table<any>
134-
rowKey={record => record.index}
134+
rowKey={(record) => record.index}
135135
size="small"
136136
columns={columns}
137137
dataSource={searchData}

example/src/pages/DashboardAnalysis/utils/Yuan.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class Yuan extends React.Component<{
2626
render() {
2727
return (
2828
<span
29-
ref={ref => {
29+
ref={(ref) => {
3030
this.main = ref;
3131
}}
3232
/>

example/src/pages/FormAdvancedForm/components/FooterToolbar/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class FooterToolbar extends Component<FooterToolbarProps> {
3131
const { children, className, extra, ...restProps } = this.props;
3232
return (
3333
<RouteContext.Consumer>
34-
{value => (
34+
{(value) => (
3535
<div
3636
className={classNames(className, styles.toolbar)}
3737
style={{ width: this.getWidth(value), transition: '0.3s all' }}

0 commit comments

Comments
 (0)