Skip to content

Commit 109465f

Browse files
author
Jonah Paten
authored
chore: updated dev dependencies (#4309) (#4318)
* chore: updated typescript (#4309) * chore: updated eslint plugins (#4309) * chore: updated more linting plugins and fixed sonarjs errors (#4309) * chore: updated and ran prettier (#3409) * chore: updated commitlint (#3409) * chore: updated babel-loader (#4309) * chore: updated got (#4309) * chore: updated playwright (#4309) * chore: updated husky (#4309) * chore: updated jest (#4309) * fix: moved next-mdx-remote to prod dependencies (#4309) * fix: renamed Error to MyError (#4309) * chore: diabled no-nested-conditional eslint rule (#4309)
1 parent e5b579e commit 109465f

File tree

30 files changed

+10682
-8534
lines changed

30 files changed

+10682
-8534
lines changed

.eslintrc.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"prettier",
1515
"plugin:prettier/recommended",
1616
"next",
17-
"plugin:sonarjs/recommended",
17+
"plugin:sonarjs/recommended-legacy",
1818
"plugin:eslint-comments/recommended"
1919
],
2020
"rules": {
@@ -57,7 +57,10 @@
5757
"jsdoc/require-returns-description": "error",
5858
"jsdoc/check-alignment": "error",
5959
"jsdoc/check-param-names": "error",
60-
"react-hooks/exhaustive-deps": "error"
60+
"react-hooks/exhaustive-deps": "error",
61+
"sonarjs/todo-tag": "warn",
62+
"sonarjs/redundant-type-aliases": "warn",
63+
"sonarjs/no-nested-conditional": "off"
6164
},
6265
"overrides": [
6366
{

.husky/commit-msg

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
echo "Checking commit message"
52

63
# Check for issue number

.husky/pre-commit

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
echo '🏗️👷 Checking your project before committing'
52

63
# Check Prettier

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ build
1717

1818
# dependencies
1919
node_modules
20+
21+
# other (avoids breaking a link)
22+
app/components/common/MDXContent/hca-dcp/downloadBatchCorrectionWarning.mdx

.prettierrc.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"trailingComma": "es5"
3+
}

__tests__/project-matrix-mapper.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const LYMPH_NODE = "lymph node";
2525
const MOCK_PROJECT_MATRIX_FILE_0 = {
2626
name: "123.loom",
2727
size: 254147853,
28-
url: "http://path/to/file0?version=0&catalog=dcp2ebi",
28+
url: "https://path/to/file0?version=0&catalog=dcp2ebi",
2929
};
3030
const MOCK_PROJECT_MATRIX_FILE_1 = {
3131
name: "456.loom",
3232
size: 254147854,
33-
url: "http://path/to/file1?version=0&catalog=dcp2ebi",
33+
url: "https://path/to/file1?version=0&catalog=dcp2ebi",
3434
};
3535
const CONTRIBUTED_ANALYSES = {
3636
genusSpecies: {

app/apis/azul/common/utils.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function isNullOrUndefined(value: any): boolean {
7070
*/
7171
export function processAggregatedOrArrayValue<
7272
T,
73-
K extends KeyOfTypeStringOrNullArray<T>
73+
K extends KeyOfTypeStringOrNullArray<T>,
7474
>(responseValues: T[], key: K): string[] {
7575
// Aggregate key values across response values.
7676
const values = aggregateResponseValues(
@@ -91,7 +91,7 @@ export function processAggregatedOrArrayValue<
9191
*/
9292
export function processAggregatedBooleanOrArrayValue<
9393
T,
94-
K extends KeyOfTypeBooleanOrNullArray<T>
94+
K extends KeyOfTypeBooleanOrNullArray<T>,
9595
>(responseValues: T[], key: K): string[] {
9696
// Aggregate key values across response values.
9797
const values = aggregateResponseValues(
@@ -114,7 +114,7 @@ export function processAggregatedBooleanOrArrayValue<
114114
*/
115115
export function processAggregatedNumberEntityValue<
116116
T,
117-
K extends KeyOfTypeNumberOrNull<T>
117+
K extends KeyOfTypeNumberOrNull<T>,
118118
>(responseValues: T[], key: K): number {
119119
// Aggregate key values across response values.
120120
return aggregateNumericalResponseValues(responseValues, key);
@@ -129,7 +129,7 @@ export function processAggregatedNumberEntityValue<
129129
*/
130130
export function processEntityArrayValue<
131131
T,
132-
K extends KeyOfTypeStringOrNullArray<T>
132+
K extends KeyOfTypeStringOrNullArray<T>,
133133
>(responseValues: T[], key: K, label = LABEL.UNSPECIFIED): string[] {
134134
// Response values should be a singleton array; check for at least one value here.
135135
if (responseValues.length === 0) {
@@ -202,7 +202,7 @@ export function processNumberEntityValue<T, K extends KeyOfTypeNumberOrNull<T>>(
202202
*/
203203
function aggregateNumericalResponseValues<
204204
T,
205-
K extends KeyOfTypeNumberOrNull<T>
205+
K extends KeyOfTypeNumberOrNull<T>,
206206
>(responseValues: T[], key: K): number {
207207
return responseValues
208208
.map((responseValue) => responseValue[key] as unknown as number)
@@ -217,7 +217,7 @@ function aggregateNumericalResponseValues<
217217
*/
218218
function aggregateResponseValues<
219219
T,
220-
K extends KeyOfTypeStringOrNullArray<T> | KeyOfTypeBooleanOrNullArray<T>
220+
K extends KeyOfTypeStringOrNullArray<T> | KeyOfTypeBooleanOrNullArray<T>,
221221
>(responseValues: T[], key: K): StringOrNullArray | BooleanOrNullArray {
222222
return responseValues
223223
.filter((responseValue) => !!responseValue[key])

app/apis/azul/hca-dcp/archivePreview/archivePreview.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export async function fetchProjectMatrixArchiveFiles(
5252
const response = await fetch(url);
5353
const result = await response.json();
5454
return bindArchiveFiles(result);
55-
} catch (error) {
55+
} catch {
5656
return [];
5757
}
5858
}

app/apis/catalog/anvil-catalog/common/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const getConsortiumTitle = (
6161
};
6262

6363
export const anvilCatalogStudyInputMapper = <
64-
StudyType extends AnVILCatalogStudyAny
64+
StudyType extends AnVILCatalogStudyAny,
6565
>(
6666
input: StudyType
6767
): StudyType => {

app/components/Detail/components/GeneratedMatricesTables/components/ArchivePreviewDialog/components/ArchivePreviewTable/archivePreviewTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface ArchivePreviewTableProps {
2525
*/
2626
function getArchivePreviewTableColumns<
2727
T extends RowData,
28-
TData = unknown
28+
TData = unknown,
2929
>(): ColumnDef<T, TData>[] {
3030
return [
3131
{

app/components/Detail/components/GeneratedMatricesTables/components/FileLocationArchivePreview/fileLocationArchivePreview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const FileLocationArchivePreview = ({
2424
projectMatrixView,
2525
}: FileLocationArchivePreviewProps): JSX.Element | null => {
2626
const [open, setOpen] = useState<boolean>(false);
27-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO future loading state for archive preview dialog.
27+
// 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.
2828
const [loading, setLoading] = useState<boolean>(false);
2929
return isArchivePreviewAvailable(projectMatrixView) ? (
3030
<>

app/utils/tsvParser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const readDir = async function readDir(
5353
try {
5454
return fs.readdirSync(dir, options);
5555
// eslint-disable-next-line no-empty -- copied from readFile function
56-
} catch (err) {}
56+
} catch {}
5757
};
5858

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

7878
/**

app/viewModelBuilders/azul/hca-dcp/common/projectMapper/projectEdits/constants.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export const baseProjectEdits: ProjectEdit[] = [
368368
analysisPortals: [
369369
{
370370
...GENOME_BROWSER,
371-
url: "http://genome.ucsc.edu/cgi-bin/hgTracks?db=mm10&tabulamurisBarChart=pack",
371+
url: "https://genome.ucsc.edu/cgi-bin/hgTracks?db=mm10&tabulamurisBarChart=pack",
372372
},
373373
{
374374
...UCSC_CELL_BROWSER,
@@ -672,7 +672,7 @@ export const baseProjectEdits: ProjectEdit[] = [
672672
},
673673
{
674674
...SHINY,
675-
url: "http://devapp.lungmap.net/app/shinycell-lungmap-single-cell-multiomic",
675+
url: "https://devapp.lungmap.net/app/shinycell-lungmap-single-cell-multiomic",
676676
},
677677
{
678678
...TOPPCELL,

app/viewModelBuilders/azul/hca-dcp/common/projectMapper/projectMapper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function isContributorDataCurator(
296296
function isValidUrl(testUrl: string): boolean {
297297
try {
298298
return Boolean(new URL(testUrl));
299-
} catch (e) {
299+
} catch {
300300
return false;
301301
}
302302
}

app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts

+24-13
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import {
2222
} from "@databiosphere/findable-ui/lib/components/Export/common/entities";
2323
import { CurrentQuery } from "@databiosphere/findable-ui/lib/components/Export/components/ExportSummary/components/ExportCurrentQuery/exportCurrentQuery";
2424
import { Summary } from "@databiosphere/findable-ui/lib/components/Export/components/ExportSummary/components/ExportSelectedDataSummary/exportSelectedDataSummary";
25-
import { ANCHOR_TARGET } from "@databiosphere/findable-ui/lib/components/Links/common/entities";
25+
import {
26+
ANCHOR_TARGET,
27+
REL_ATTRIBUTE,
28+
} from "@databiosphere/findable-ui/lib/components/Links/common/entities";
2629
import { getConfig } from "@databiosphere/findable-ui/lib/config/config";
2730
import { ViewContext } from "@databiosphere/findable-ui/lib/config/entities";
2831
import {
@@ -712,11 +715,14 @@ export const buildCookieBanner = (): React.ComponentProps<
712715
"This website uses cookies for security and analytics purposes. By using this site, you agree to these uses.",
713716
secondaryAction: C.ButtonOutline({
714717
children: "Learn More",
718+
/* eslint-disable sonarjs/link-with-target-blank -- const used for NOOPRNER NOREFERRER */
715719
onClick: () =>
716720
window.open(
717721
"https://data.humancellatlas.org/privacy",
718-
ANCHOR_TARGET.BLANK
722+
ANCHOR_TARGET.BLANK,
723+
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
719724
),
725+
/* eslint-enable sonarjs/link-with-target-blank -- check target blank links for the rest of the file */
720726
}),
721727
};
722728
};
@@ -1642,7 +1648,9 @@ function getAnalysisPortalKeyValueFn(
16421648
const [, value] = keyValue;
16431649
if (value && typeof value === "string") {
16441650
const url = analysisPortals.find(({ label }) => label === value)?.url;
1645-
url && window.open(url, ANCHOR_TARGET.BLANK);
1651+
if (url) {
1652+
window.open(url, ANCHOR_TARGET.BLANK);
1653+
}
16461654
}
16471655
};
16481656
}
@@ -1957,7 +1965,7 @@ export function getGeneratedMatricesActionsColumnDef<T>(): ColumnDef<T> {
19571965
* @returns anatomical entity column def.
19581966
*/
19591967
export function getGeneratedMatricesAnatomicalEntityColumnDef<
1960-
T
1968+
T,
19611969
>(): ColumnDef<T> {
19621970
return {
19631971
accessorKey: HCA_DCP_CATEGORY_KEY.ORGAN,
@@ -1978,7 +1986,7 @@ export function getGeneratedMatricesAnatomicalEntityColumnDef<
19781986
* @returns content description column def.
19791987
*/
19801988
export function getGeneratedMatricesContentDescriptionColumnDef<
1981-
T
1989+
T,
19821990
>(): ColumnDef<T> {
19831991
return {
19841992
accessorKey: HCA_DCP_CATEGORY_KEY.CONTENT_DESCRIPTION,
@@ -2051,7 +2059,7 @@ export function getGeneratedMatricesGenusSpeciesColumnDef<T>(): ColumnDef<T> {
20512059
* @returns library construction method column def.
20522060
*/
20532061
export function getGeneratedMatricesLibraryConstructionMethodColumnDef<
2054-
T
2062+
T,
20552063
>(): ColumnDef<T> {
20562064
return {
20572065
accessorKey: HCA_DCP_CATEGORY_KEY.LIBRARY_CONSTRUCTION_METHOD,
@@ -2072,7 +2080,7 @@ export function getGeneratedMatricesLibraryConstructionMethodColumnDef<
20722080
* @returns matrix cell count column def.
20732081
*/
20742082
export function getGeneratedMatricesMatrixCellCountColumnDef<
2075-
T
2083+
T,
20762084
>(): ColumnDef<T> {
20772085
return {
20782086
accessorKey: HCA_DCP_CATEGORY_KEY.MATRIX_CELL_COUNT,
@@ -2416,12 +2424,15 @@ export const renderWhenUnAuthenticated = (
24162424
* @returns total cells from cellSuspensions.
24172425
*/
24182426
function rollUpTotalCells(entityResponse: EntityResponse): number | null {
2419-
return entityResponse.cellSuspensions.reduce((acc, { totalCells }) => {
2420-
if (totalCells) {
2421-
acc = (acc ?? 0) + totalCells;
2422-
}
2423-
return acc;
2424-
}, null as null | number);
2427+
return entityResponse.cellSuspensions.reduce(
2428+
(acc, { totalCells }) => {
2429+
if (totalCells) {
2430+
acc = (acc ?? 0) + totalCells;
2431+
}
2432+
return acc;
2433+
},
2434+
null as null | number
2435+
);
24252436
}
24262437

24272438
/**

e2e/anvil/anvil-backpages.spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
} from "../testFunctions";
77
import { ANVIL_TABS } from "./anvil-tabs";
88

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

25+
//TODO: this should probably check a feature flag instead
26+
//eslint-disable-next-line sonarjs/no-skipped-tests -- disabled since Export to Terra is disabled on AnVIL
2327
test.skip("Check access controls on the datasets backpages work for the first two tabs", async ({
2428
page,
2529
}) => {

e2e/anvil/anvil-filters.spec.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test("Check that all filters exist on the Files tab and are clickable", async ({
6565
await testFilterPresence(page, ANVIL_TABS.FILES, ANVIL_FILTER_NAMES);
6666
});
6767

68-
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 ({
68+
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 ({
6969
page,
7070
}) => {
7171
// Goto the datasets tab
@@ -77,13 +77,7 @@ test("Check that the first filter on the Datasets tab creates at least one check
7777
// Select a filter
7878
await page
7979
.getByRole("button")
80-
.getByText(
81-
filterRegex(
82-
ANVIL_FILTER_NAMES[
83-
Math.floor(Math.random() * ANVIL_FILTER_NAMES.length)
84-
]
85-
)
86-
)
80+
.getByText(filterRegex(ANVIL_FILTER_NAMES[FILTER_INDEX_LIST[0]]))
8781
.click();
8882
// Expect all checkboxes to be unchecked initially and to work properly
8983
await expect(page.getByRole("checkbox").first()).toBeVisible();

e2e/anvil/anvil-tabs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const ANVIL_TABS: AnvilCMGTabCollection = {
9494
exportActionButtonText: "Open Terra",
9595
exportRequestButtonText: "Request Link",
9696
exportTabName: "Export",
97-
exportUrlRegExp: /\.*\/export-to-terra/,
97+
exportUrlRegExp: /\/export-to-terra/,
9898
newTabMessage:
9999
"If you are a new user or returning user, click sign in to continue.",
100100
requestLandingMessage:

0 commit comments

Comments
 (0)