Skip to content

Commit

Permalink
fix lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
imjordanxd committed Dec 14, 2024
1 parent 2ffe582 commit b1cc340
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
17 changes: 11 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
module.exports = {
extends: ['prettier', 'plugin:react/recommended'],
extends: ['prettier', 'plugin:react/recommended', 'plugin:react/jsx-runtime'],
plugins: ['react', 'prettier'],
env: {
browser: true,
jest: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'prettier/prettier': 'error',
Expand All @@ -16,8 +21,8 @@ module.exports = {
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false
}
]
}
ignoreRestSiblings: false,
},
],
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "mkdirp dist && tsc",
"prepublish": "npm run build",
"test": "jest test",
"lint": "eslint ./src ./test",
"lint": "eslint",
"precommit": "lint-staged"
},
"lint-staged": {
Expand Down
27 changes: 14 additions & 13 deletions src/InfiniteScroll.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class InfiniteScroll extends React.Component {
getScrollParent: PropTypes.func,
threshold: PropTypes.number,
useCapture: PropTypes.bool,
useWindow: PropTypes.bool
useWindow: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -29,7 +29,7 @@ export default class InfiniteScroll extends React.Component {
isReverse: false,
useCapture: false,
loader: null,
getScrollParent: null
getScrollParent: null,
};

constructor(props) {
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class InfiniteScroll extends React.Component {
const testOptions = {
get passive() {
passive = true;
}
},
};

try {
Expand All @@ -87,11 +87,11 @@ export default class InfiniteScroll extends React.Component {
if (this.isPassiveSupported()) {
options = {
useCapture: this.props.useCapture,
passive: true
passive: true,
};
} else {
options = {
passive: false
passive: false,
};
}
return options;
Expand All @@ -111,7 +111,7 @@ export default class InfiniteScroll extends React.Component {
scrollEl.removeEventListener(
'mousewheel',
this.mousewheelListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);
}

Expand All @@ -124,12 +124,12 @@ export default class InfiniteScroll extends React.Component {
scrollEl.removeEventListener(
'scroll',
this.scrollListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);
scrollEl.removeEventListener(
'resize',
this.scrollListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);
}

Expand Down Expand Up @@ -161,17 +161,17 @@ export default class InfiniteScroll extends React.Component {
scrollEl.addEventListener(
'mousewheel',
this.mousewheelListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);
scrollEl.addEventListener(
'scroll',
this.scrollListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);
scrollEl.addEventListener(
'resize',
this.scrollListener,
this.options ? this.options : this.props.useCapture
this.options ? this.options : this.props.useCapture,
);

if (this.props.initialLoad) {
Expand Down Expand Up @@ -214,7 +214,8 @@ export default class InfiniteScroll extends React.Component {
// Here we make sure the element is visible as well as checking the offset
if (
offset < Number(this.props.threshold) &&
(el && el.offsetParent !== null)
el &&
el.offsetParent !== null
) {
this.detachScrollListener();
this.beforeScrollHeight = parentNode.scrollHeight;
Expand Down Expand Up @@ -264,7 +265,7 @@ export default class InfiniteScroll extends React.Component {
...props
} = renderProps;

props.ref = node => {
props.ref = (node) => {
this.scrollComponent = node;
if (ref) {
ref(node);
Expand Down

0 comments on commit b1cc340

Please sign in to comment.