Commit ea93953e authored by Robert Knight's avatar Robert Knight

Upgrade to ESLint v7.x

Update eslint-config-hypothesis which was in turn holding back various
other ESLint packages.

The newest update to eslint-plugin-react-hooks found an incorrect usage
of `useCallback` in `ThreadCard` where `debounce` was being called on
ever render instead of only when certain dependencies changed.
parent 5d0b1028
......@@ -42,12 +42,12 @@
"enzyme-adapter-preact-pure": "^2.0.0",
"escape-html": "^1.0.3",
"escape-string-regexp": "^1.0.5",
"eslint": "^6.0.1",
"eslint-config-hypothesis": "^2.0.0",
"eslint": "^7.3.1",
"eslint-config-hypothesis": "^2.4.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^7.0.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-hooks": "^3.0.0",
"eslint-plugin-react-hooks": "^4.0.4",
"exorcist": "^1.0.1",
"express": "^4.14.1",
"fancy-log": "^1.3.3",
......
// eslint-disable-next-line
'use strict';
module.exports = {
......
import classnames from 'classnames';
import debounce from 'lodash.debounce';
import { createElement } from 'preact';
import { useCallback } from 'preact/hooks';
import { useCallback, useMemo } from 'preact/hooks';
import debounce from 'lodash.debounce';
import propTypes from 'prop-types';
import { closest } from '../../shared/dom-element';
import useStore from '../store/use-store';
......@@ -18,12 +18,12 @@ function ThreadCard({ frameSync, settings = {}, thread }) {
const threadTag = thread.annotation && thread.annotation.$tag;
const isFocused = useStore(store => store.isAnnotationFocused(threadTag));
const showDocumentInfo = useStore(store => store.route() !== 'sidebar');
const focusThreadAnnotation = useCallback(
debounce(tag => {
const focusTags = tag ? [tag] : [];
frameSync.focusAnnotations(focusTags);
}, 10),
const focusThreadAnnotation = useMemo(
() =>
debounce(tag => {
const focusTags = tag ? [tag] : [];
frameSync.focusAnnotations(focusTags);
}, 10),
[frameSync]
);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment