diff --git a/.eslintrc.js b/.eslintrc.js index 2d2d2a0..5b7d1c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,5 +22,7 @@ module.exports = { ], rules: { '@typescript-eslint/prefer-regexp-exec': 1, + '@typescript-eslint/ban-ts-ignore': 0, + '@typescript-eslint/unbound-method': 1, }, }; diff --git a/package.json b/package.json index 120c102..69ef32c 100644 --- a/package.json +++ b/package.json @@ -89,10 +89,12 @@ "git add" ], "*.js": [ + "prettier --write", "eslint --fix", "git add" ], "*.{ts,tsx}": [ + "prettier --write", "eslint --fix", "git add" ] diff --git a/src/__tests__/index.test.tsx b/src/__tests__/index.test.tsx index 6f18ac7..b647e5c 100644 --- a/src/__tests__/index.test.tsx +++ b/src/__tests__/index.test.tsx @@ -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()).toThrow(Error) + expect(() => render()).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', () => { diff --git a/src/index.tsx b/src/index.tsx index 3067df2..a7b8624 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -69,8 +69,8 @@ export default class InfiniteScroll extends Component { 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();