fix lint problems

This commit is contained in:
afc163 2015-12-27 16:20:59 +08:00
parent b1a136d208
commit c45c6877f8
15 changed files with 19 additions and 24 deletions

View File

@ -29,7 +29,6 @@
"no-param-reassign": 0,
"no-this-before-super": 2,
"no-undef": 2,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"babel/object-shorthand": 0,
"react/jsx-no-duplicate-props": 2,
"react/sort-comp": 0,

View File

@ -9,11 +9,11 @@
````jsx
import { Calendar } from 'antd';
function dateCellRender(value) {
function dateCellRender() {
return <div>自定义日数据</div>;
}
function monthCellRender(value) {
function monthCellRender() {
return <div>自定义月数据</div>;
}

View File

@ -41,16 +41,16 @@ const App = React.createClass({
</p>
</div>;
},
toggleChecked(e) {
toggleChecked() {
this.setState({checked: !this.state.checked});
},
toggleDisable(e) {
toggleDisable() {
this.setState({disabled: !this.state.disabled});
},
onChange(e) {
console.log('checked = ', e.target.checked);
this.setState({
checked: e.target.checked
checked: e.target.checked,
});
}
});

View File

@ -11,7 +11,7 @@
````jsx
import { DatePicker } from 'antd';
const disabledDate = function(current, value) {
const disabledDate = function(current) {
// can not select days after today
return current && current.getTime() > Date.now();
};

View File

@ -87,7 +87,7 @@ class FormItem extends React.Component {
if (!Array.isArray(children)) {
children = [children];
}
children.map((child, i) => {
children.map((child) => {
const type = child.props && child.props.type;
let prefixCls = child.props && child.props.prefixCls;
prefixCls = prefixCls ? prefixCls.substring(prefixCls.indexOf('-') + 1) : '';

View File

@ -29,7 +29,7 @@ const columns = [{
key: 'operation',
render: function(text, record) {
return <span>
<a href="#">操作一</a>
<a href="#">操作一{record.name}</a>
<span className="ant-divider"></span>
<a href="#">操作二</a>
<span className="ant-divider"></span>

View File

@ -106,7 +106,7 @@ let AntTable = React.createClass({
}
},
hasPagination(pagination) {
hasPagination() {
return this.props.pagination !== false;
},
@ -320,7 +320,7 @@ let AntTable = React.createClass({
checked = this.state.selectionDirty
? data.every((item, i) =>
this.state.selectedRowKeys.indexOf(this.getRecordKey(item, i)) >= 0)
: data.every((item, i) =>
: data.every((item) =>
this.props.rowSelection.getCheckboxProps &&
this.props.rowSelection.getCheckboxProps(item).defaultChecked);
}

View File

@ -10,10 +10,8 @@
import { Tabs } from 'antd';
const TabPane = Tabs.TabPane;
function callback(key) {}
ReactDOM.render(
<Tabs defaultActiveKey="1" onChange={callback}>
<Tabs defaultActiveKey="1">
<TabPane tab="选项卡一" key="1">选项卡一</TabPane>
<TabPane tab="选项卡二" disabled key="2">选项卡二</TabPane>
<TabPane tab="选项卡三" key="3">选项卡三</TabPane>

View File

@ -28,7 +28,7 @@ const Demo = React.createClass({
onEdit(targetKey, action) {
this[action](targetKey);
},
add(targetKey) {
add() {
const panes = this.state.panes;
const activeKey = 'newTab' + this.newTabIndex++;
panes.push(<TabPane tab="新建页签" key={activeKey}>新页面</TabPane>);

View File

@ -10,10 +10,8 @@
import { Tabs } from 'antd';
const TabPane = Tabs.TabPane;
function callback(key) {}
ReactDOM.render(
<Tabs defaultActiveKey="1" onChange={callback}>
<Tabs defaultActiveKey="1">
<TabPane tab="选项一" key="1">选项卡一</TabPane>
<TabPane tab="选项二" key="2">选项卡二</TabPane>
<TabPane tab="选项三" key="3">选项卡三</TabPane>

View File

@ -10,7 +10,7 @@
import { Tag } from 'antd';
function onClose(e) {
console.log(this.props.children);
console.log(e, this);
}
ReactDOM.render(<div>

View File

@ -17,11 +17,11 @@ function newArray(start, end) {
return result;
}
function disabledMinutes(h) {
function disabledMinutes() {
return newArray(0, 60).filter(value => value % 10 !== 0);
}
function disabledSeconds(h, m) {
function disabledSeconds() {
return newArray(0, 60).filter(value => value % 30 !== 0);
}

View File

@ -49,7 +49,7 @@ const App = React.createClass({
});
},
renderFooter(props) {
renderFooter() {
return <Button type="ghost" size="small" style={{ float: 'right', margin: '5' }}
onClick={this.getMock}>刷新</Button>;
},

View File

@ -49,7 +49,7 @@ const App = React.createClass({
});
},
renderFooter(props) {
renderFooter() {
return <Button type="primary" size="small" style={{ float: 'right', margin: '5' }}
onClick={this.getMock}>刷新</Button>;
},

View File

@ -24,7 +24,7 @@ const generateTreeNodes = () => {
const TreeDemo = React.createClass({
timeout(duration = 0) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
setTimeout(resolve.bind(this), duration);
});
},