Skip to content

Commit

Permalink
💄 fix eslint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Nov 28, 2018
1 parent 647ba19 commit 83c192e
Show file tree
Hide file tree
Showing 313 changed files with 1,123 additions and 731 deletions.
31 changes: 10 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,18 @@ const eslintrc = {
'babel',
],
rules: {
'func-names': 0,
'arrow-body-style': 0,
'react/sort-comp': 0,
'react/prop-types': 0,
'react/jsx-first-prop-new-line': 0,
'react/jsx-one-expression-per-line': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'import/no-extraneous-dependencies': ['error', {
devDependencies: ['site/**', 'tests/**', 'scripts/**', '**/*.test.js', '**/__tests__/*', '*.config.js', '**/*.md'],
}],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.md'] }],
'import/extensions': 0,
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0,
'prefer-destructuring': 0,
'no-param-reassign': 0,
'no-return-assign': 0,
'max-len': 0,
'consistent-return': 0,
'no-redeclare': 0,
'react/require-extension': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/anchor-has-content': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/anchor-is-valid': 0,
'react/no-danger': 0,
'comma-dangle': ['error', 'always-multiline'],
'function-paren-newline': 0,
'object-curly-newline': 0,
'no-restricted-globals': 0,
},
};

Expand All @@ -61,9 +46,13 @@ if (process.env.RUN_ENV === 'DEMO') {
'react/no-access-state-in-setstate': 0,
'react/destructuring-assignment': 0,
'react/no-multi-comp': 0,
'react/prefer-stateless-function': 0,
'jsx-a11y/href-no-hash': 0,
'import/newline-after-import': 0,
'prefer-destructuring': 0, // TODO: remove later
'max-len': 0, // TODO: remove later
'consistent-return': 0, // TODO: remove later
'no-return-assign': 0, // TODO: remove later
'no-param-reassign': 0, // TODO: remove later
'import/no-extraneous-dependencies': 0,
});
}

Expand Down
14 changes: 5 additions & 9 deletions components/affix/__tests__/Affix.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class AffixMounter extends React.Component {
});
}

getTarget = () => {
return this.container;
}
getTarget = () => this.container

render() {
return (
Expand All @@ -34,7 +32,7 @@ class AffixMounter extends React.Component {
>
<Affix
target={() => this.container}
ref={ele => this.affix = ele}
ref={(ele) => { this.affix = ele; }}
{...this.props}
>
<Button type="primary">
Expand All @@ -59,11 +57,9 @@ describe('Affix Render', () => {
});

const scrollTo = (top) => {
wrapper.instance().affix.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => {
return {
bottom: 100, height: 28, left: 0, right: 0, top: 50 - top, width: 195,
};
});
wrapper.instance().affix.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => ({
bottom: 100, height: 28, left: 0, right: 0, top: 50 - top, width: 195,
}));
wrapper.instance().container.scrollTop = top;
events.scroll({
type: 'scroll',
Expand Down
3 changes: 2 additions & 1 deletion components/alert/demo/banner.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ ReactDOM.render(
<br />
<Alert type="error" message="Error text" banner />
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { Alert } from 'antd';

ReactDOM.render(
<Alert message="Success Text" type="success" />,
mountNode);
mountNode
);
````

<style>
Expand Down
5 changes: 3 additions & 2 deletions components/alert/demo/closable.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To show close button.
````jsx
import { Alert } from 'antd';

const onClose = function (e) {
const onClose = (e) => {
console.log(e, 'I was closed.');
};

Expand All @@ -36,5 +36,6 @@ ReactDOM.render(
onClose={onClose}
/>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/close-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ import { Alert } from 'antd';

ReactDOM.render(
<Alert message="Info Text" type="info" closeText="Close Now" />,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/custom-icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ ReactDOM.render(
showIcon
/>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ ReactDOM.render(
type="error"
/>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ ReactDOM.render(
showIcon
/>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/smooth-closed.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ class App extends React.Component {

ReactDOM.render(
<App />,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/alert/demo/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ ReactDOM.render(
<Alert message="Warning Text" type="warning" />
<Alert message="Error Text" type="error" />
</div>,
mountNode);
mountNode
);
````
4 changes: 2 additions & 2 deletions components/anchor/__tests__/Anchor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('Anchor Render', () => {
let anchorInstance = null;
function AnchorUpdate({ href }) {
return (
<Anchor ref={c => anchorInstance = c}>
<Anchor ref={(c) => { anchorInstance = c; }}>
<Link href={href} title="API" />
</Anchor>
);
Expand All @@ -107,7 +107,7 @@ describe('Anchor Render', () => {
it('Anchor onClick event', () => {
let event;
let link;
const handleClick = (...arg) => ([event, link] = arg);
const handleClick = (...arg) => { [event, link] = arg; };

const href = '#API';
const title = 'API';
Expand Down
3 changes: 2 additions & 1 deletion components/anchor/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```

<style>
Expand Down
3 changes: 2 additions & 1 deletion components/anchor/demo/onClick.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```
3 changes: 2 additions & 1 deletion components/anchor/demo/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```
4 changes: 1 addition & 3 deletions components/auto-complete/demo/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class Complete extends React.Component {

render() {
const { result } = this.state;
const children = result.map((email) => {
return <Option key={email}>{email}</Option>;
});
const children = result.map(email => <Option key={email}>{email}</Option>);
return (
<AutoComplete
style={{ width: 200 }}
Expand Down
4 changes: 3 additions & 1 deletion components/auto-complete/demo/uncertain-category.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/s
Basic Usage, set datasource of autocomplete with `dataSource` property.

````jsx
import { Icon, Button, Input, AutoComplete } from 'antd';
import {
Icon, Button, Input, AutoComplete,
} from 'antd';

const Option = AutoComplete.Option;

Expand Down
3 changes: 2 additions & 1 deletion components/avatar/demo/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ ReactDOM.render(
<Badge dot><Avatar shape="square" icon="user" /></Badge>
</span>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/avatar/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ ReactDOM.render(
<Avatar shape="square" size="small" icon="user" />
</div>
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
3 changes: 2 additions & 1 deletion components/avatar/demo/type.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ ReactDOM.render(
<Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>U</Avatar>
<Avatar style={{ backgroundColor: '#87d068' }} icon="user" />
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
3 changes: 2 additions & 1 deletion components/badge/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
4 changes: 3 additions & 1 deletion components/badge/demo/change.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ title:
The count will be animated as it changes.

````jsx
import { Badge, Button, Icon, Switch } from 'antd';
import {
Badge, Button, Icon, Switch,
} from 'antd';

const ButtonGroup = Button.Group;

Expand Down
3 changes: 2 additions & 1 deletion components/badge/demo/dot.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ ReactDOM.render(
<a href="#">Link something</a>
</Badge>
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
3 changes: 2 additions & 1 deletion components/badge/demo/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ ReactDOM.render(
<span className="head-example" />
</Badge>
</a>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/badge/demo/no-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ ReactDOM.render(
<Badge count={4} style={{ backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset' }} />
<Badge count={109} style={{ backgroundColor: '#52c41a' }} />
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
3 changes: 2 additions & 1 deletion components/badge/demo/overflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/badge/demo/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ ReactDOM.render(
<br />
<Badge status="warning" text="Warning" />
</div>,
mountNode);
mountNode
);
````
3 changes: 2 additions & 1 deletion components/badge/demo/title.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````

<style>
Expand Down
4 changes: 3 additions & 1 deletion components/breadcrumb/__tests__/router.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import { Route, Switch, Link, withRouter, MemoryRouter } from 'react-router-dom';
import {
Route, Switch, Link, withRouter, MemoryRouter,
} from 'react-router-dom';
import { mount } from 'enzyme';
import Breadcrumb from '../index';

Expand Down
3 changes: 2 additions & 1 deletion components/breadcrumb/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ ReactDOM.render(
<Breadcrumb.Item><a href="">Application List</a></Breadcrumb.Item>
<Breadcrumb.Item>An Application</Breadcrumb.Item>
</Breadcrumb>,
mountNode);
mountNode
);
````
7 changes: 5 additions & 2 deletions components/breadcrumb/demo/router-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ title:
Used together with `react-router@4` or other router.

````jsx
import { HashRouter as Router, Route, Switch, Link, withRouter } from 'react-router-dom';
import {
HashRouter as Router, Route, Switch, Link, withRouter,
} from 'react-router-dom';
import { Breadcrumb, Alert } from 'antd';

const Apps = () => (
Expand Down Expand Up @@ -77,7 +79,8 @@ ReactDOM.render(
<Router>
<Home />
</Router>,
mountNode);
mountNode
);
````

````css
Expand Down
7 changes: 5 additions & 2 deletions components/breadcrumb/demo/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ title:
Used together with `react-router@2` `react-router@3`.

````jsx
import { Router, Route, Link, hashHistory } from 'react-router';
import {
Router, Route, Link, hashHistory,
} from 'react-router';
import { Breadcrumb, Alert } from 'antd';

const Apps = () => (
Expand Down Expand Up @@ -52,7 +54,8 @@ ReactDOM.render(
</Route>
</Route>
</Router>,
mountNode);
mountNode
);
````

````css
Expand Down
Loading

0 comments on commit 83c192e

Please sign in to comment.