Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ module.exports = {
],
rules: {
'@typescript-eslint/prefer-regexp-exec': 1,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/unbound-method': 1,
},
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@
"git add"
],
"*.js": [
"prettier --write",
"eslint --fix",
"git add"
],
"*.{ts,tsx}": [
"prettier --write",
"eslint --fix",
"git add"
]
Expand Down
10 changes: 6 additions & 4 deletions src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ describe('React Infinite Scroll Component', () => {
describe('When missing the dataLength prop', () => {
it('throws an error', () => {
console.error = jest.fn();
const props = { loader: 'Loading...', hasMore: false, next: (() => {}) }
const props = { loader: 'Loading...', hasMore: false, next: () => {} };

// @ts-ignore
expect(() => render(<InfiniteScroll {...props} />)).toThrow(Error)
expect(() => render(<InfiniteScroll {...props} />)).toThrow(Error);
// @ts-ignore
expect(console.error.mock.calls[0][0]).toContain('"dataLength" is missing')
expect(console.error.mock.calls[0][0]).toContain(
'"dataLength" is missing'
);
});
})
});

describe('When user scrolls to the bottom', () => {
it('does not show loader if hasMore is false', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default class InfiniteScroll extends Component<Props, State> {
if (typeof this.props.dataLength === 'undefined') {
throw new Error(
`mandatory prop "dataLength" is missing. The prop is needed` +
` when loading more content. Check README.md for usage`
)
` when loading more content. Check README.md for usage`
);
}

this._scrollableNode = this.getScrollableTarget();
Expand Down