Skip to content

Commit 69ab8fd

Browse files
authored
Merge pull request #161 from ankeetmaini/lint-fix
Adds typescript rules
2 parents e899545 + 34cdef6 commit 69ab8fd

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ module.exports = {
2222
],
2323
rules: {
2424
'@typescript-eslint/prefer-regexp-exec': 1,
25+
'@typescript-eslint/ban-ts-ignore': 0,
26+
'@typescript-eslint/unbound-method': 1,
2527
},
2628
};

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@
8989
"git add"
9090
],
9191
"*.js": [
92+
"prettier --write",
9293
"eslint --fix",
9394
"git add"
9495
],
9596
"*.{ts,tsx}": [
97+
"prettier --write",
9698
"eslint --fix",
9799
"git add"
98100
]

src/__tests__/index.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,16 @@ describe('React Infinite Scroll Component', () => {
8686
describe('When missing the dataLength prop', () => {
8787
it('throws an error', () => {
8888
console.error = jest.fn();
89-
const props = { loader: 'Loading...', hasMore: false, next: (() => {}) }
89+
const props = { loader: 'Loading...', hasMore: false, next: () => {} };
9090

9191
// @ts-ignore
92-
expect(() => render(<InfiniteScroll {...props} />)).toThrow(Error)
92+
expect(() => render(<InfiniteScroll {...props} />)).toThrow(Error);
9393
// @ts-ignore
94-
expect(console.error.mock.calls[0][0]).toContain('"dataLength" is missing')
94+
expect(console.error.mock.calls[0][0]).toContain(
95+
'"dataLength" is missing'
96+
);
9597
});
96-
})
98+
});
9799

98100
describe('When user scrolls to the bottom', () => {
99101
it('does not show loader if hasMore is false', () => {

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export default class InfiniteScroll extends Component<Props, State> {
6969
if (typeof this.props.dataLength === 'undefined') {
7070
throw new Error(
7171
`mandatory prop "dataLength" is missing. The prop is needed` +
72-
` when loading more content. Check README.md for usage`
73-
)
72+
` when loading more content. Check README.md for usage`
73+
);
7474
}
7575

7676
this._scrollableNode = this.getScrollableTarget();

0 commit comments

Comments
 (0)