upgrade eslint-config-airbnb version and fix some problems

This commit is contained in:
afc163 2016-04-29 12:13:27 +08:00
parent ce123137e3
commit 03cb74ead5
51 changed files with 376 additions and 364 deletions

View File

@ -30,6 +30,8 @@ const eslintrc = {
'react/sort-comp': 0, 'react/sort-comp': 0,
'react/prop-types': 0, 'react/prop-types': 0,
'react/jsx-closing-bracket-location': 0, 'react/jsx-closing-bracket-location': 0,
'react/jsx-first-prop-new-line': 0,
'import/no-unresolved': 0,
'no-param-reassign': 0, 'no-param-reassign': 0,
'no-return-assign': 0, 'no-return-assign': 0,
'max-len': 0, 'max-len': 0,

View File

@ -59,8 +59,7 @@ ReactDOM.render(<div>
<Button type="ghost"></Button> <Button type="ghost"></Button>
<Button type="ghost"></Button> <Button type="ghost"></Button>
</ButtonGroup> </ButtonGroup>
</div> </div>, mountNode);
, mountNode);
```` ````
<style> <style>

View File

@ -28,7 +28,7 @@ export default class FormItem extends React.Component {
form: React.PropTypes.object, form: React.PropTypes.object,
} }
_getLayoutClass(colDef) { getLayoutClass(colDef) {
if (!colDef) { if (!colDef) {
return ''; return '';
} }
@ -132,7 +132,7 @@ export default class FormItem extends React.Component {
renderWrapper(children) { renderWrapper(children) {
const wrapperCol = this.props.wrapperCol; const wrapperCol = this.props.wrapperCol;
return ( return (
<div className={this._getLayoutClass(wrapperCol)} key="wrapper"> <div className={this.getLayoutClass(wrapperCol)} key="wrapper">
{children} {children}
</div> </div>
); );
@ -158,7 +158,7 @@ export default class FormItem extends React.Component {
props.required; props.required;
const className = classNames({ const className = classNames({
[this._getLayoutClass(labelCol)]: true, [this.getLayoutClass(labelCol)]: true,
[`${props.prefixCls}-item-required`]: required, [`${props.prefixCls}-item-required`]: required,
}); });

View File

@ -1,8 +1,13 @@
import Pagination from 'rc-pagination/lib/locale/en_US';
import DatePicker from '../date-picker/locale/en_US';
import TimePicker from '../time-picker/locale/en_US';
import Calendar from '../calendar/locale/en_US';
export default { export default {
Pagination: require('rc-pagination/lib/locale/en_US'), Pagination,
DatePicker: require('../date-picker/locale/en_US'), DatePicker,
TimePicker: require('../time-picker/locale/en_US'), TimePicker,
Calendar: require('../calendar/locale/en_US'), Calendar,
Table: { Table: {
filterTitle: 'Filter Menu', filterTitle: 'Filter Menu',
filterConfirm: 'OK', filterConfirm: 'OK',

View File

@ -2,11 +2,16 @@
* Created by Andrey Gayvoronsky on 13/04/16. * Created by Andrey Gayvoronsky on 13/04/16.
*/ */
import Pagination from 'rc-pagination/lib/locale/ru_RU';
import DatePicker from '../date-picker/locale/ru_RU';
import TimePicker from '../time-picker/locale/ru_RU';
import Calendar from '../calendar/locale/ru_RU';
export default { export default {
Pagination: require('rc-pagination/lib/locale/ru_RU'), Pagination,
DatePicker: require('../date-picker/locale/ru_RU'), DatePicker,
TimePicker: require('../time-picker/locale/ru_RU'), TimePicker,
Calendar: require('../calendar/locale/ru_RU'), Calendar,
Table: { Table: {
filterTitle: 'Фильтр', filterTitle: 'Фильтр',
filterConfirm: 'OK', filterConfirm: 'OK',
@ -29,4 +34,3 @@ export default {
itemsUnit: 'items', itemsUnit: 'items',
}, },
}; };

View File

@ -25,5 +25,6 @@ function showConfirm() {
ReactDOM.render( ReactDOM.render(
<Button onClick={showConfirm}> <Button onClick={showConfirm}>
确认对话框 确认对话框
</Button>, mountNode); </Button>
, mountNode);
```` ````

View File

@ -23,5 +23,6 @@ function showConfirm() {
ReactDOM.render( ReactDOM.render(
<Button onClick={showConfirm}> <Button onClick={showConfirm}>
确认对话框 确认对话框
</Button>, mountNode); </Button>
, mountNode);
```` ````

View File

@ -8,7 +8,7 @@ title: 受控
````jsx ````jsx
import { Pagination } from 'antd'; import { Pagination } from 'antd';
let Container = React.createClass({ const Container = React.createClass({
getInitialState() { getInitialState() {
return { return {
current: 3 current: 3
@ -25,8 +25,5 @@ let Container = React.createClass({
} }
}); });
ReactDOM.render( ReactDOM.render(<Container />, mountNode);
<Container />,
mountNode);
```` ````

View File

@ -215,7 +215,7 @@ export default class Table extends React.Component {
if (result !== 0) { if (result !== 0) {
return (sortOrder === 'descend') ? -result : result; return (sortOrder === 'descend') ? -result : result;
} }
return a._index - b._index; return a.indexForSort - b.indexForSort;
}; };
} }
@ -644,7 +644,7 @@ export default class Table extends React.Component {
// //
data = data.slice(0); data = data.slice(0);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
data[i]._index = i; data[i].indexForSort = i;
} }
const sorterFn = this.getSorterFn(); const sorterFn = this.getSorterFn();
if (sorterFn) { if (sorterFn) {

View File

@ -16,7 +16,8 @@ ReactDOM.render(
<TabPane tab="选项卡二" key="2">选项卡二内容</TabPane> <TabPane tab="选项卡二" key="2">选项卡二内容</TabPane>
<TabPane tab="选项卡三" key="3">选项卡三内容</TabPane> <TabPane tab="选项卡三" key="3">选项卡三内容</TabPane>
</Tabs> </Tabs>
</div>, mountNode); </div>
, mountNode);
```` ````
````css ````css

View File

@ -16,5 +16,6 @@ ReactDOM.render(
<TabPane tab="选项卡一" key="1">选项卡一内容</TabPane> <TabPane tab="选项卡一" key="1">选项卡一内容</TabPane>
<TabPane tab="选项卡二" key="2">选项卡二内容</TabPane> <TabPane tab="选项卡二" key="2">选项卡二内容</TabPane>
<TabPane tab="选项卡三" key="3">选项卡三内容</TabPane> <TabPane tab="选项卡三" key="3">选项卡三内容</TabPane>
</Tabs>, mountNode); </Tabs>
, mountNode);
```` ````

View File

@ -29,10 +29,10 @@ const generateData = (_level, _preKey, _tns) => {
if (_level < 0) { if (_level < 0) {
return tns; return tns;
} }
const __level = _level - 1; const level = _level - 1;
children.forEach((key, index) => { children.forEach((key, index) => {
tns[index].children = []; tns[index].children = [];
return generateData(__level, key, tns[index].children); return generateData(level, key, tns[index].children);
}); });
}; };
generateData(z); generateData(z);

View File

@ -29,10 +29,10 @@ const generateData = (_level, _preKey, _tns) => {
if (_level < 0) { if (_level < 0) {
return tns; return tns;
} }
const __level = _level - 1; const level = _level - 1;
children.forEach((key, index) => { children.forEach((key, index) => {
tns[index].children = []; tns[index].children = [];
return generateData(__level, key, tns[index].children); return generateData(level, key, tns[index].children);
}); });
}; };
generateData(z); generateData(z);

View File

@ -73,19 +73,20 @@
"devDependencies": { "devDependencies": {
"antd-tools": "~0.3.0", "antd-tools": "~0.3.0",
"babel-eslint": "^6.0.2", "babel-eslint": "^6.0.2",
"babel-jest": "^11.0.2", "babel-jest": "^12.0.2",
"babel-plugin-antd": "^0.4.0", "babel-plugin-antd": "^0.4.0",
"dom-scroll-into-view": "^1.1.0", "dom-scroll-into-view": "^1.1.0",
"es6-shim": "^0.35.0", "es6-shim": "^0.35.0",
"eslint": "^2.2.0", "eslint": "^2.2.0",
"eslint-config-airbnb": "^7.0.0", "eslint-config-airbnb": "^8.0.0",
"eslint-plugin-babel": "^3.0.0", "eslint-plugin-babel": "^3.0.0",
"eslint-plugin-jsx-a11y": "^0.6.2", "eslint-plugin-import": "^1.6.1",
"eslint-plugin-jsx-a11y": "^1.0.4",
"eslint-plugin-markdown": "*", "eslint-plugin-markdown": "*",
"eslint-plugin-react": "^5.0.1", "eslint-plugin-react": "^5.0.1",
"eslint-tinker": "^0.3.1", "eslint-tinker": "^0.3.1",
"history": "^2.0.1", "history": "^2.0.1",
"jest-cli": "^11.0.0", "jest-cli": "^12.0.2",
"jsonml-to-react-component": "~0.2.0", "jsonml-to-react-component": "~0.2.0",
"jsonml.js": "^0.1.0", "jsonml.js": "^0.1.0",
"jsonp": "^0.2.0", "jsonp": "^0.2.0",