upgrade eslint-config, close #2811

This commit is contained in:
afc163 2016-08-23 21:00:35 +08:00
parent ca906a0f9d
commit 77949bb9e3
39 changed files with 142 additions and 135 deletions

View File

@ -28,7 +28,9 @@ const eslintrc = {
'react/sort-comp': 0,
'react/prop-types': 0,
'react/jsx-first-prop-new-line': 0,
"react/jsx-filename-extension": [1, { extensions: ['.js', '.jsx', '.md'] }],
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0,
'no-param-reassign': 0,
'no-return-assign': 0,
'max-len': 0,
@ -50,6 +52,8 @@ if (process.env.RUN_ENV === 'DEMO') {
'prefer-rest-params': 0,
'react/no-multi-comp': 0,
'react/prefer-es6-class': 0,
'jsx-a11y/href-no-hash': 0,
'import/newline-after-import': 0,
});
}

View File

@ -63,7 +63,7 @@ export default class Affix extends React.Component<AffixProps, any> {
offsetTop: React.PropTypes.number,
offsetBottom: React.PropTypes.number,
target: React.PropTypes.func,
}
};
static defaultProps = {
target() {

View File

@ -1,6 +1,6 @@
---
order: 0
title:
title:
zh-CN: 基本使用
en-US: Basic Usage
---

View File

@ -1,6 +1,6 @@
---
order: 2
title:
title:
zh-CN: 自定义选项
en-US: Customized
---
@ -16,6 +16,7 @@ Items in dataSource could be an `AutoComplete.Option`.
````jsx
import { AutoComplete } from 'antd';
const Option = AutoComplete.Option;
const Complete = React.createClass({

View File

@ -18,10 +18,10 @@ import { Badge } from 'antd';
ReactDOM.render(<div>
<Badge count={99}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
<Badge count={200}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
</div>, mountNode);
````

View File

@ -18,7 +18,7 @@ import { Badge } from 'antd';
ReactDOM.render(
<Badge count={5}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
, mountNode);
````

View File

@ -44,10 +44,10 @@ const Test = React.createClass({
return (
<div>
<Badge count={this.state.count}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
<Badge dot={this.state.show}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
<div style={{ marginTop: 10 }}>
<ButtonGroup>

View File

@ -19,7 +19,7 @@ import { Badge } from 'antd';
ReactDOM.render(
<a href="#">
<Badge count={5}>
<span className="head-example"></span>
<span className="head-example" />
</Badge>
</a>
, mountNode);

View File

@ -18,10 +18,10 @@ import { Badge } from 'antd';
ReactDOM.render(<div>
<Badge count={99} overflowCount={10}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
<Badge count={1000} overflowCount={999}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
</div>, mountNode);
````

View File

@ -18,7 +18,7 @@ import { Badge } from 'antd';
ReactDOM.render(
<div>
<label>Status: &nbsp;</label>
<div>Status: &nbsp;</div>
<Badge status="success" />
<Badge status="error" />
<Badge status="default" />

View File

@ -14,7 +14,7 @@ Badge normally appears in proximity to notification or head picture with eye-cat
```jsx
<Badge count={5}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
```

View File

@ -15,7 +15,7 @@ english: Badge
```jsx
<Badge count={5}>
<a href="#" className="head-example"></a>
<a href="#" className="head-example" />
</Badge>
```

View File

@ -19,13 +19,13 @@ import { Menu, Dropdown, Icon } from 'antd';
const menu = (
<Menu>
<Menu.Item>
<a target="_blank" href="http://www.alipay.com/">第一个菜单项</a>
<a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">第一个菜单项</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" href="http://www.taobao.com/">第二个菜单项</a>
<a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">第二个菜单项</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" href="http://www.tmall.com/">第三个菜单项</a>
<a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">第三个菜单项</a>
</Menu.Item>
</Menu>
);

View File

@ -19,10 +19,10 @@ import { Menu, Dropdown, Icon } from 'antd';
const menu = (
<Menu>
<Menu.Item key="0">
<a target="_blank" href="http://www.alipay.com/">第一个菜单项</a>
<a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">第一个菜单项</a>
</Menu.Item>
<Menu.Item key="1">
<a target="_blank" href="http://www.taobao.com/">第二个菜单项</a>
<a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">第二个菜单项</a>
</Menu.Item>
<Menu.Divider />
<Menu.Item key="3" disabled>第三个菜单项(不可用)</Menu.Item>

View File

@ -1,6 +1,6 @@
---
order: 11
title:
title:
zh-CN: 表单校验
en-US: Basic validate
---
@ -31,7 +31,7 @@ let BasicDemo = React.createClass({
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((errors, values) => {
if (!!errors) {
if (errors) {
console.log('Errors in form!!!');
return;
}

View File

@ -1,6 +1,6 @@
---
order: 13
title:
title:
zh-CN: 自定义校验规则
en-US: Customized validation
---
@ -40,7 +40,7 @@ let Demo = React.createClass({
handleSubmit() {
this.props.form.validateFields((errors, values) => {
if (!!errors) {
if (errors) {
console.log('Errors in form!!!');
return;
}
@ -60,17 +60,14 @@ let Demo = React.createClass({
} else {
strength = 'H';
}
if (type === 'pass') {
this.setState({ passBarShow: true, passStrength: strength });
} else {
this.setState({ rePassBarShow: true, rePassStrength: strength });
}
this.setState({
[`${type}BarShow`]: true,
[`${type}Strength`]: strength,
});
} else {
if (type === 'pass') {
this.setState({ passBarShow: false });
} else {
this.setState({ rePassBarShow: false });
}
this.setState({
[`${type}BarShow`]: false,
});
}
},
@ -113,9 +110,9 @@ let Demo = React.createClass({
return (
<div>
<ul className={classSet}>
<li className="ant-pwd-strength-item ant-pwd-strength-item-1"></li>
<li className="ant-pwd-strength-item ant-pwd-strength-item-2"></li>
<li className="ant-pwd-strength-item ant-pwd-strength-item-3"></li>
<li className="ant-pwd-strength-item ant-pwd-strength-item-1" />
<li className="ant-pwd-strength-item ant-pwd-strength-item-2" />
<li className="ant-pwd-strength-item ant-pwd-strength-item-3" />
<span className="ant-form-text">
{level[strength]}
</span>

View File

@ -1,6 +1,6 @@
---
order: 12
title:
title:
zh-CN: 校验其他组件
en-US: Others components related to validation
---
@ -37,7 +37,7 @@ let Demo = React.createClass({
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFieldsAndScroll((errors, values) => {
if (!!errors) {
if (errors) {
console.log('Errors in form!!!');
return;
}

View File

@ -29,7 +29,7 @@ let App = React.createClass({
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((errors, values) => {
if (!!errors) {
if (errors) {
console.log('Errors in form!!!');
return;
}

View File

@ -45,7 +45,7 @@ const App = React.createClass({
</MenuItemGroup>
</SubMenu>
<Menu.Item key="alipay">
<a href="http://www.alipay.com/" target="_blank">导航四 - 链接</a>
<a href="http://www.alipay.com/" target="_blank" rel="noopener noreferrer">导航四 - 链接</a>
</Menu.Item>
</Menu>
);

View File

@ -1,6 +1,6 @@
---
order: 2
title:
title:
zh-CN: 自定义页脚
en-US: Customized footer
---
@ -45,9 +45,11 @@ const Test = React.createClass({
<Button type="primary" onClick={this.showModal}>
Open modal dialog
</Button>
<Modal ref="modal"
<Modal
visible={this.state.visible}
title="Title" onOk={this.handleOk} onCancel={this.handleCancel}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" type="ghost" size="large" onClick={this.handleCancel}>Return</Button>,
<Button key="submit" type="primary" size="large" loading={this.state.loading} onClick={this.handleOk}>

View File

@ -23,18 +23,18 @@ const Test = React.createClass({
const list = this.state.show ? [
<div className="demo-kp" key="a">
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>,
<div className="demo-listBox" key="b">
<div className="demo-list">
<div className="title"></div>
<div className="title" />
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>
</div>,

View File

@ -13,9 +13,9 @@ const Test = React.createClass({
return {
show: true,
items: [
<li key="0"></li>,
<li key="1"></li>,
<li key="2"></li>,
<li key="0" />,
<li key="1" />,
<li key="2" />,
],
};
},
@ -26,7 +26,7 @@ const Test = React.createClass({
},
onAdd() {
const items = this.state.items;
items.push(<li key={Date.now()}></li>);
items.push(<li key={Date.now()} />);
this.setState({
show: true,
items,
@ -51,7 +51,7 @@ const Test = React.createClass({
<div className="demo-content">
<div className="demo-listBox" key="b">
<div className="demo-list">
<div className="title"></div>
<div className="title" />
<QueueAnim component="ul" type={['right', 'left']}>
{this.state.show ? this.state.items : null}
</QueueAnim>

View File

@ -23,18 +23,18 @@ const Test = React.createClass({
const list = this.state.show ? [
<div className="demo-kp" key="a">
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>,
<div className="demo-listBox" key="b">
<div className="demo-list">
<div className="title"></div>
<div className="title" />
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>
</div>,

View File

@ -23,18 +23,18 @@ const Test = React.createClass({
const list = this.state.show ? [
<div className="demo-kp" key="a">
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>,
<div className="demo-listBox" key="b">
<div className="demo-list">
<div className="title"></div>
<div className="title" />
<ul>
<li></li>
<li></li>
<li></li>
<li />
<li />
<li />
</ul>
</div>
</div>,

View File

@ -27,38 +27,38 @@ const Test = React.createClass({
<span>logo</span>
</div>
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="3"></li>
<li key="4"></li>
<li key="0" />
<li key="1" />
<li key="2" />
<li key="3" />
<li key="4" />
</QueueAnim>
</div>,
<QueueAnim className="demo-content" key="content" delay={300}>
<div className="demo-title" key="title">我是标题</div>
<div className="demo-kp" key="b">
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</div>
<div className="demo-title" key="title2">我是标题</div>
<div className="demo-listBox">
<QueueAnim className="demo-list" delay={500}>
<div className="title" key="title3"></div>
<div className="title" key="title3" />
<QueueAnim component="ul" type="bottom" key="li">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="3"></li>
<li key="4"></li>
<li key="0" />
<li key="1" />
<li key="2" />
<li key="3" />
<li key="4" />
</QueueAnim>
</QueueAnim>
</div>
</QueueAnim>,
<QueueAnim delay={1000} type="bottom" key="footerBox">
<div className="demo-footer" key="footer"></div>
<div className="demo-footer" key="footer" />
</QueueAnim>,
] : null;
return (

View File

@ -7,9 +7,9 @@ title: Router 默认进出场
router 组合的进场与出场动画。
````jsx
import { QueueAnim, Menu } from 'antd';
const ReactRouter = require('react-router');
let { Router, Route, Link, hashHistory } = ReactRouter;
import { QueueAnim, Menu } from 'antd';
function App(props) {
const key = props.location.pathname;
@ -40,23 +40,23 @@ function Home() {
<QueueAnim className="demo-content">
<div className="demo-kp" key="a">
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</div>
<div className="demo-kp" key="b">
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</div>
<div className="demo-kp" key="c">
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</div>
</QueueAnim>
@ -70,18 +70,18 @@ function Page1() {
<QueueAnim className="demo-content">
<div className="demo-kp" key="b">
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</div>
<div className="demo-listBox">
<QueueAnim className="demo-list" delay={200}>
<div className="title" key="title3"></div>
<div className="title" key="title3" />
<QueueAnim component="ul" animConfig={{ opacity: [1, 0], translateY: [0, 30], scale: [1, 0.9] }} key="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="0" />
<li key="1" />
<li key="2" />
</QueueAnim>
</QueueAnim>
</div>
@ -96,14 +96,14 @@ function Page2() {
<div className="demo-content">
<div className="demo-listBox">
<QueueAnim className="demo-list">
<div className="title" key="title3"></div>
<div className="title" key="title3" />
<QueueAnim component="ul" animConfig={{ opacity: [1, 0], translateY: [0, 30], scale: [1, 0.9] }} key="li">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="3"></li>
<li key="4"></li>
<li key="5"></li>
<li key="0" />
<li key="1" />
<li key="2" />
<li key="3" />
<li key="4" />
<li key="5" />
</QueueAnim>
</QueueAnim>
</div>

View File

@ -16,7 +16,7 @@ Let's generate 3~6 steps randomly, and proceed to a random step.
````jsx
import { Steps, Button } from 'antd';
const Step = Steps.Step;
const array = Array.apply(null, Array(Math.floor(Math.random() * 3) + 3));
const array = [...Array(Math.floor(Math.random() * 3) + 3)];
const steps = array.map((item, i) => ({
title: `步骤${i + 1}`,
}));

View File

@ -35,9 +35,9 @@ const columns = [{
render: (text, record) => (
<span>
<a href="#">操作一{record.name}</a>
<span className="ant-divider"></span>
<span className="ant-divider" />
<a href="#">操作二</a>
<span className="ant-divider"></span>
<span className="ant-divider" />
<a href="#" className="ant-dropdown-link">
更多 <Icon type="down" />
</a>

View File

@ -44,7 +44,7 @@ const ImageUploadList = React.createClass({
<Icon type="plus" />
<div className="ant-upload-text">上传照片</div>
</Upload>
<a href="https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png" target="_blank" className="upload-example">
<a href="https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png" target="_blank" rel="noopener noreferrer" className="upload-example">
<img alt="example" src="https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png" />
<span>示例</span>
</a>

View File

@ -76,7 +76,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
className={`${prefixCls}-list-item-thumbnail`}
onClick={e => this.handlePreview(file, e)}
href={file.url}
target="_blank"
target="_blank" rel="noopener noreferrer"
>
<img src={file.thumbUrl || file.url} alt={file.name} />
</a>
@ -104,7 +104,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
? (
<a
href={file.url}
target="_blank"
target="_blank" rel="noopener noreferrer"
className={`${prefixCls}-list-item-name`}
onClick={e => this.handlePreview(file, e)}
>
@ -125,7 +125,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
<span>
<a
href={file.url}
target="_blank"
target="_blank" rel="noopener noreferrer"
style={{ pointerEvents: file.url ? '' : 'none' }}
onClick={e => this.handlePreview(file, e)}
>

View File

@ -89,12 +89,12 @@
"enquire.js": "^2.1.1",
"es6-shim": "^0.35.0",
"eslint": "^3.0.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-config-airbnb": "^10.0.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-import": "^1.6.1",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-markdown": "*",
"eslint-plugin-react": "^5.0.1",
"eslint-plugin-react": "^6.1.2",
"eslint-tinker": "^0.3.1",
"history": "^3.0.0",
"intl": "^1.2.2",

View File

@ -5,9 +5,9 @@ export default function BrowserDemo(props) {
<article className="window-frame focus">
<header className="top-bar">
<div className="controls">
<div className="control close"></div>
<div className="control minify"></div>
<div className="control expand"></div>
<div className="control close" />
<div className="control minify" />
<div className="control expand" />
</div>
<input className="address-bar" defaultValue="http://www.example.com" />
</header>

View File

@ -10,7 +10,7 @@ export default class Article extends React.Component {
this.componentDidUpdate();
}
componentDidUpdate() {
const links = Array.apply(null, document.querySelectorAll('.outside-link.internal'));
const links = [...document.querySelectorAll('.outside-link.internal')];
if (links.length === 0) {
return;
}

View File

@ -65,7 +65,7 @@ export default class Demo extends React.Component {
preview(React, ReactDOM)
}
{
!!style ?
style ?
<style dangerouslySetInnerHTML={{ __html: style }} /> :
null
}

View File

@ -5,6 +5,7 @@ import Article from './Article';
import ComponentDoc from './ComponentDoc';
import * as utils from '../utils';
import config from '../../';
const SubMenu = Menu.SubMenu;
export default class MainContent extends React.Component {
@ -62,7 +63,7 @@ export default class MainContent extends React.Component {
<Link to={/^components/.test(url) ? `${url}/` : url} disabled={disabled}>
{text}
</Link> :
<a href={item.link} target="_blank" disabled={disabled}>
<a href={item.link} target="_blank" rel="noopener noreferrer" disabled={disabled}>
{text}
</a>;
@ -182,12 +183,12 @@ export default class MainContent extends React.Component {
>
<section className="prev-next-nav">
{
!!prev ?
prev ?
React.cloneElement(prev.props.children, { className: 'prev-page' }) :
null
}
{
!!next ?
next ?
React.cloneElement(next.props.children, { className: 'next-page' }) :
null
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import MainContent from './MainContent';
import Promise from 'bluebird';
import MainContent from './MainContent';
// locale copy from layout
const locale = (

View File

@ -2,6 +2,7 @@ import React from 'react';
import { Select, Modal } from 'antd';
import { version as antdVersion } from 'antd/package.json';
import { docVersions } from '../../';
const Option = Select.Option;
function isLocalStorageNameSupported() {
@ -41,8 +42,8 @@ export default class Footer extends React.Component {
<div>
<img src="https://os.alipayobjects.com/rmsportal/nyqBompsynAQCpJ.svg" alt="Ant Design" />
<p>
您好<a target="_blank" href="/#/changelog">antd@1.0</a> 已正式发布欢迎升级
如果您还需要使用旧版请查阅 <a target="_blank" href="http://012x.ant.design">012x.ant.design</a>
您好<a target="_blank" rel="noopener noreferrer" href="/#/changelog">antd@1.0</a> 已正式发布欢迎升级
如果您还需要使用旧版请查阅 <a target="_blank" rel="noopener noreferrer" href="http://012x.ant.design">012x.ant.design</a>
也可通过页面右下角的文档版本选择框进行切换
</p>
</div>
@ -70,13 +71,13 @@ export default class Footer extends React.Component {
<a target="_blank " href="https://github.com/ant-design/ant-design">仓库</a>
</div>
<div>
<a target="_blank" href="https://github.com/ant-design/antd-init">antd-init</a> - 脚手架
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/antd-init">antd-init</a> - 脚手架
</div>
<div>
<a target="_blank" href="http://ant-tool.github.io">ant-tool</a> - 开发工具
<a target="_blank" rel="noopener noreferrer" href="http://ant-tool.github.io">ant-tool</a> - 开发工具
</div>
<div>
<a target="_blank" href="https://github.com/dvajs/dva">dva</a> - 应用框架
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva">dva</a> - 应用框架
</div>
</li>
<li>
@ -90,22 +91,22 @@ export default class Footer extends React.Component {
<li>
<h2>社区</h2>
<div>
<a target="_blank" href="http://ant.design/changelog">
<a target="_blank" rel="noopener noreferrer" href="http://ant.design/changelog">
更新记录
</a>
</div>
<div>
<a target="_blank" href="https://github.com/ant-design/ant-design/issues">
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues">
反馈和建议
</a>
</div>
<div>
<a target="_blank" href="https://gitter.im/ant-design/ant-design">
<a target="_blank" rel="noopener noreferrer" href="https://gitter.im/ant-design/ant-design">
讨论
</a>
</div>
<div>
<a target="_blank" href="https://github.com/ant-design/ant-design/issues/new">
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues/new">
报告 Bug
</a>
</div>

View File

@ -5,6 +5,7 @@ import enquire from 'enquire.js';
import debounce from 'lodash.debounce';
import classNames from 'classnames';
import { Select, Menu, Row, Col, Icon, Button } from 'antd';
const Option = Select.Option;
export default class Header extends React.Component {