Skip to content

Commit 6e8fe9f

Browse files
author
Claudéric Demers
authored
improvement: upgrade build pipeline and dev dependencies (clauderic#466)
* Use microbundle for bundling * Updated eslint config * Use standard-version for managing versioning * Updated travisci node version * Addded prettier as pre-commit hook
1 parent 7e8cd6d commit 6e8fe9f

33 files changed

+8499
-3232
lines changed

.babelrc

-34
This file was deleted.

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
# Markdown syntax specifies that trailing whitespaces can be meaningful,
12+
# so let’s not trim those. e.g. 2 trailing spaces = linebreak (<br />)
13+
# See https://daringfireball.net/projects/markdown/syntax#p
14+
[*.md]
15+
trim_trailing_whitespace = false

.eslintrc

-21
This file was deleted.

.eslintrc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": ["plugin:shopify/react"],
3+
"rules": {
4+
"no-lonely-if": "off",
5+
"no-undefined": "off",
6+
"no-param-reassign": "off",
7+
"no-mixed-operators": "off",
8+
"no-misleading-character-class": "off",
9+
"require-atomic-updates": "off",
10+
"prefer-object-spread": "off",
11+
"lines-around-comment": "off",
12+
"function-paren-newline": "off",
13+
"promise/catch-or-return": "off",
14+
"react/forbid-prop-types": "off",
15+
"react/jsx-filename-extension": "off",
16+
"react/no-unused-prop-types": "off",
17+
"shopify/binary-assignment-parens": "off",
18+
"react/no-string-refs": 1,
19+
"react/no-deprecated": 1
20+
}
21+
}

.npmignore

-6
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@ src
55
test
66
.*
77
*.md
8-
server.js
9-
index.html
10-
/index.js
11-
karma.conf.js
12-
webpack.config.*.js
13-
babel.preprocess.sass.js
148
codecov.yml
159
.travis.yml

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": false,
4+
"singleQuote": true,
5+
"trailingComma": "all"
6+
}

.storybook/addons.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@storybook/addon-options/register';

.storybook/config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
import { configure } from '@kadira/storybook';
1+
import {addDecorator, configure} from '@storybook/react';
2+
import {withOptions} from '@storybook/addon-options';
3+
4+
addDecorator(
5+
withOptions({
6+
name: 'React Sortable HOC',
7+
url: 'https://github.com/clauderic/react-sortable-hoc',
8+
showAddonPanel: false,
9+
})
10+
);
211

312
function loadStories() {
413
require('../src/.stories/index.js');

.storybook/head.html

Whitespace-only changes.

.storybook/webpack.config.js

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
var autoprefixer = require('autoprefixer');
2-
var webpack = require('webpack');
3-
var path = require('path');
4-
51
module.exports = {
6-
plugins: [
7-
new webpack.NormalModuleReplacementPlugin(/^\.\/layout$/, 'custom-layout')
8-
],
9-
resolve: {
10-
alias: {
11-
'custom-layout': path.resolve('.storybook/layout/index.js')
12-
}
13-
},
14-
module: {
15-
loaders: [
16-
{
17-
test: /(\.scss)$/,
18-
loaders: ['style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]!postcss!sass?sourceMap']
2+
module: {
3+
rules: [
4+
{
5+
test: /(\.scss)$/,
6+
use: [
7+
'style-loader',
8+
{
9+
loader: 'css-loader',
10+
options: {
11+
modules: true,
12+
localIdentName: '[name]__[local]',
13+
},
14+
},
15+
{
16+
loader: 'postcss-loader',
17+
options: {
18+
plugins: [require('autoprefixer')],
1919
},
20-
{
21-
test: /(\.css)$/,
22-
loaders: ['style', 'css']
23-
}
24-
]
25-
},
26-
postcss: [autoprefixer]
27-
}
20+
},
21+
'sass-loader',
22+
],
23+
},
24+
{
25+
test: /(\.css)$/,
26+
use: ['style-loader', 'css-loader'],
27+
},
28+
],
29+
},
30+
};

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
language: node_js
22
node_js:
3-
- 5
3+
- 10

babel.preprocess.sass.js

-10
This file was deleted.

examples/.eslintrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"import/no-unresolved": "off"
4+
}
5+
}

examples/basic.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {Component} from 'react';
22
import {render} from 'react-dom';
3-
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
3+
import {SortableContainer, SortableElement} from 'react-sortable-hoc';
4+
import {arrayMove} from 'array-move';
45

56
const SortableItem = SortableElement(({value}) => <li>{value}</li>);
67

examples/drag-handle.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import {
44
SortableContainer,
55
SortableElement,
66
SortableHandle,
7-
arrayMove,
87
} from 'react-sortable-hoc';
8+
import arrayMove from 'array-move';
99

10-
const DragHandle = SortableHandle(() => <span>::</span>); // This can be any component you want
10+
// This can be any component you want
11+
const DragHandle = SortableHandle(() => <span>::</span>);
1112

1213
const SortableItem = SortableElement(({value}) => {
1314
return (
@@ -42,7 +43,13 @@ class SortableComponent extends Component {
4243
render() {
4344
const {items} = this.state;
4445

45-
return <SortableList items={items} onSortEnd={this.onSortEnd} useDragHandle={true} />;
46+
return (
47+
<SortableList
48+
items={items}
49+
onSortEnd={this.onSortEnd}
50+
useDragHandle={true}
51+
/>
52+
);
4653
}
4754
}
4855

examples/infinite-list.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
import React, {Component} from 'react';
22
import {render} from 'react-dom';
3-
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
3+
import {
4+
SortableContainer,
5+
SortableElement,
6+
arrayMove,
7+
} from 'react-sortable-hoc';
48
import Infinite from 'react-infinite';
59

610
const SortableItem = SortableElement(({height, value}) => {
7-
return (
8-
<li style={{height}}>
9-
{value}
10-
</li>
11-
);
11+
return <li style={{height}}>{value}</li>;
1212
});
1313

1414
const SortableList = SortableContainer(({items}) => {
1515
return (
16-
<Infinite containerHeight={600} elementHeight={items.map(({height}) => height)}>
16+
<Infinite
17+
containerHeight={600}
18+
elementHeight={items.map(({height}) => height)}
19+
>
1720
{items.map(({value, height}, index) => (
18-
<SortableItem key={`item-${index}`} index={index} value={value} height={height} />
21+
<SortableItem
22+
key={`item-${index}`}
23+
index={index}
24+
value={value}
25+
height={height}
26+
/>
1927
))}
2028
</Infinite>
2129
);

examples/virtual-list.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, {Component} from 'react';
22
import {render} from 'react-dom';
3-
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
3+
import {
4+
SortableContainer,
5+
SortableElement,
6+
arrayMove,
7+
} from 'react-sortable-hoc';
48
import {List} from 'react-virtualized';
59

610
const SortableItem = SortableElement(({value}) => {
7-
return (
8-
<li>
9-
{value}
10-
</li>
11-
);
11+
return <li>{value}</li>;
1212
});
1313

1414
class VirtualList extends Component {
@@ -17,7 +17,7 @@ class VirtualList extends Component {
1717

1818
return (
1919
<List
20-
ref={(instance) => {
20+
ref={instance => {
2121
this.List = instance;
2222
}}
2323
rowHeight={({index}) => items[index].height}
@@ -70,8 +70,8 @@ class SortableComponent extends Component {
7070
const {items} = this.state;
7171

7272
return (
73-
<SortableList
74-
ref={(instance) => {
73+
<SortableList
74+
ref={instance => {
7575
this.SortableList = instance;
7676
}}
7777
items={items}

examples/virtual-table-columns.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import React, {Component} from 'react';
22
import {render} from 'react-dom';
33
import {Table, Column} from 'react-virtualized';
4-
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
4+
import {
5+
SortableContainer,
6+
SortableElement,
7+
arrayMove,
8+
} from 'react-sortable-hoc';
59
import 'react-virtualized/styles.css';
610

711
const ROW_HEIGHT = 30;
@@ -16,9 +20,7 @@ const SortableHeaderRowRenderer = SortableContainer(
1620
({className, columns, style}) => (
1721
<div className={className} role="row" style={style}>
1822
{React.Children.map(columns, (column, index) => (
19-
<SortableHeader index={index}>
20-
{column}
21-
</SortableHeader>
23+
<SortableHeader index={index}>{column}</SortableHeader>
2224
))}
2325
</div>
2426
)
@@ -47,7 +49,7 @@ class TableWithSortableColumns extends Component {
4749
return (
4850
<Table
4951
width={COL_WIDTH * rows.length}
50-
height={HEADER_ROW_HEIGHT + (ROW_HEIGHT * rows.length)}
52+
height={HEADER_ROW_HEIGHT + ROW_HEIGHT * rows.length}
5153
headerHeight={ROW_HEIGHT}
5254
rowHeight={ROW_HEIGHT}
5355
rowCount={rows.length}
@@ -62,11 +64,7 @@ class TableWithSortableColumns extends Component {
6264
)}
6365
>
6466
{cols.map(col => (
65-
<Column
66-
{...col}
67-
key={col.dataKey}
68-
width={COL_WIDTH}
69-
/>
67+
<Column {...col} key={col.dataKey} width={COL_WIDTH} />
7068
))}
7169
</Table>
7270
);

0 commit comments

Comments
 (0)