From eeaad862745d33ee41262275e4f752cf23949b6c Mon Sep 17 00:00:00 2001 From: lzear Date: Sat, 25 Mar 2023 11:35:39 +0100 Subject: [PATCH] style: fix linting --- demo/pages/_document.tsx | 2 +- demo/src/boxes-transition.tsx | 11 ++++------- demo/src/generate-ballots.ts | 3 +-- demo/src/matrix.tsx | 2 +- demo/src/methods/borda/viz-borda.tsx | 2 +- demo/src/react-ranker/ranker.tsx | 4 ++-- demo/src/store/index.ts | 8 ++++---- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/demo/pages/_document.tsx b/demo/pages/_document.tsx index d919c1c..096b81e 100644 --- a/demo/pages/_document.tsx +++ b/demo/pages/_document.tsx @@ -23,7 +23,7 @@ class MyDocument extends Document { sizes="16x16" href="/favicon-16x16.png" /> - + {/**/} => { - return useTransition< +) => + useTransition< BoxMeta & BoxPosition & WithColor & { opacity?: number }, TrState >(boxes, { @@ -54,7 +52,6 @@ export const useBoxesTransition = ( // Using an array created by lodash.map keys: _.map(boxes, 'key'), }) -} export const renderBoxes = ( transitions: TransitionFn< diff --git a/demo/src/generate-ballots.ts b/demo/src/generate-ballots.ts index 5b24ca8..6eb185b 100644 --- a/demo/src/generate-ballots.ts +++ b/demo/src/generate-ballots.ts @@ -9,8 +9,7 @@ const { groupBallots } = utils const mergeDraw = (initial: T[][], toAdd: T) => { const idx = Math.floor(Math.random() * initial.length) - if (initial[idx]?.length) initial[idx] = [...initial[idx], toAdd] - else initial[idx] = [toAdd] + initial[idx] = initial[idx]?.length ? [...initial[idx], toAdd] : [toAdd] return initial } diff --git a/demo/src/matrix.tsx b/demo/src/matrix.tsx index e00a53f..084a571 100644 --- a/demo/src/matrix.tsx +++ b/demo/src/matrix.tsx @@ -8,7 +8,7 @@ import { } from './store/selectors' import { Checkbox, Typography } from 'antd' import { CandiTag } from './candidates' -import shallow from 'zustand/shallow' +import { shallow } from 'zustand/shallow' import { utils } from 'votes' export const MatrixComp: React.FC = () => { diff --git a/demo/src/methods/borda/viz-borda.tsx b/demo/src/methods/borda/viz-borda.tsx index 4d2906c..267fc77 100644 --- a/demo/src/methods/borda/viz-borda.tsx +++ b/demo/src/methods/borda/viz-borda.tsx @@ -6,7 +6,7 @@ import { Button } from 'antd' import * as d3 from 'd3' import { hierarchy, treemap } from 'd3-hierarchy' import { scaleBand } from 'd3-scale' -import shallow from 'zustand/shallow' +import { shallow } from 'zustand/shallow' import { selectBallots, selectWidth, diff --git a/demo/src/react-ranker/ranker.tsx b/demo/src/react-ranker/ranker.tsx index d2a0a53..fe4cfa7 100644 --- a/demo/src/react-ranker/ranker.tsx +++ b/demo/src/react-ranker/ranker.tsx @@ -242,7 +242,7 @@ const Ranker: React.FC = ({ bHeight={B_HEIGHT} bGutter={B_GUTTER} count={maxRank} - hovered={nextB !== null ? nextB * 2 + 1 : null} + hovered={nextB === null ? null : nextB * 2 + 1} /> diff --git a/demo/src/store/index.ts b/demo/src/store/index.ts index 5997f1f..4208025 100644 --- a/demo/src/store/index.ts +++ b/demo/src/store/index.ts @@ -111,9 +111,9 @@ export const useStore = create()( set(({ ballots }) => ({ ballots: ballots .map((ballot) => - ballot.id !== id - ? ballot - : { ...ballot, weight: ballot.weight + diff }, + ballot.id === id + ? { ...ballot, weight: ballot.weight + diff } + : ballot, ) .filter((ballot) => ballot.weight > 0) .map((b, idx) => ({ ...b, idx })), @@ -123,7 +123,7 @@ export const useStore = create()( set(({ ballots }) => ({ ballots: mergeBallotsUtil( ballots.map((ballot) => - ballot.id !== id ? ballot : { ...ballot, ranking }, + ballot.id === id ? { ...ballot, ranking } : ballot, ), ), }))