Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Feb 10, 2021
1 parent cc62374 commit e8e5358
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/react/Effect.tsx
Expand Up @@ -7,7 +7,9 @@ type EffectProps = {
const Effect: React.FC<EffectProps> = ({ fn }) => {
React.useEffect(() => {
fn();
// eslint-ignore-line react-hooks/exhaustive-deps
// We can safely omit fn from dependencies as if its value changes
// the whole windup will be re-rendered anyway
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return null;
Expand Down
1 change: 1 addition & 0 deletions src/react/Pace.tsx
Expand Up @@ -28,6 +28,7 @@ export function defaultGetPace(
if (nextChar !== "!" && nextChar !== "?") {
return 150;
}
return 20;
case "-":
case " ":
case "\n":
Expand Down
2 changes: 1 addition & 1 deletion src/react/Pause.tsx
Expand Up @@ -4,7 +4,7 @@ type PauseProps = {
ms: number;
};

const Pause: React.FC<PauseProps> = ({}: PauseProps) => {
const Pause: React.FC<PauseProps> = () => {
return null;
};

Expand Down
2 changes: 2 additions & 0 deletions src/react/WindupChildren.tsx
Expand Up @@ -205,6 +205,8 @@ function buildKeyString(children: React.ReactNode): string {
}

function useChildrenMemo<T>(factory: () => T, children: React.ReactNode) {
// Omitting children in favour of using a key instead
// eslint-disable-next-line react-hooks/exhaustive-deps
const memoChildren = React.useMemo(factory, [buildKeyString(children)]);

return memoChildren;
Expand Down
2 changes: 2 additions & 0 deletions src/react/useWindupString.ts
Expand Up @@ -27,6 +27,8 @@ export default function useWindupString(
] {
const windupInit = React.useMemo(() => {
return windupFromString<StringMetadata>(text, options);
// We can omit options as this is used as an initialisation value and options will not change it
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [text]);

const { windup, skip, rewind, isFinished } = useWindup(windupInit, options);
Expand Down

0 comments on commit e8e5358

Please sign in to comment.