diff --git a/client/src/app/hooks/usePersistentState.ts b/client/src/app/hooks/usePersistentState.ts index 84d949d5a..4be272b71 100644 --- a/client/src/app/hooks/usePersistentState.ts +++ b/client/src/app/hooks/usePersistentState.ts @@ -80,6 +80,7 @@ export const usePersistentState = < persistenceKeyPrefix ? `${persistenceKeyPrefix}:${key}` : key; const persistence = { + // eslint-disable-next-line @eslint-react/use-state -- intentionally stored as tuple in persistence map state: React.useState(defaultValue), urlParams: useUrlParams( isUrlParamsOptions(options) diff --git a/client/src/app/hooks/useSelectionState.ts b/client/src/app/hooks/useSelectionState.ts index 44cf890ff..d6895a473 100644 --- a/client/src/app/hooks/useSelectionState.ts +++ b/client/src/app/hooks/useSelectionState.ts @@ -30,7 +30,7 @@ export const useSelectionState = ({ initialSelected = [], isEqual = (a, b) => a === b, }: ISelectionStateArgs): ISelectionState => { - const [selectedSet, setSelectedSet] = React.useState( + const [selectedSet, setSelectedSet] = React.useState(() => doSelect(isEqual, items, initialSelected), ); diff --git a/client/src/app/hooks/useStorage.ts b/client/src/app/hooks/useStorage.ts index fcac903bd..9e815db2c 100644 --- a/client/src/app/hooks/useStorage.ts +++ b/client/src/app/hooks/useStorage.ts @@ -60,7 +60,7 @@ const useStorage = ({ key, defaultValue, }: IUseStorageOptions): [T, React.Dispatch>] => { - const [cachedValue, setCachedValue] = React.useState( + const [cachedValue, setCachedValue] = React.useState(() => getValueFromStorage(type, key, defaultValue), ); diff --git a/client/src/app/pages/sbom-groups/sbom-groups-provider.tsx b/client/src/app/pages/sbom-groups/sbom-groups-provider.tsx index d3e42637b..1f3898b54 100644 --- a/client/src/app/pages/sbom-groups/sbom-groups-provider.tsx +++ b/client/src/app/pages/sbom-groups/sbom-groups-provider.tsx @@ -49,7 +49,7 @@ export const SbomGroupsProvider: React.FunctionComponent< // Track manually expanded node IDs (browse mode only) const [expandedNodeIds, setExpandedNodeIds] = React.useState>( - new Set(), + () => new Set(), ); const toggleExpandedNodes = React.useCallback((node: SbomGroupItem) => { diff --git a/eslint.config.mjs b/eslint.config.mjs index 4dce37c2f..a82408993 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -38,7 +38,6 @@ export default defineConfig([ "@eslint-react/no-context-provider": "off", "@eslint-react/naming-convention-ref-name": "off", "@eslint-react/no-array-index-key": "off", - "@eslint-react/use-state": "off", "@eslint-react/no-unnecessary-use-prefix": "off", "@typescript-eslint/no-unused-vars": "off", "@eslint-react/exhaustive-deps": "off",