Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": "off"
}
}
},
"vcs": {
"enabled": true,
Expand Down Expand Up @@ -31,8 +35,12 @@
}
},
"files": {
"ignore": [
"**/src/app/client/*.ts"
"includes": [
"**",
"!**/dist",
"!**/node_modules",
"!client/coverage",
"!client/src/app/client"
]
}
}
6 changes: 5 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
"typescript": "^5.7.3"
},
"browserslist": {
"production": [">0.2%", "not dead", "not op_mini all"],
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
2 changes: 1 addition & 1 deletion client/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default defineConfig({
exclude: [
({ file = "" }) => /[\\/]node_modules[\\/]/.test(file),
({ file = "" }) => {
return /\/src\/app\/client(?:\/[^\/]+)*\/[^\/]+\.ts$/.test(file);
return /\/src\/app\/client(?:\/[^/]+)*\/[^/]+\.ts$/.test(file);
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/api/model-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ListType = {
color: { name: string; value: string; var: string };
progressProps: Pick<ProgressProps, "variant">;

// biome-ignore lint/suspicious/noExplicitAny:
// biome-ignore lint/suspicious/noExplicitAny: allowed
icon: React.ComponentType<any>;
};
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/axios-config/apiInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const initInterceptors = () => {
retryCounter: retryCounter + 1,
});
}
} catch (refreshError) {
} catch (_refreshError) {
await userManager.signoutRedirect();
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/components/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface ConfirmDialogProps {
| "danger"
| "warning"
| "info"
// biome-ignore lint/suspicious/noExplicitAny:
// biome-ignore lint/suspicious/noExplicitAny: allowed
| React.ComponentType<any>;
message: string | React.ReactNode;

Expand Down Expand Up @@ -89,7 +89,7 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
{cancelBtn}
</>
) : (
<>{confirmBtn}</>
confirmBtn
)}
</ModalFooter>
</Modal>
Expand Down
10 changes: 7 additions & 3 deletions client/src/app/components/EditLabelsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ export const EditLabelsForm: React.FC<EditLabelsFormProps> = ({
const onSaveForm = () => {
const labels = selections
.map((e) => splitStringAsKeyValue(getString(e.name)))
.reduce((prev, { key, value }) => {
return Object.assign(prev, { [key]: value });
}, {});
.reduce(
(prev, { key, value }) => {
prev[key] = value ?? "";
return prev;
},
{} as Record<string, string>,
);
onSave(labels);
};

Expand Down
86 changes: 44 additions & 42 deletions client/src/app/components/FilterPanel/FilterPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,53 @@ export const FilterPanel = <TItem, TFilterCategoryKey extends string>({
) === undefined
);
})
.reduce((prev, current) => {
return Object.assign(prev, { [current.categoryKey]: undefined });
}, {});
.reduce(
(prev, current) => {
prev[current.categoryKey] = undefined;
return prev;
},
{} as Record<TFilterCategoryKey, FilterValue>,
);
setFilterValues({ ...filterValues, ...filtersToBeCleared });
};

return (
<>
<Stack hasGutter>
<StackItem>
<Button variant="link" isInline onClick={clearAllFilters}>
Clear all filters
</Button>
</StackItem>
{filterCategories
.filter((filterCategory) => {
return (
omitFilterCategoryKeys.find(
(categoryKey) => categoryKey === filterCategory.categoryKey,
) === undefined
);
})
.map((category) => {
return (
<StackItem key={category.categoryKey}>
<Stack hasGutter>
<StackItem>
<Content component="h4">{category.title}</Content>
</StackItem>
<StackItem>
<FilterControl<TItem, TFilterCategoryKey>
category={category}
filterValue={filterValues[category.categoryKey]}
setFilterValue={(newValue) =>
setFilterValue(category, newValue)
}
isDisabled={isDisabled}
isSidebar
/>
</StackItem>
</Stack>
</StackItem>
);
})}
</Stack>
</>
<Stack hasGutter>
<StackItem>
<Button variant="link" isInline onClick={clearAllFilters}>
Clear all filters
</Button>
</StackItem>
{filterCategories
.filter((filterCategory) => {
return (
omitFilterCategoryKeys.find(
(categoryKey) => categoryKey === filterCategory.categoryKey,
) === undefined
);
})
.map((category) => {
return (
<StackItem key={category.categoryKey}>
<Stack hasGutter>
<StackItem>
<Content component="h4">{category.title}</Content>
</StackItem>
<StackItem>
<FilterControl<TItem, TFilterCategoryKey>
category={category}
filterValue={filterValues[category.categoryKey]}
setFilterValue={(newValue) =>
setFilterValue(category, newValue)
}
isDisabled={isDisabled}
isSidebar
/>
</StackItem>
</Stack>
</StackItem>
);
})}
</Stack>
);
};
15 changes: 9 additions & 6 deletions client/src/app/components/FilterToolbar/SelectFilterControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ export const SelectFilterControl = <TItem, TFilterCategoryKey extends string>({
node: chipLabel ?? label ?? value,
};
})
.reduce((prev, current) => {
if (current) {
prev.push(current);
}
return prev;
}, new Array<string | ToolbarLabel>());
.reduce(
(prev, current) => {
if (current) {
prev.push(current);
}
return prev;
},
[] as (string | ToolbarLabel)[],
);

const onFilterSelect = (value: string) => {
const option = getOptionFromOptionValue(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const HookFormPFSelect = <
HookFormPFSelectProps<TFieldValues, TName>
>(props);
const { fieldId, helperText, isRequired, errorsSuppressed } = extractedProps;
const { children, ref, ...rest } = remainingProps;
const { children: _children, ref: _ref, ...rest } = remainingProps;

return (
<HookFormPFGroupController<TFieldValues, TName>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/components/IconedStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
presetProps?.tooltipMessage ? (
<Tooltip content={presetProps?.tooltipMessage}>{children}</Tooltip>
) : (
<>{children}</>
children
);

return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/components/OidcProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IOidcProviderProps {

export const OidcProvider: React.FC<IOidcProviderProps> = ({ children }) => {
return ENV.AUTH_REQUIRED !== "true" ? (
<>{children}</>
children
) : (
<AuthProvider
{...oidcClientSettings}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const advisoryToModels = (advisories: VulnerabilityAdvisorySummary[]) => {
const summary = sboms.reduce(
(prev, current) => {
const sbomStatus = current.sbomStatus;
// biome-ignore lint/performance/noAccumulatingSpread: allowed
return Object.assign(prev, {
total: prev.total + 1,
sbomStatus: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const advisoryToModels = (advisories: PurlAdvisory[]) => {

const prevVulnStatusValue = prev.vulnerabilityStatus[vulnStatus];

// biome-ignore lint/performance/noAccumulatingSpread: allowed
const result: VulnerabilityOfPackageSummary = Object.assign(prev, {
vulnerabilityStatus: {
...prev.vulnerabilityStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const advisoryToModels = (advisories: SbomAdvisory[]) => {

const prevVulnStatusValue = prev.vulnerabilityStatus[vulnStatus];

// biome-ignore lint/performance/noAccumulatingSpread: allowed
const result: VulnerabilityOfSbomSummary = Object.assign(prev, {
vulnerabilityStatus: {
...prev.vulnerabilityStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const useExpansionState = <
deserialize: ({ expandedCells: expandedCellsStr }) => {
try {
return JSON.parse(expandedCellsStr || "{}");
} catch (e) {
} catch (_e) {
return {};
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const getLocalFilterDerivedState = <
const defaultMatcher = (filterValue: string, item: TItem) =>
legacyMatcher(
filterValue,
// biome-ignore lint/suspicious/noExplicitAny:
// biome-ignore lint/suspicious/noExplicitAny: allowed
filterCategory?.getItemValue?.(item) ?? (item as any)[filterKey],
);
const matcher = filterCategory?.matcher ?? defaultMatcher;
Expand All @@ -69,7 +69,7 @@ export const getLocalFilterDerivedState = <
*
* @returns false for any falsy value (regardless of the filter value), true if (coerced to string) lowercased value contains lowercased filter value.
*/
// biome-ignore lint/suspicious/noExplicitAny:
// biome-ignore lint/suspicious/noExplicitAny: allowed
const legacyMatcher = (filterValue: string, value: any) => {
if (!value) return false;
const lowerCaseItemValue = String(value).toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/hooks/table-controls/filtering/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const deserializeFilterUrlParams = <
}): Partial<Record<TFilterCategoryKey, FilterValue>> => {
try {
return JSON.parse(serializedParams.filters || "{}");
} catch (e) {
} catch (_e) {
return {};
}
};
12 changes: 5 additions & 7 deletions client/src/app/hooks/useUrlParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ export const useUrlParams = <
persistenceKeyPrefix
? objectKeys(serializedParams).reduce(
(obj, key) => {
return Object.assign(obj, {
[withPrefix(key)]: serializedParams[key],
});
obj[withPrefix(key)] = serializedParams[key];
return obj;
},
{} as TSerializedParams<TPrefixedURLParamKey>,
)
Expand Down Expand Up @@ -108,17 +107,16 @@ export const useUrlParams = <
if (isEnabled) {
const serializedParams = keys.reduce(
(obj, key) => {
return Object.assign(obj, {
[key]: urlParams.get(withPrefix(key)),
});
obj[key] = urlParams.get(withPrefix(key));
return obj;
},
{} as TSerializedParams<TURLParamKey>,
);
allParamsEmpty = keys.every((key) => !serializedParams[key]);
params = allParamsEmpty ? defaultValue : deserialize(serializedParams);
}

// biome-ignore lint/correctness/useExhaustiveDependencies:
// biome-ignore lint/correctness/useExhaustiveDependencies: allowed
React.useEffect(() => {
if (allParamsEmpty) setParams(defaultValue);
// Leaving this rule enabled results in a cascade of unnecessary useCallbacks:
Expand Down
1 change: 1 addition & 0 deletions client/src/app/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const HeaderApp: React.FC = () => {
masthead: { leftBrand, leftTitle, rightBrand, supportUrl },
} = useBranding();

// biome-ignore lint/correctness/useHookAtTopLevel: allowed
const auth = (isAuthRequired && useAuth()) || undefined;

const navigate = useNavigate();
Expand Down
5 changes: 2 additions & 3 deletions client/src/app/pages/advisory-list/advisory-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ export const AdvisoryTable: React.FC = () => {
const extendedSeverity = extendedSeverityFromSeverity(
current.severity,
);
return Object.assign(prev, {
[extendedSeverity]: prev[extendedSeverity] + 1,
});
prev[extendedSeverity] = prev[extendedSeverity] + 1;
return prev;
}, defaultSeverityGroup);

return (
Expand Down
26 changes: 12 additions & 14 deletions client/src/app/pages/advisory-list/advisory-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,17 @@ export const AdvisoryToolbar: React.FC<AdvisoryToolbarProps> = ({
} = tableControls;

return (
<>
<Toolbar {...toolbarProps} aria-label="advisory-toolbar">
<ToolbarContent>
{showFilters && <FilterToolbar {...filterToolbarProps} />}
<ToolbarItem {...paginationToolbarItemProps}>
<SimplePagination
idPrefix="advisory-table"
isTop
paginationProps={paginationProps}
/>
</ToolbarItem>
</ToolbarContent>
</Toolbar>
</>
<Toolbar {...toolbarProps} aria-label="advisory-toolbar">
<ToolbarContent>
{showFilters && <FilterToolbar {...filterToolbarProps} />}
<ToolbarItem {...paginationToolbarItemProps}>
<SimplePagination
idPrefix="advisory-table"
isTop
paginationProps={paginationProps}
/>
</ToolbarItem>
</ToolbarContent>
</Toolbar>
);
};
Loading
Loading