Skip to content

chore: updated dev dependencies (#4309) #4318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 8, 2025
Merged
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
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prettier",
"plugin:prettier/recommended",
"next",
"plugin:sonarjs/recommended",
"plugin:sonarjs/recommended-legacy",
"plugin:eslint-comments/recommended"
],
"rules": {
Expand Down Expand Up @@ -57,7 +57,10 @@
"jsdoc/require-returns-description": "error",
"jsdoc/check-alignment": "error",
"jsdoc/check-param-names": "error",
"react-hooks/exhaustive-deps": "error"
"react-hooks/exhaustive-deps": "error",
"sonarjs/todo-tag": "warn",
"sonarjs/redundant-type-aliases": "warn",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frano-m this is triggered for cases like the below in app/apis/catalog/ncpi-catalog/common/entities.ts. Not sure if it should be disabled, kept as a warn, and/or if we should remove those cases, do you have thoughts?

export type DbGapId = string;

"sonarjs/no-nested-conditional": "off"
},
"overrides": [
{
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "Checking commit message"

# Check for issue number
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo '🏗️👷 Checking your project before committing'

# Check Prettier
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ build

# dependencies
node_modules

# other (avoids breaking a link)
app/components/common/MDXContent/hca-dcp/downloadBatchCorrectionWarning.mdx
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"trailingComma": "es5"
}
4 changes: 2 additions & 2 deletions __tests__/project-matrix-mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const LYMPH_NODE = "lymph node";
const MOCK_PROJECT_MATRIX_FILE_0 = {
name: "123.loom",
size: 254147853,
url: "http://path/to/file0?version=0&catalog=dcp2ebi",
url: "https://path/to/file0?version=0&catalog=dcp2ebi",
};
const MOCK_PROJECT_MATRIX_FILE_1 = {
name: "456.loom",
size: 254147854,
url: "http://path/to/file1?version=0&catalog=dcp2ebi",
url: "https://path/to/file1?version=0&catalog=dcp2ebi",
};
const CONTRIBUTED_ANALYSES = {
genusSpecies: {
Expand Down
12 changes: 6 additions & 6 deletions app/apis/azul/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function isNullOrUndefined(value: any): boolean {
*/
export function processAggregatedOrArrayValue<
T,
K extends KeyOfTypeStringOrNullArray<T>
K extends KeyOfTypeStringOrNullArray<T>,
>(responseValues: T[], key: K): string[] {
// Aggregate key values across response values.
const values = aggregateResponseValues(
Expand All @@ -91,7 +91,7 @@ export function processAggregatedOrArrayValue<
*/
export function processAggregatedBooleanOrArrayValue<
T,
K extends KeyOfTypeBooleanOrNullArray<T>
K extends KeyOfTypeBooleanOrNullArray<T>,
>(responseValues: T[], key: K): string[] {
// Aggregate key values across response values.
const values = aggregateResponseValues(
Expand All @@ -114,7 +114,7 @@ export function processAggregatedBooleanOrArrayValue<
*/
export function processAggregatedNumberEntityValue<
T,
K extends KeyOfTypeNumberOrNull<T>
K extends KeyOfTypeNumberOrNull<T>,
>(responseValues: T[], key: K): number {
// Aggregate key values across response values.
return aggregateNumericalResponseValues(responseValues, key);
Expand All @@ -129,7 +129,7 @@ export function processAggregatedNumberEntityValue<
*/
export function processEntityArrayValue<
T,
K extends KeyOfTypeStringOrNullArray<T>
K extends KeyOfTypeStringOrNullArray<T>,
>(responseValues: T[], key: K, label = LABEL.UNSPECIFIED): string[] {
// Response values should be a singleton array; check for at least one value here.
if (responseValues.length === 0) {
Expand Down Expand Up @@ -202,7 +202,7 @@ export function processNumberEntityValue<T, K extends KeyOfTypeNumberOrNull<T>>(
*/
function aggregateNumericalResponseValues<
T,
K extends KeyOfTypeNumberOrNull<T>
K extends KeyOfTypeNumberOrNull<T>,
>(responseValues: T[], key: K): number {
return responseValues
.map((responseValue) => responseValue[key] as unknown as number)
Expand All @@ -217,7 +217,7 @@ function aggregateNumericalResponseValues<
*/
function aggregateResponseValues<
T,
K extends KeyOfTypeStringOrNullArray<T> | KeyOfTypeBooleanOrNullArray<T>
K extends KeyOfTypeStringOrNullArray<T> | KeyOfTypeBooleanOrNullArray<T>,
>(responseValues: T[], key: K): StringOrNullArray | BooleanOrNullArray {
return responseValues
.filter((responseValue) => !!responseValue[key])
Expand Down
2 changes: 1 addition & 1 deletion app/apis/azul/hca-dcp/archivePreview/archivePreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function fetchProjectMatrixArchiveFiles(
const response = await fetch(url);
const result = await response.json();
return bindArchiveFiles(result);
} catch (error) {
} catch {
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/apis/catalog/anvil-catalog/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const getConsortiumTitle = (
};

export const anvilCatalogStudyInputMapper = <
StudyType extends AnVILCatalogStudyAny
StudyType extends AnVILCatalogStudyAny,
>(
input: StudyType
): StudyType => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ArchivePreviewTableProps {
*/
function getArchivePreviewTableColumns<
T extends RowData,
TData = unknown
TData = unknown,
>(): ColumnDef<T, TData>[] {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FileLocationArchivePreview = ({
projectMatrixView,
}: FileLocationArchivePreviewProps): JSX.Element | null => {
const [open, setOpen] = useState<boolean>(false);
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO future loading state for archive preview dialog.
// eslint-disable-next-line @typescript-eslint/no-unused-vars, sonarjs/no-unused-vars, sonarjs/no-dead-store -- TODO future loading state for archive preview dialog.
const [loading, setLoading] = useState<boolean>(false);
return isArchivePreviewAvailable(projectMatrixView) ? (
<>
Expand Down
4 changes: 2 additions & 2 deletions app/utils/tsvParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const readDir = async function readDir(
try {
return fs.readdirSync(dir, options);
// eslint-disable-next-line no-empty -- copied from readFile function
} catch (err) {}
} catch {}
};

/**
Expand All @@ -72,7 +72,7 @@ export const readFile = async function readFile(
const jsonDirectory = process.cwd();
return fs.readFileSync(jsonDirectory + "/" + file, options);
// eslint-disable-next-line no-empty -- copied from anvil-portal
} catch (err) {}
} catch {}
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export const baseProjectEdits: ProjectEdit[] = [
analysisPortals: [
{
...GENOME_BROWSER,
url: "http://genome.ucsc.edu/cgi-bin/hgTracks?db=mm10&tabulamurisBarChart=pack",
url: "https://genome.ucsc.edu/cgi-bin/hgTracks?db=mm10&tabulamurisBarChart=pack",
},
{
...UCSC_CELL_BROWSER,
Expand Down Expand Up @@ -672,7 +672,7 @@ export const baseProjectEdits: ProjectEdit[] = [
},
{
...SHINY,
url: "http://devapp.lungmap.net/app/shinycell-lungmap-single-cell-multiomic",
url: "https://devapp.lungmap.net/app/shinycell-lungmap-single-cell-multiomic",
},
{
...TOPPCELL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function isContributorDataCurator(
function isValidUrl(testUrl: string): boolean {
try {
return Boolean(new URL(testUrl));
} catch (e) {
} catch {
return false;
}
}
Expand Down
37 changes: 24 additions & 13 deletions app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import {
} from "@databiosphere/findable-ui/lib/components/Export/common/entities";
import { CurrentQuery } from "@databiosphere/findable-ui/lib/components/Export/components/ExportSummary/components/ExportCurrentQuery/exportCurrentQuery";
import { Summary } from "@databiosphere/findable-ui/lib/components/Export/components/ExportSummary/components/ExportSelectedDataSummary/exportSelectedDataSummary";
import { ANCHOR_TARGET } from "@databiosphere/findable-ui/lib/components/Links/common/entities";
import {
ANCHOR_TARGET,
REL_ATTRIBUTE,
} from "@databiosphere/findable-ui/lib/components/Links/common/entities";
import { getConfig } from "@databiosphere/findable-ui/lib/config/config";
import { ViewContext } from "@databiosphere/findable-ui/lib/config/entities";
import {
Expand Down Expand Up @@ -712,11 +715,14 @@ export const buildCookieBanner = (): React.ComponentProps<
"This website uses cookies for security and analytics purposes. By using this site, you agree to these uses.",
secondaryAction: C.ButtonOutline({
children: "Learn More",
/* eslint-disable sonarjs/link-with-target-blank -- const used for NOOPRNER NOREFERRER */
onClick: () =>
window.open(
"https://data.humancellatlas.org/privacy",
ANCHOR_TARGET.BLANK
ANCHOR_TARGET.BLANK,
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this link to add noopener noreferrer since it was raising sonarjs/link-with-target-blank. I still had eslint-disable it since sonarjs doesn't recognize our usage of constants for that, the error went away when a constant wasn't used. Let me know if we should leave it as is, since I'm not sure if adding this is correct here @frano-m

),
/* eslint-enable sonarjs/link-with-target-blank -- check target blank links for the rest of the file */
}),
};
};
Expand Down Expand Up @@ -1642,7 +1648,9 @@ function getAnalysisPortalKeyValueFn(
const [, value] = keyValue;
if (value && typeof value === "string") {
const url = analysisPortals.find(({ label }) => label === value)?.url;
url && window.open(url, ANCHOR_TARGET.BLANK);
if (url) {
window.open(url, ANCHOR_TARGET.BLANK);
}
}
};
}
Expand Down Expand Up @@ -1957,7 +1965,7 @@ export function getGeneratedMatricesActionsColumnDef<T>(): ColumnDef<T> {
* @returns anatomical entity column def.
*/
export function getGeneratedMatricesAnatomicalEntityColumnDef<
T
T,
>(): ColumnDef<T> {
return {
accessorKey: HCA_DCP_CATEGORY_KEY.ORGAN,
Expand All @@ -1978,7 +1986,7 @@ export function getGeneratedMatricesAnatomicalEntityColumnDef<
* @returns content description column def.
*/
export function getGeneratedMatricesContentDescriptionColumnDef<
T
T,
>(): ColumnDef<T> {
return {
accessorKey: HCA_DCP_CATEGORY_KEY.CONTENT_DESCRIPTION,
Expand Down Expand Up @@ -2051,7 +2059,7 @@ export function getGeneratedMatricesGenusSpeciesColumnDef<T>(): ColumnDef<T> {
* @returns library construction method column def.
*/
export function getGeneratedMatricesLibraryConstructionMethodColumnDef<
T
T,
>(): ColumnDef<T> {
return {
accessorKey: HCA_DCP_CATEGORY_KEY.LIBRARY_CONSTRUCTION_METHOD,
Expand All @@ -2072,7 +2080,7 @@ export function getGeneratedMatricesLibraryConstructionMethodColumnDef<
* @returns matrix cell count column def.
*/
export function getGeneratedMatricesMatrixCellCountColumnDef<
T
T,
>(): ColumnDef<T> {
return {
accessorKey: HCA_DCP_CATEGORY_KEY.MATRIX_CELL_COUNT,
Expand Down Expand Up @@ -2416,12 +2424,15 @@ export const renderWhenUnAuthenticated = (
* @returns total cells from cellSuspensions.
*/
function rollUpTotalCells(entityResponse: EntityResponse): number | null {
return entityResponse.cellSuspensions.reduce((acc, { totalCells }) => {
if (totalCells) {
acc = (acc ?? 0) + totalCells;
}
return acc;
}, null as null | number);
return entityResponse.cellSuspensions.reduce(
(acc, { totalCells }) => {
if (totalCells) {
acc = (acc ?? 0) + totalCells;
}
return acc;
},
null as null | number
);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions e2e/anvil/anvil-backpages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
} from "../testFunctions";
import { ANVIL_TABS } from "./anvil-tabs";

//TODO: this should probably check a feature flag instead
//eslint-disable-next-line sonarjs/no-skipped-tests -- disabled since Export to Terra is disabled on AnVIL
test.skip("Smoke test `Export to Terra` button on the first available dataset", async ({
context,
page,
Expand All @@ -20,6 +22,8 @@ test.skip("Smoke test `Export to Terra` button on the first available dataset",
}
});

//TODO: this should probably check a feature flag instead
//eslint-disable-next-line sonarjs/no-skipped-tests -- disabled since Export to Terra is disabled on AnVIL
test.skip("Check access controls on the datasets backpages work for the first two tabs", async ({
page,
}) => {
Expand Down
10 changes: 2 additions & 8 deletions e2e/anvil/anvil-filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test("Check that all filters exist on the Files tab and are clickable", async ({
await testFilterPresence(page, ANVIL_TABS.FILES, ANVIL_FILTER_NAMES);
});

test("Check that the first filter on the Datasets tab creates at least one checkbox, and that checking up to the first five does not cause an error and does not cause there to be no entries in the table", async ({
test("Check that an arbitrary filter on the Datasets tab creates at least one checkbox, and that checking up to the first five does not cause an error and does not cause there to be no entries in the table", async ({
page,
}) => {
// Goto the datasets tab
Expand All @@ -77,13 +77,7 @@ test("Check that the first filter on the Datasets tab creates at least one check
// Select a filter
await page
.getByRole("button")
.getByText(
filterRegex(
ANVIL_FILTER_NAMES[
Math.floor(Math.random() * ANVIL_FILTER_NAMES.length)
]
)
)
.getByText(filterRegex(ANVIL_FILTER_NAMES[FILTER_INDEX_LIST[0]]))
.click();
// Expect all checkboxes to be unchecked initially and to work properly
await expect(page.getByRole("checkbox").first()).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion e2e/anvil/anvil-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ANVIL_TABS: AnvilCMGTabCollection = {
exportActionButtonText: "Open Terra",
exportRequestButtonText: "Request Link",
exportTabName: "Export",
exportUrlRegExp: /\.*\/export-to-terra/,
exportUrlRegExp: /\/export-to-terra/,
newTabMessage:
"If you are a new user or returning user, click sign in to continue.",
requestLandingMessage:
Expand Down
Loading
Loading