Skip to content

Commit f9c90f3

Browse files
authored
fix(eslint): fix react-hook/purity issues (#7609)
1 parent 736f235 commit f9c90f3

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

configs/eslint-config-compass/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const tempNewEslintRulesDisabled = {
1313
'react-hooks/preserve-manual-memoization': 'off',
1414
'react-hooks/globals': 'off',
1515
'react-hooks/static-components': 'off',
16-
'react-hooks/purity': 'off',
1716
'@typescript-eslint/no-redundant-type-constituents': 'off',
1817
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
1918
};

packages/compass-welcome/src/components/connection-plug.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ function LightningSparks({
8888
// Shows a plug that animates through the connection process.
8989
export function ConnectionPlug() {
9090
const isConnected = useIsAConnectionConnected();
91-
const animationStartTime = useRef<number>(Date.now());
9291
const animationFrameRef = useRef<number | null>(null);
9392

9493
// 0 = disconnected/animation start, 1 = connected/animation complete.
@@ -100,16 +99,15 @@ export function ConnectionPlug() {
10099
const cancelOngoingAnimation = () => {
101100
if (animationFrameRef.current) {
102101
cancelAnimationFrame(animationFrameRef.current);
103-
animationFrameRef.current = null;
104102
}
105103
};
106104

107105
if (isConnected) {
108106
cancelOngoingAnimation();
109-
animationStartTime.current = Date.now();
107+
const animationStartTime = Date.now();
110108

111109
const animate = () => {
112-
const elapsed = Date.now() - animationStartTime.current;
110+
const elapsed = Date.now() - animationStartTime;
113111
const rawProgress = Math.min(
114112
elapsed / CONNECT_ANIMATION_DURATION_MS,
115113
1
@@ -129,10 +127,10 @@ export function ConnectionPlug() {
129127
} else if (!isConnected) {
130128
cancelOngoingAnimation();
131129
// Quick disconnect animation.
132-
animationStartTime.current = Date.now();
130+
const animationStartTime = Date.now();
133131

134132
const animate = () => {
135-
const elapsed = Date.now() - animationStartTime.current;
133+
const elapsed = Date.now() - animationStartTime;
136134
const rawProgress = Math.min(
137135
elapsed / DISCONNECT_ANIMATION_DURATION_MS,
138136
1

0 commit comments

Comments
 (0)