Skip to content

Commit 36bdcd7

Browse files
author
Luis Merino
committed
fix(spire): change tooling and build system to spire
1 parent bd0e0cd commit 36bdcd7

18 files changed

+7446
-4080
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["@researchgate/babel-preset-rg"]
2+
"presets": ["@researchgate/babel-preset"]
33
}

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
lib
3+
.docs

.eslintrc

-4
This file was deleted.

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Keep this file for editor support
2+
module.exports = require('@researchgate/spire-config/eslint');

.flowconfig

-12
This file was deleted.

.gitignore

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
node_modules
21
npm-debug.log*
32
yarn-error.log
4-
lib
5-
coverage
6-
docs/static
7-
docs/favicon*
8-
docs/*.html
9-
.DS_Store
3+
/node_modules
4+
/lib
5+
/src/coverage
6+
/.docs

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
yarn.lock

.prettierrc

-16
This file was deleted.

.prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"spire-plugin-prettier/config"

.spire/spire-plugin-tslint.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function tslint({ setState }) {
2+
return {
3+
name: 'spire-plugin-tslint',
4+
async precommit() {
5+
setState(state => ({
6+
linters: [
7+
...state.linters,
8+
{ '**/*.tsx?': ['tsc', '--project', 'types'] },
9+
],
10+
}));
11+
},
12+
};
13+
}
14+
15+
module.exports = tslint;

.storybook/preview-head.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
1+
<link
2+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
3+
rel="stylesheet"
4+
/>

.storybook/webpack.config.js

-13
This file was deleted.

.travis.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
language: node_js
22
node_js:
33
- "10"
4-
- "8"
54
cache: yarn
65
deploy:
7-
local_dir: docs
6+
local_dir: .docs
87
provider: pages
98
skip_cleanup: true
10-
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
9+
github_token: $GITHUB_TOKEN # Set on travis-ci.org dashboard
1110
on:
1211
branch: master
1312
condition: '"$TRAVIS_JOB_NUMBER" == *.1'
14-
before_install: yarn global add greenkeeper-lockfile@1
15-
before_script:
16-
- greenkeeper-lockfile-update
17-
# true needs to be removed after https://github.com/conventional-changelog/conventional-github-releaser/pull/47 is fixed
18-
- 'if [[ -n "$TRAVIS_TAG" ]] && [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then yarn run create-github-release || true; fi'
1913
script:
20-
- yarn run lint
21-
- yarn test -- --ci --coverage
22-
- 'if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then yarn run build:storybook; fi'
23-
after_script: greenkeeper-lockfile-upload
24-
after_success: bash <(curl -s https://codecov.io/bash)
14+
- "(yarn lint && yarn test --ci --coverage) || travis_terminate"
15+
- 'if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then yarn build:storybook || travis_terminate 1; fi'
16+
- yarn release
17+
after_success:
18+
- bash <(curl -s https://codecov.io/bash)

README.md

+75-40
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,85 @@
1212

1313
<br>
1414

15-
> **Agent Smith:** ...we have no choice but to continue as planned. Deploy the sentinels. Immediately.
16-
17-
<!-- ### An Infinite Scroller List Component -->
15+
> **Agent Smith:** ...we have no choice but to continue as planned. Deploy the
16+
> sentinels. Immediately.
1817
1918
**React Intersection List** builds on top of
20-
**[React Intersection Observer](https://github.com/researchgate/react-intersection-observer)**, using a
21-
[sentinel](https://en.wikipedia.org/wiki/Sentinel_value) in the DOM to deliver a high-performance and smooth scrolling
22-
experience, even on low-end devices.
19+
**[React Intersection Observer](https://github.com/researchgate/react-intersection-observer)**,
20+
using a [sentinel](https://en.wikipedia.org/wiki/Sentinel_value) in the DOM to
21+
deliver a high-performance and smooth scrolling experience, even on low-end
22+
devices.
23+
24+
<br>
25+
26+
<details>
27+
<summary><strong>Table of Contents</strong></summary>
28+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
29+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
30+
31+
- [Getting Started](#getting-started)
32+
- [Why React Intersection List?](#why-react-intersection-list)
33+
- [Documentation](#documentation)
34+
- [How to](#how-to)
35+
- [FAQ](#faq)
36+
- [Props](#props)
37+
- [Examples](#examples)
38+
- [Contributing](#contributing)
39+
40+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
41+
</details>
2342

2443
## Getting Started
2544

2645
```
2746
$ npm install --save @researchgate/react-intersection-list
2847
```
2948

30-
And optionally the [polyfill](https://github.com/w3c/IntersectionObserver/tree/gh-pages/polyfill):
49+
And optionally the
50+
[polyfill](https://github.com/w3c/IntersectionObserver/tree/gh-pages/polyfill):
3151

3252
```
3353
$ npm install --save intersection-observer
3454
```
3555

36-
Next create a `<List>` and two instance methods as props `children` and `itemRenderer`:
56+
Next create a `<List>` and two instance methods as props `children` and
57+
`itemRenderer`:
3758

3859
```jsx
3960
import React, { Component } from 'react';
4061
import List from '@researchgate/react-intersection-list';
4162

4263
export default class InfiniteList extends Component {
43-
itemsRenderer = (items, ref) => (
44-
<ul className="list" ref={ref}>
45-
{items}
46-
</ul>
64+
itemsRenderer = (items, ref) => (
65+
<ul className="list" ref={ref}>
66+
{items}
67+
</ul>
68+
);
69+
70+
itemRenderer = (index, key) => <li key={key}>{index}</li>;
71+
72+
render() {
73+
return (
74+
<List
75+
itemCount={1000}
76+
itemsRenderer={this.itemsRenderer}
77+
renderItem={this.itemRenderer}
78+
/>
4779
);
48-
49-
itemRenderer = (index, key) => <li key={key}>{index}</li>;
50-
51-
render() {
52-
return <List itemCount={1000} itemsRenderer={this.itemsRenderer} renderItem={this.itemRenderer} />;
53-
}
80+
}
5481
}
5582
```
5683

57-
Note that `<List>` is a `PureComponent` so it can keep itself from re-rendering. It's highly recommended to avoid
58-
creating new functions for `renderItem` and `itemsRenderer` so that it can successfully shallow compare props on
59-
re-render.
84+
Note that `<List>` is a `PureComponent` so it can keep itself from re-rendering.
85+
It's highly recommended to avoid creating new functions for `renderItem` and
86+
`itemsRenderer` so that it can successfully shallow compare props on re-render.
6087

6188
## Why React Intersection List?
6289

63-
The approach to infinite scrolling was commonly done by devs implementing throttled `scroll` event callbacks. This keeps
64-
the main thread unnecessarily busy... No more! `IntersectionObservers` invoke callbacks in a **low-priority and
65-
asynchronous** way by design.
90+
The approach to infinite scrolling was commonly done by devs implementing
91+
throttled `scroll` event callbacks. This keeps the main thread unnecessarily
92+
busy... No more! `IntersectionObservers` invoke callbacks in a **low-priority
93+
and asynchronous** way by design.
6694

6795
> **Agent Smith:** Never send a human to do a machine's job.
6896
@@ -78,22 +106,27 @@ The implementation follows these steps:
78106

79107
### How to
80108

81-
Provided an `itemsRenderer` prop you must attach the `ref` argument to your scrollable DOM element:
109+
Provided an `itemsRenderer` prop you must attach the `ref` argument to your
110+
scrollable DOM element:
82111

83112
```jsx
84-
<div ref={ref}>{items}</div>;
113+
<div ref={ref}>{items}</div>
85114
```
86115

87-
This element specifies `overflow: auto|scroll` and it'll become the `IntersectionObserver root`. If the `overflow`
88-
property isn't found, then `window` will be used as the `root` instead.
116+
This element specifies `overflow: auto|scroll` and it'll become the
117+
`IntersectionObserver root`. If the `overflow` property isn't found, then
118+
`window` will be used as the `root` instead.
89119

90-
The `sentinel` element is by default detached from the list when the current size reaches the available length, unless
91-
you're using `awaitMore`. In case your list is in memory and you rely on the list for incremental rendering only, the
92-
default detaching behavior suffices. If you're loading more items in an asynchoronous way, make sure you switch
93-
`awaitMore` once you reach the total length (bottom of the list).
120+
The `sentinel` element is by default detached from the list when the current
121+
size reaches the available length, unless you're using `awaitMore`. In case your
122+
list is in memory and you rely on the list for incremental rendering only, the
123+
default detaching behavior suffices. If you're loading more items in an
124+
asynchoronous way, make sure you switch `awaitMore` once you reach the total
125+
length (bottom of the list).
94126

95-
The prop `itemCount` must be used if the prop `items` is not provided, and viceversa. Calculating the list size is done
96-
by adding the current size and the page size until the items' length is reached.
127+
The prop `itemCount` must be used if the prop `items` is not provided, and
128+
viceversa. Calculating the list size is done by adding the current size and the
129+
page size until the items' length is reached.
97130

98131
### FAQ
99132

@@ -158,11 +191,13 @@ Find multiple examples under:
158191

159192
We'd love your help on creating React Intersection List!
160193

161-
Before you do, please read our [Code of Conduct](.github/CODE_OF_CONDUCT.md) so you know what we expect when you
162-
contribute to our projects.
194+
Before you do, please read our [Code of Conduct](.github/CODE_OF_CONDUCT.md) so
195+
you know what we expect when you contribute to our projects.
163196

164-
Our [Contributing Guide](.github/CONTRIBUTING.md) tells you about our development process and what we're looking for,
165-
gives you instructions on how to issue bugs and suggest features, and explains how you can build and test your changes.
197+
Our [Contributing Guide](.github/CONTRIBUTING.md) tells you about our
198+
development process and what we're looking for, gives you instructions on how to
199+
issue bugs and suggest features, and explains how you can build and test your
200+
changes.
166201

167-
**Haven't contributed to an open source project before?** No problem! [Contributing Guide](.github/CONTRIBUTING.md) has
168-
you covered as well.
202+
**Haven't contributed to an open source project before?** No problem!
203+
[Contributing Guide](.github/CONTRIBUTING.md) has you covered as well.

0 commit comments

Comments
 (0)