Skip to content

Commit 87ef128

Browse files
committed
set linter and formatter
1 parent 4863267 commit 87ef128

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test": "npm run lint && npm run testonly",
1818
"prepare": "npm run build-npm",
1919
"clean-install": "npmclean && npm install",
20-
"format": "prettier-eslint --single-quote --write 'src/**/*.js*'"
20+
"format": "prettier-eslint --single-quote --write '**/*.+(js|jsx)'"
2121
},
2222
"keywords": [
2323
"react",

src/scrollchor.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import PropTypes from "prop-types";
3-
import { animateScroll } from "./utils";
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { animateScroll } from './utils';
44

55
export default class Scrollchor extends React.Component {
66
constructor(props) {
@@ -21,7 +21,7 @@ export default class Scrollchor extends React.Component {
2121
};
2222

2323
_setup = props => {
24-
this._to = (props.to && props.to.replace(/^#/, "")) || "";
24+
this._to = (props.to && props.to.replace(/^#/, '')) || '';
2525
const {
2626
// default animate object
2727
offset = 0,
@@ -50,7 +50,7 @@ export default class Scrollchor extends React.Component {
5050

5151
return !this.props.children
5252
? null
53-
: <a {...props} href={"#" + this._to} onClick={this._handleClick} />;
53+
: <a {...props} href={'#' + this._to} onClick={this._handleClick} />;
5454
}
5555
}
5656

src/utils.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import warning from "fbjs/lib/warning";
1+
import warning from 'fbjs/lib/warning';
22

33
export function animateScroll(id, animate) {
44
const element = id ? document.getElementById(id) : document.body;
@@ -14,7 +14,10 @@ export function animateScroll(id, animate) {
1414
const elapsed = elapsedTime + increment;
1515
const position = easing(null, elapsed, start, change, duration);
1616
setScrollTop(position);
17-
elapsed < duration && setTimeout(() => animateFn(elapsed), increment);
17+
elapsed < duration &&
18+
setTimeout(function() {
19+
animateFn(elapsed);
20+
}, increment);
1821
}
1922

2023
animateFn();

0 commit comments

Comments
 (0)