From ac3f319ad2015b1d5fa8f4cc81e5198488303591 Mon Sep 17 00:00:00 2001 From: orzyyyy Date: Fri, 2 Aug 2019 17:59:42 +0800 Subject: [PATCH] fix: lint:es --- components/form/__tests__/message.test.js | 2 +- components/list/__tests__/Item.test.js | 6 +++++- components/mention/__tests__/index.test.js | 4 +++- .../table/__tests__/Table.filter.test.js | 10 ++++++---- .../table/__tests__/Table.sorter.test.js | 3 ++- site/theme/template/AppShell.jsx | 4 +++- site/theme/template/BrowserFrame.jsx | 4 +++- site/theme/template/Color/ColorPatterns.jsx | 2 +- site/theme/template/Content/MainContent.jsx | 16 +++++++++------- site/theme/template/Content/PrevAndNext.jsx | 4 +++- site/theme/template/Home/Page2.jsx | 2 ++ site/theme/template/Home/Page3.jsx | 18 ++++++++++-------- 12 files changed, 48 insertions(+), 27 deletions(-) diff --git a/components/form/__tests__/message.test.js b/components/form/__tests__/message.test.js index fd313e424b..ecd76dfeab 100644 --- a/components/form/__tests__/message.test.js +++ b/components/form/__tests__/message.test.js @@ -81,7 +81,7 @@ describe('Form', () => { myForm.setFields({ account: { - errors: [
Error 1
,
Error 2
], + errors: [
Error 1
,
Error 2
], }, }); diff --git a/components/list/__tests__/Item.test.js b/components/list/__tests__/Item.test.js index a697a93df3..1ae29e5f52 100644 --- a/components/list/__tests__/Item.test.js +++ b/components/list/__tests__/Item.test.js @@ -109,7 +109,11 @@ describe('List Item Layout', () => { ( - Action]} extra={{item.extra}}> + Action]} + extra={{item.extra}} + > {item.title}} description={item.description} diff --git a/components/mention/__tests__/index.test.js b/components/mention/__tests__/index.test.js index 8e71cfac24..7c81d00b1c 100644 --- a/components/mention/__tests__/index.test.js +++ b/components/mention/__tests__/index.test.js @@ -118,7 +118,9 @@ describe('Mention', () => { if (process.env.REACT === '15') { return; } - const wrapper = mount(]} />); + const wrapper = mount( + ]} />, + ); wrapper.find('DraftEditorContents').simulate('focus'); const ed = wrapper.find('.public-DraftEditor-content'); ed.simulate('beforeInput', { data: '@l' }); diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js index 48c92ad2cc..33feeafe0e 100644 --- a/components/table/__tests__/Table.filter.test.js +++ b/components/table/__tests__/Table.filter.test.js @@ -529,12 +529,13 @@ describe('Table.filter', () => { }); it('renders custom filter icon correctly', () => { + const filterIcon = filtered => {filtered ? 'filtered' : 'unfiltered'}; const wrapper = mount( createTable({ columns: [ { ...column, - filterIcon: filtered => {filtered ? 'filtered' : 'unfiltered'}, + filterIcon, }, ], }), @@ -625,6 +626,9 @@ describe('Table.filter', () => { // https://github.com/ant-design/ant-design/issues/17833 it('should not trigger onChange when bluring custom filterDropdown', () => { const onChange = jest.fn(); + const filterDropdown = ({ setSelectedKeys }) => ( + setSelectedKeys([e.target.value])} /> + ); const wrapper = mount( createTable({ onChange, @@ -633,9 +637,7 @@ describe('Table.filter', () => { title: 'Name', dataIndex: 'name', key: 'name', - filterDropdown: ({ setSelectedKeys }) => ( - setSelectedKeys([e.target.value])} /> - ), + filterDropdown, }, ], }), diff --git a/components/table/__tests__/Table.sorter.test.js b/components/table/__tests__/Table.sorter.test.js index 7d3abdfc79..f121a6ad70 100644 --- a/components/table/__tests__/Table.sorter.test.js +++ b/components/table/__tests__/Table.sorter.test.js @@ -169,9 +169,10 @@ describe('Table.sorter', () => { // https://github.com/ant-design/ant-design/issues/11246#issuecomment-405009167 it('Allow column title as render props with sortOrder argument', () => { + const title = ({ sortOrder }) =>
{sortOrder}
; const columns = [ { - title: ({ sortOrder }) =>
{sortOrder}
, + title, key: 'group', sorter: true, }, diff --git a/site/theme/template/AppShell.jsx b/site/theme/template/AppShell.jsx index aa062436f6..1accbf31c5 100644 --- a/site/theme/template/AppShell.jsx +++ b/site/theme/template/AppShell.jsx @@ -4,4 +4,6 @@ */ import React from 'react'; -export default () =>
; +const AppShell = () =>
; + +export default AppShell; diff --git a/site/theme/template/BrowserFrame.jsx b/site/theme/template/BrowserFrame.jsx index 0ed0b6bf57..642e372890 100644 --- a/site/theme/template/BrowserFrame.jsx +++ b/site/theme/template/BrowserFrame.jsx @@ -1,3 +1,5 @@ import React from 'react'; -export default ({ children }) =>
{children}
; +const BrowserFrame = ({ children }) =>
{children}
; + +export default BrowserFrame; diff --git a/site/theme/template/Color/ColorPatterns.jsx b/site/theme/template/Color/ColorPatterns.jsx index d2fb54b1b4..feaf6dcc21 100644 --- a/site/theme/template/Color/ColorPatterns.jsx +++ b/site/theme/template/Color/ColorPatterns.jsx @@ -4,6 +4,6 @@ import ColorBlock from './ColorBlock'; export default function ColorPatterns({ color }) { return generate(color).map((colorString, i) => ( - // eslint-disable-line + )); } diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index 42afcd71f9..62ca049c8b 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -57,7 +57,7 @@ const getSideBarOpenKeys = nextProps => { return shouldOpenKeys; }; -const getSubMenuTitle = (menuItem) => { +const getSubMenuTitle = menuItem => { if (menuItem.title !== 'Components') { return menuItem.title; } @@ -71,7 +71,9 @@ const getSubMenuTitle = (menuItem) => {

{menuItem.title === 'Components' ? ( - ) : menuItem.title} + ) : ( + menuItem.title + )} {count}

); @@ -138,10 +140,7 @@ export default class MainContent extends Component { return menuItems.map(menuItem => { if (menuItem.children) { return ( - + {menuItem.children.map(child => { if (child.type === 'type') { return ( @@ -312,7 +311,10 @@ export default class MainContent extends Component { {isMobile ? ( , ]} + iconChild={[ + , + , + ]} key="Mobile-menu" wrapperClassName="drawer-wrapper" > diff --git a/site/theme/template/Content/PrevAndNext.jsx b/site/theme/template/Content/PrevAndNext.jsx index fa6dfe34f5..7f9a1083ad 100644 --- a/site/theme/template/Content/PrevAndNext.jsx +++ b/site/theme/template/Content/PrevAndNext.jsx @@ -1,6 +1,6 @@ import React from 'react'; -export default ({ prev, next }) => ( +const PrevAndNext = ({ prev, next }) => (
{prev ? React.cloneElement(prev.props.children || prev.children[0], { @@ -14,3 +14,5 @@ export default ({ prev, next }) => ( : null}
); + +export default PrevAndNext; diff --git a/site/theme/template/Home/Page2.jsx b/site/theme/template/Home/Page2.jsx index 1b2b5c01cb..d934a28ce1 100644 --- a/site/theme/template/Home/Page2.jsx +++ b/site/theme/template/Home/Page2.jsx @@ -41,6 +41,7 @@ const page2Data = [ const svgBgChild = [ , , - , - , - , - , - , - + , + , + , + , + , + , + , - + , ,