Skip to content

Commit b51bcc1

Browse files
committed
Enforce consistent linting
1 parent 8c7ff90 commit b51bcc1

File tree

9 files changed

+1518
-1255
lines changed

9 files changed

+1518
-1255
lines changed

.eslintrc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"node": true,
5-
"browser": true,
6-
"es6": true,
7-
"mocha": true
8-
},
9-
"parserOptions": {
10-
"ecmaFeatures": {
11-
"experimentalObjectRestSpread": true,
12-
"jsx": true
13-
},
14-
"sourceType": "module"
15-
},
16-
"plugins": [
17-
"react"
18-
],
19-
"extends": ["eslint:recommended", "plugin:react/recommended"]
2+
"extends": "react-app",
3+
"rules": {
4+
"prefer-const": ["error"],
5+
"comma-dangle": ["error", "always-multiline"],
6+
"indent": ["error", 2, {"SwitchCase": 1}],
7+
"semi": ["error", "always"],
8+
"no-mixed-operators": [
9+
"warn",
10+
{
11+
"groups": [
12+
['&', '|', '^', '~', '<<', '>>', '>>>'],
13+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
14+
['in', 'instanceof']
15+
],
16+
"allowSamePrecedence": true
17+
}
18+
]
19+
}
2020
}

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![npm version](https://img.shields.io/npm/v/react-sortable-hoc.svg)](https://www.npmjs.com/package/react-sortable-hoc)
55
[![npm downloads](https://img.shields.io/npm/dm/react-sortable-hoc.svg)](https://www.npmjs.com/package/react-sortable-hoc)
66
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/clauderic/react-sortable-hoc/blob/master/LICENSE)
7-
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
87
[![Gitter](https://badges.gitter.im/clauderic/react-sortable-hoc.svg)](https://gitter.im/clauderic/react-sortable-hoc)
98

109
### Examples available here: <a href="#">http://clauderic.github.io/react-sortable-hoc/</a>
@@ -52,32 +51,32 @@ import React, {Component} from 'react';
5251
import {render} from 'react-dom';
5352
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
5453

55-
const SortableItem = SortableElement(({value}) => <li>{value}</li>);
54+
const SortableItem = SortableElement(({value}) =>
55+
<li>{value}</li>
56+
);
5657

5758
const SortableList = SortableContainer(({items}) => {
58-
return (
59-
<ul>
60-
{items.map((value, index) =>
61-
<SortableItem key={`item-${index}`} index={index} value={value} />
62-
)}
63-
</ul>
64-
);
59+
return (
60+
<ul>
61+
{items.map((value, index) => (
62+
<SortableItem key={`item-${index}`} index={index} value={value} />
63+
))}
64+
</ul>
65+
);
6566
});
6667

6768
class SortableComponent extends Component {
68-
state = {
69-
items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6']
70-
}
71-
onSortEnd = ({oldIndex, newIndex}) => {
72-
this.setState({
73-
items: arrayMove(this.state.items, oldIndex, newIndex)
74-
});
75-
};
76-
render() {
77-
return (
78-
<SortableList items={this.state.items} onSortEnd={this.onSortEnd} />
79-
)
80-
}
69+
state = {
70+
items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'],
71+
};
72+
onSortEnd = ({oldIndex, newIndex}) => {
73+
this.setState({
74+
items: arrayMove(this.state.items, oldIndex, newIndex),
75+
});
76+
};
77+
render() {
78+
return <SortableList items={this.state.items} onSortEnd={this.onSortEnd} />;
79+
}
8180
}
8281

8382
render(<SortableComponent/>, document.getElementById('root'));
@@ -95,7 +94,7 @@ There are already a number of great Drag & Drop libraries out there (for instanc
9594
#### SortableContainer HOC
9695
| Property | Type | Default | Description |
9796
|:---------------------------|:------------------|:-----------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
98-
| axis | String | `y` | Items can be sorted horizontally, vertically or in a grid. Possible values: `x`, `y` or `xy` |
97+
| axis | String | `y` | Items can be sorted horizontally, vertically or in a grid. Possible values: `x`, `y` or `xy` |
9998
| lockAxis | String | | If you'd like, you can lock movement to an axis while sorting. This is not something that is possible with HTML5 Drag & Drop |
10099
| helperClass | String | | You can provide a class you'd like to add to the sortable helper to add some styles to it |
101100
| transitionDuration | Number | `300` | The duration of the transition when elements shift positions. Set this to `0` if you'd like to disable transitions |

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"autoprefixer": "^6.3.6",
6161
"babel-cli": "^6.9.0",
6262
"babel-core": "^6.3.15",
63-
"babel-eslint": "^6.0.4",
63+
"babel-eslint": "^7.1.1",
6464
"babel-loader": "^6.2.0",
6565
"babel-plugin-css-modules-transform": "^0.1.0",
6666
"babel-plugin-transform-object-assign": "^6.8.0",
@@ -77,9 +77,12 @@
7777
"classnames": "^2.2.5",
7878
"cross-env": "^1.0.7",
7979
"css-loader": "^0.23.1",
80-
"eslint": "^2.10.1",
81-
"eslint-config-xo-react": "^0.7.0",
82-
"eslint-plugin-react": "^5.1.1",
80+
"eslint": "^3.16.1",
81+
"eslint-config-react-app": "^0.6.1",
82+
"eslint-plugin-flowtype": "^2.21.0",
83+
"eslint-plugin-import": "^2.0.1",
84+
"eslint-plugin-jsx-a11y": "^4.0.0",
85+
"eslint-plugin-react": "^6.4.1",
8386
"express": "^4.13.3",
8487
"extract-text-webpack-plugin": "^1.0.1",
8588
"html-webpack-plugin": "^2.16.1",

0 commit comments

Comments
 (0)