fix: lint:es

This commit is contained in:
orzyyyy 2019-08-02 17:59:42 +08:00
parent 3bfebcaf11
commit ac3f319ad2
12 changed files with 48 additions and 27 deletions

View File

@ -81,7 +81,7 @@ describe('Form', () => {
myForm.setFields({
account: {
errors: [<div>Error 1</div>, <div>Error 2</div>],
errors: [<div key="error-1">Error 1</div>, <div key="error-2">Error 2</div>],
},
});

View File

@ -109,7 +109,11 @@ describe('List Item Layout', () => {
<List
dataSource={data}
renderItem={item => (
<List.Item key={item.title} actions={[<a>Action</a>]} extra={<span>{item.extra}</span>}>
<List.Item
key={item.title}
actions={[<a key="action">Action</a>]}
extra={<span>{item.extra}</span>}
>
<List.Item.Meta
title={<a href={item.href}>{item.title}</a>}
description={item.description}

View File

@ -118,7 +118,9 @@ describe('Mention', () => {
if (process.env.REACT === '15') {
return;
}
const wrapper = mount(<Mention defaultSuggestions={[<Mention.Nav value="light" />]} />);
const wrapper = mount(
<Mention defaultSuggestions={[<Mention.Nav key="light" value="light" />]} />,
);
wrapper.find('DraftEditorContents').simulate('focus');
const ed = wrapper.find('.public-DraftEditor-content');
ed.simulate('beforeInput', { data: '@l' });

View File

@ -529,12 +529,13 @@ describe('Table.filter', () => {
});
it('renders custom filter icon correctly', () => {
const filterIcon = filtered => <span>{filtered ? 'filtered' : 'unfiltered'}</span>;
const wrapper = mount(
createTable({
columns: [
{
...column,
filterIcon: filtered => <span>{filtered ? 'filtered' : 'unfiltered'}</span>,
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 }) => (
<input onChange={e => setSelectedKeys([e.target.value])} />
);
const wrapper = mount(
createTable({
onChange,
@ -633,9 +637,7 @@ describe('Table.filter', () => {
title: 'Name',
dataIndex: 'name',
key: 'name',
filterDropdown: ({ setSelectedKeys }) => (
<input onChange={e => setSelectedKeys([e.target.value])} />
),
filterDropdown,
},
],
}),

View File

@ -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 }) => <div className="custom-title">{sortOrder}</div>;
const columns = [
{
title: ({ sortOrder }) => <div className="custom-title">{sortOrder}</div>,
title,
key: 'group',
sorter: true,
},

View File

@ -4,4 +4,6 @@
*/
import React from 'react';
export default () => <div />;
const AppShell = () => <div />;
export default AppShell;

View File

@ -1,3 +1,5 @@
import React from 'react';
export default ({ children }) => <div className="browser-mockup with-url">{children}</div>;
const BrowserFrame = ({ children }) => <div className="browser-mockup with-url">{children}</div>;
export default BrowserFrame;

View File

@ -4,6 +4,6 @@ import ColorBlock from './ColorBlock';
export default function ColorPatterns({ color }) {
return generate(color).map((colorString, i) => (
<ColorBlock color={colorString} index={i + 1} key={i} /> // eslint-disable-line
<ColorBlock color={colorString} index={i + 1} key={colorString} />
));
}

View File

@ -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) => {
<h4>
{menuItem.title === 'Components' ? (
<FormattedMessage id="app.header.menu.components" />
) : menuItem.title}
) : (
menuItem.title
)}
<span className="menu-antd-components-count">{count}</span>
</h4>
);
@ -138,10 +140,7 @@ export default class MainContent extends Component {
return menuItems.map(menuItem => {
if (menuItem.children) {
return (
<SubMenu
title={getSubMenuTitle(menuItem)}
key={menuItem.title}
>
<SubMenu title={getSubMenuTitle(menuItem)} key={menuItem.title}>
{menuItem.children.map(child => {
if (child.type === 'type') {
return (
@ -312,7 +311,10 @@ export default class MainContent extends Component {
<Row>
{isMobile ? (
<MobileMenu
iconChild={[<Icon type="menu-unfold" />, <Icon type="menu-fold" />]}
iconChild={[
<Icon key="menu-unfold" type="menu-unfold" />,
<Icon key="menu-fold" type="menu-fold" />,
]}
key="Mobile-menu"
wrapperClassName="drawer-wrapper"
>

View File

@ -1,6 +1,6 @@
import React from 'react';
export default ({ prev, next }) => (
const PrevAndNext = ({ prev, next }) => (
<section className="prev-next-nav">
{prev
? React.cloneElement(prev.props.children || prev.children[0], {
@ -14,3 +14,5 @@ export default ({ prev, next }) => (
: null}
</section>
);
export default PrevAndNext;

View File

@ -41,6 +41,7 @@ const page2Data = [
const svgBgChild = [
<svg
key="svg-0"
width="100%"
height="100%"
viewBox="0 0 1401 1109"
@ -85,6 +86,7 @@ const svgBgChild = [
</g>
</svg>,
<svg
key="svg-1"
width="1311px"
height="920px"
viewBox="0 0 1311 920"

View File

@ -30,20 +30,20 @@ const page3Data = [
];
const svgBg = [
<circle stroke="#13C2C2" cx="530" cy="195" r="5" />,
<circle fillOpacity="0.4" fill="#9EE6E6" cx="606" cy="76" r="3" />,
<circle stroke="#13C2C2" cx="165" cy="540" r="5" />,
<circle stroke="#CED4D9" cx="701.5" cy="650" r="3.5" />,
<circle stroke="#F5222D" cx="526.5" cy="381.5" r="3.5" />,
<circle fillOpacity="0.4" fill="#9EE6E6" cx="944" cy="251" r="5" />,
<g transform="translate(0, 180)">
<circle stroke="#13C2C2" cx="530" cy="195" r="5" key="13C2C2-530-195" />,
<circle fillOpacity="0.4" fill="#9EE6E6" cx="606" cy="76" r="3" key="9EE6E6-606-76" />,
<circle stroke="#13C2C2" cx="165" cy="540" r="5" key="13C2C2-165-540" />,
<circle stroke="#CED4D9" cx="701.5" cy="650" r="3.5" key="CED4D9-701-650" />,
<circle stroke="#F5222D" cx="526.5" cy="381.5" r="3.5" key="F5222D-526-381" />,
<circle fillOpacity="0.4" fill="#9EE6E6" cx="944" cy="251" r="5" key="9EE6E6-944-251" />,
<g transform="translate(0, 180)" key="g-180">
<path
d="M1182.79367,448.230356 L1186.00213,453.787581 C1186.55442,454.744166 1186.22667,455.967347 1185.27008,456.519632 C1184.96604,456.695168 1184.62116,456.787581 1184.27008,456.787581 L1177.85315,456.787581 C1176.74858,456.787581 1175.85315,455.89215 1175.85315,454.787581 C1175.85315,454.436507 1175.94556,454.091619 1176.1211,453.787581 L1179.32957,448.230356 C1179.88185,447.273771 1181.10503,446.946021 1182.06162,447.498305 C1182.36566,447.673842 1182.61813,447.926318 1182.79367,448.230356 Z"
stroke="#CED4D9"
transform="translate(1181.061784, 452.008801) rotate(40.000000) translate(-1181.061784, -452.008801) "
/>
</g>,
<g transform="translate(0, 100)">
<g transform="translate(0, 100)" key="g-100">
<path
d="M1376.79367,204.230356 L1380.00213,209.787581 C1380.55442,210.744166 1380.22667,211.967347 1379.27008,212.519632 C1378.96604,212.695168 1378.62116,212.787581 1378.27008,212.787581 L1371.85315,212.787581 C1370.74858,212.787581 1369.85315,211.89215 1369.85315,210.787581 C1369.85315,210.436507 1369.94556,210.091619 1370.1211,209.787581 L1373.32957,204.230356 C1373.88185,203.273771 1375.10503,202.946021 1376.06162,203.498305 C1376.36566,203.673842 1376.61813,203.926318 1376.79367,204.230356 Z"
stroke="#2F54EB"
@ -51,6 +51,7 @@ const svgBg = [
/>
</g>,
<rect
key="1D39C4-942-222"
strokeOpacity="0.4"
stroke="#1D39C4"
transform="translate(949.801502, 129.801502) rotate(30.000000) translate(-949.801502, -129.801502) "
@ -61,6 +62,7 @@ const svgBg = [
rx="1"
/>,
<rect
key="CED4D9-107-254"
stroke="#CED4D9"
transform="translate(111.673081, 158.673081) rotate(30.000000) translate(-111.673081, -158.673081) "
x="107.288047"