Skip to content

Commit c8e86a8

Browse files
committed
chore(spire): Fix spire config
1 parent e94b932 commit c8e86a8

File tree

14 files changed

+812
-225
lines changed

14 files changed

+812
-225
lines changed

.eslintrc.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "10"
3+
- "12"
44
cache: yarn
55
deploy:
66
local_dir: .docs

docs/docs/components/AsyncList/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class AsyncList extends Component {
4141
let hasError = false;
4242

4343
fetch(url + qs, { headers })
44-
.then(response => {
44+
.then((response) => {
4545
if (!(response.status !== 200)) {
4646
const etag = response.headers.get('etag');
4747
if (etag) {
@@ -52,13 +52,15 @@ export default class AsyncList extends Component {
5252
}
5353
return response.json();
5454
})
55-
.then(repos => {
55+
.then((repos) => {
5656
if (hasError) {
5757
throw new Error(repos.message);
5858
}
59-
this.feedList(repos.filter(repo => repo.fork === false && repo.language));
59+
this.feedList(
60+
repos.filter((repo) => repo.fork === false && repo.language)
61+
);
6062
})
61-
.catch(err => {
63+
.catch((err) => {
6264
console.error(err); // eslint-disable-line
6365
this.feedList([]);
6466
});

docs/docs/components/Axis/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ const itemsRenderer = (items, ref) => (
88
);
99

1010
// eslint-disable-next-line react/no-multi-comp
11-
const Axis = () => <List axis="x" itemCount={Infinity} itemsRenderer={itemsRenderer} pageSize={40} />;
11+
const Axis = () => (
12+
<List
13+
axis="x"
14+
itemCount={Infinity}
15+
itemsRenderer={itemsRenderer}
16+
pageSize={40}
17+
/>
18+
);
1219

1320
export default Axis;

docs/docs/components/InfiniteList/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const itemsRenderer = (items, ref) => (
88
);
99

1010
// eslint-disable-next-line react/no-multi-comp
11-
const InfiniteList = () => <List itemCount={Infinity} itemsRenderer={itemsRenderer} pageSize={40} />;
11+
const InfiniteList = () => (
12+
<List itemCount={Infinity} itemsRenderer={itemsRenderer} pageSize={40} />
13+
);
1214

1315
export default InfiniteList;

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
"warning": "^4.0.3"
1616
},
1717
"devDependencies": {
18-
"@babel/cli": "^7.4.4",
18+
"@babel/cli": "^7.7.4",
19+
"@babel/core": "^7.7.4",
1920
"@researchgate/babel-preset": "^1.2.1",
20-
"@researchgate/spire-config": "^1.3.0",
21+
"@researchgate/spire-config": "^1.5.4",
2122
"@storybook/addon-options": "^5.0.11",
2223
"@storybook/react": "^5.0.11",
2324
"@types/react": "^16.8.18",
2425
"babel-loader": "^8.0.6",
2526
"cross-env": "^5.2.0",
26-
"eslint": "^5.16.0",
2727
"intersection-observer": "^0.7.0",
2828
"react": "^16.8.6",
2929
"react-dom": "^16.8.6",
3030
"react-test-renderer": "^16.8.6",
31-
"spire": "^1.7.2",
32-
"spire-plugin-semantic-release": "^1.7.2",
31+
"spire": "^1.8.3",
32+
"spire-plugin-semantic-release": "^1.8.2",
3333
"typescript": "^3.4.5",
3434
"whatwg-fetch": "^3.0.0"
3535
},
@@ -71,7 +71,7 @@
7171
"extends": "@researchgate/spire-config",
7272
"plugins": [
7373
"spire-plugin-semantic-release",
74-
"./.spire/spire-plugin-tslint"
74+
"<rootDir>/.spire/spire-plugin-tslint"
7575
]
7676
},
7777
"scripts": {
@@ -85,5 +85,6 @@
8585
"storybook": "start-storybook -p 9001 -c .storybook",
8686
"test": "spire test",
8787
"ts:check": "tsc --project types"
88-
}
88+
},
89+
"prettier": "@researchgate/prettier-config"
8990
}

src/List.js

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ class List extends PureComponent {
1414
initialIndex: PropTypes.number,
1515
items(props, propName) {
1616
const object = props[propName];
17-
if (object != null && !(Array.isArray(object) || typeof object[Symbol.iterator] === 'function')) {
17+
if (
18+
object != null &&
19+
!(
20+
Array.isArray(object) ||
21+
typeof object[Symbol.iterator] === 'function'
22+
)
23+
) {
1824
return new Error(
19-
`\`${propName}\` must be of type Array or a native type implementing the iterable interface`,
25+
`\`${propName}\` must be of type Array or a native type implementing the iterable interface`
2026
);
2127
}
2228
return undefined;
@@ -66,13 +72,19 @@ class List extends PureComponent {
6672
this.prematureIntersectionChecked = this.state.size === 0;
6773
}
6874

69-
setRef = callback => {
75+
setRef = (callback) => {
7076
let prevRootNode;
71-
this.setRootNode = node => {
77+
this.setRootNode = (node) => {
7278
if (node !== prevRootNode) {
7379
prevRootNode = node;
74-
const overflow = window.getComputedStyle(node)[AXIS_CSS_MAP[this.props.axis]];
75-
callback(['auto', 'scroll', 'overlay'].indexOf(overflow) !== -1 ? node : null);
80+
const overflow = window.getComputedStyle(node)[
81+
AXIS_CSS_MAP[this.props.axis]
82+
];
83+
callback(
84+
['auto', 'scroll', 'overlay'].indexOf(overflow) !== -1
85+
? node
86+
: null
87+
);
7688
}
7789
};
7890
};
@@ -87,7 +99,7 @@ class List extends PureComponent {
8799
!isIntersecting,
88100
'ReactIntersectionList: the sentinel detected a viewport with a bigger size than the size of its items. ' +
89101
'This could lead to detrimental behavior, e.g.: triggering more than one onIntersection callback at the start.\n' +
90-
'To prevent this, use either a bigger `pageSize` value or avoid using the prop awaitMore initially.',
102+
'To prevent this, use either a bigger `pageSize` value or avoid using the prop awaitMore initially.'
91103
);
92104
}
93105

@@ -112,18 +124,26 @@ class List extends PureComponent {
112124

113125
warning(
114126
!(hasChildren && hasRender),
115-
'ReactIntersectionList: cannot use children and renderItem props as render function at the same time.',
127+
'ReactIntersectionList: cannot use children and renderItem props as render function at the same time.'
116128
);
117129

118130
if (hasChildren) {
119131
return children;
120132
}
121133

122-
return hasRender ? renderItem : (index, key) => <div key={key}>{index}</div>;
134+
return hasRender
135+
? renderItem
136+
: (index, key) => <div key={key}>{index}</div>;
123137
}
124138

125139
renderItems() {
126-
const { awaitMore, axis, initialIndex, itemsRenderer, threshold } = this.props;
140+
const {
141+
awaitMore,
142+
axis,
143+
initialIndex,
144+
itemsRenderer,
145+
threshold,
146+
} = this.props;
127147
const { size, itemCount } = this.state;
128148
const itemRenderer = this.getItemRenderer();
129149
const items = [];
@@ -150,7 +170,7 @@ class List extends PureComponent {
150170
}
151171
}
152172

153-
return itemsRenderer(items, node => {
173+
return itemsRenderer(items, (node) => {
154174
if (node && sentinel) {
155175
this.setRootNode(node);
156176
}

src/Sentinel.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class Sentinel extends Component {
1919
rootMargin: computeRootMargin(props),
2020
};
2121

22-
this.target = <template style={{ height: 1, minWidth: 1, display: 'block' }} />;
22+
this.target = (
23+
<template style={{ height: 1, minWidth: 1, display: 'block' }} />
24+
);
2325

2426
props.setRef(this.setRootElement);
2527
}
@@ -37,19 +39,25 @@ class Sentinel extends Component {
3739
}
3840

3941
shouldComponentUpdate(nextProps, { rootMargin, rootElement }) {
40-
const { rootMargin: currentRootMargin, rootElement: currentRootElement } = this.state;
42+
const {
43+
rootMargin: currentRootMargin,
44+
rootElement: currentRootElement,
45+
} = this.state;
4146
// When the rootMargin stays the same but the sentinel is repositioned, it can fall within
4247
// its threshold prematurely. In this case we don't get any update from the Observer instance.
4348
// We need to guarantee an update, and re-observing is a cheap way to accomplish this.
44-
if (currentRootMargin === rootMargin && currentRootElement === rootElement) {
49+
if (
50+
currentRootMargin === rootMargin &&
51+
currentRootElement === rootElement
52+
) {
4553
this.observer.externalUnobserve();
4654
this.observer.observe();
4755
return false;
4856
}
4957
return true;
5058
}
5159

52-
setRootElement = rootElement => {
60+
setRootElement = (rootElement) => {
5361
this.setState({ rootElement });
5462
};
5563

@@ -59,7 +67,7 @@ class Sentinel extends Component {
5967

6068
return (
6169
<Observer
62-
ref={instance => {
70+
ref={(instance) => {
6371
this.observer = instance;
6472
}}
6573
disabled={typeof rootElement === 'undefined'}

src/__mocks__/Sentinel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/* eslint-env jest */
2-
export default jest.genMockFromModule('@researchgate/react-intersection-observer').default;
2+
export default jest.genMockFromModule(
3+
'@researchgate/react-intersection-observer'
4+
).default;

0 commit comments

Comments
 (0)