diff --git a/packages/openneuro-app/src/scripts/authentication/profile.ts b/packages/openneuro-app/src/scripts/authentication/profile.ts
index 9327a3309..c9db29e4f 100644
--- a/packages/openneuro-app/src/scripts/authentication/profile.ts
+++ b/packages/openneuro-app/src/scripts/authentication/profile.ts
@@ -1,6 +1,6 @@
import jwtDecode from "jwt-decode"
-interface OpenNeuroTokenProfile {
+export interface OpenNeuroTokenProfile {
sub: string
email: string
provider: string
diff --git a/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx b/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx
index 35bbbc49d..aac84a713 100644
--- a/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx
+++ b/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx
@@ -10,7 +10,6 @@ vi.mock("../../../uploader/uploader-view.jsx", () => ({
default: () => "mocked UploaderView",
}))
vi.mock("react-router-dom", async () => ({
- // @ts-ignore-check
...(await vi.importActual("react-router-dom")),
useNavigate: () => navigate,
}))
diff --git a/packages/openneuro-app/src/scripts/common/content/terms.tsx b/packages/openneuro-app/src/scripts/common/content/terms.tsx
index 65957254a..f6ae2a3e7 100644
--- a/packages/openneuro-app/src/scripts/common/content/terms.tsx
+++ b/packages/openneuro-app/src/scripts/common/content/terms.tsx
@@ -1,7 +1,7 @@
-import React, { ReactElement } from "react"
+import React from "react"
/** Terms and conditions content. */
-export function Terms(): ReactElement {
+export function Terms(): React.ReactElement {
return (
<>
diff --git a/packages/openneuro-app/src/scripts/components/data-table.tsx b/packages/openneuro-app/src/scripts/components/data-table.tsx
index f11a70850..7d7af3106 100644
--- a/packages/openneuro-app/src/scripts/components/data-table.tsx
+++ b/packages/openneuro-app/src/scripts/components/data-table.tsx
@@ -4,13 +4,14 @@ import {
flexRender,
getCoreRowModel,
getSortedRowModel,
- SortingState,
useReactTable,
} from "@tanstack/react-table"
+import type { SortingState } from "@tanstack/react-table"
import styled from "@emotion/styled"
import { format, isValid, parse } from "date-fns"
interface DataTableProps {
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
data: any[]
downloadFilename?: string
hideColumns?: string[]
@@ -55,6 +56,7 @@ export function extractDateString(dateString) {
return false
}
+/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
function CellFormat(props): any {
const value = props.getValue()
let extractedDate
@@ -86,6 +88,7 @@ export function DataTable({
Object.keys(data[0])
.filter((name) => !hideColumns.includes(name))
.map((name) =>
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
columnHelper.accessor(name as any, {
header: name,
cell: CellFormat,
diff --git a/packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx b/packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx
index fc96c1316..fc400d15f 100644
--- a/packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx
+++ b/packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx
@@ -33,7 +33,7 @@ const CreateSnapshotMutation = ({ datasetId, tag, changes }) => {
interface SnapshotDatasetProps {
datasetId: string
tag: string
- changes: Array
+ changes: string[]
}
const SnapshotDataset = ({ datasetId, tag, changes }: SnapshotDatasetProps) => (
diff --git a/packages/openneuro-app/src/scripts/dataset/comments/comment-editor.jsx b/packages/openneuro-app/src/scripts/dataset/comments/comment-editor.jsx
index 8ab8910ee..dcf18bae6 100644
--- a/packages/openneuro-app/src/scripts/dataset/comments/comment-editor.jsx
+++ b/packages/openneuro-app/src/scripts/dataset/comments/comment-editor.jsx
@@ -20,7 +20,7 @@ const CommentEditor = ({
)
const doAfterSubmit = () => {
setEditorState(EditorState.createEmpty())
- done && done()
+ if (done) done()
}
const disabled = editorState.getUndoStack().size === 0
return (
diff --git a/packages/openneuro-app/src/scripts/dataset/components/DatasetToolButton.tsx b/packages/openneuro-app/src/scripts/dataset/components/DatasetToolButton.tsx
index 6533ecae8..7e72b39ff 100644
--- a/packages/openneuro-app/src/scripts/dataset/components/DatasetToolButton.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/components/DatasetToolButton.tsx
@@ -1,5 +1,6 @@
import React from "react"
-import styled, { StyledComponent } from "@emotion/styled"
+import styled from "@emotion/styled"
+import type { StyledComponent } from "@emotion/styled"
import { Link } from "react-router-dom"
import { Tooltip } from "@openneuro/components/tooltip"
import { Icon } from "@openneuro/components/icon"
diff --git a/packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx b/packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx
index 5e44650fe..47cc803a1 100644
--- a/packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx
@@ -1,11 +1,11 @@
import React from "react"
import { DatasetToolButton } from "./DatasetToolButton"
-import styled, { StyledComponent } from "@emotion/styled"
+import styled from "@emotion/styled"
+import type { StyledComponent } from "@emotion/styled"
import { useAgreement } from "../../components/agreement"
-interface DatasetToolStyleProps {}
-
-export const DatasetToolStyle: StyledComponent = styled
+// eslint-disable-next-line @typescript-eslint/no-empty-object-type
+export const DatasetToolStyle: StyledComponent<{}> = styled
.span`
display: flex;
justify-content: flex-start;
diff --git a/packages/openneuro-app/src/scripts/dataset/files/file-tree.tsx b/packages/openneuro-app/src/scripts/dataset/files/file-tree.tsx
index 39348ee86..ad02c8b47 100644
--- a/packages/openneuro-app/src/scripts/dataset/files/file-tree.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/files/file-tree.tsx
@@ -17,6 +17,7 @@ interface FileTreeProps {
files: DatasetFile[]
editMode: boolean
defaultExpanded: boolean
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
datasetPermissions: any
toggleFileToDelete: ({ id, path, filename }) => void
isFileToBeDeleted: (id: string) => boolean
diff --git a/packages/openneuro-app/src/scripts/dataset/files/files.tsx b/packages/openneuro-app/src/scripts/dataset/files/files.tsx
index e5d267f0d..26c675e29 100644
--- a/packages/openneuro-app/src/scripts/dataset/files/files.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/files/files.tsx
@@ -39,7 +39,9 @@ interface FilesProps {
datasetName: string
files: DatasetFile[]
editMode: boolean
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
datasetPermissions: any
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
summary: any
}
diff --git a/packages/openneuro-app/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx b/packages/openneuro-app/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx
index d3269c334..ade0e406c 100644
--- a/packages/openneuro-app/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx
@@ -17,7 +17,9 @@ const FileViewerNifti = ({
limitFrames4D: 5,
},
]
- const nv = new Niivue({ dragAndDropEnabled: false })
+ const nv = new Niivue({
+ dragAndDropEnabled: false,
+ }) /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
;(window as any).niivue = nv
nv.attachToCanvas(canvas.current)
nv.loadVolumes(volumeList) // press the "v" key to cycle through views (axial, coronal, sagittal, 3D, etc.)
@@ -25,9 +27,9 @@ const FileViewerNifti = ({
nv.opts.multiplanarForceRender = true // ensure that we draw the time series graph in the tile usually reserved for the 3D render
nv.graph.normalizeValues = false // use raw data values on y-axis
nv.graph.opacity = 1.0 // show the graph
- // Notes:
+ // Notes:
// 1. If an image only has one volume, the timeseries graph will not be visible.
- // The 3D render will be placed in the graph tile instead.
+ // The 3D render will be placed in the graph tile instead.
// 2. Users can navigate volumes forward and backward in the series using the left and right arrow keys on desktop devices
// 3. On touch screens, users can tap on the timeseries graph to jump to a volume index
// 4. Users can load all volumes by clicking on the "..." displayed on the timeseries graph
diff --git a/packages/openneuro-app/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx b/packages/openneuro-app/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx
index 8891e1fc5..5544583a7 100644
--- a/packages/openneuro-app/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx
@@ -74,7 +74,6 @@ describe("SelectInput", () => {
)
const event = {
preventDefault() {
- null
},
target: { value: "false" },
}
diff --git a/packages/openneuro-app/src/scripts/dataset/fragments/copyable-tooltip.jsx b/packages/openneuro-app/src/scripts/dataset/fragments/copyable-tooltip.jsx
index 20dc74935..1e9036177 100644
--- a/packages/openneuro-app/src/scripts/dataset/fragments/copyable-tooltip.jsx
+++ b/packages/openneuro-app/src/scripts/dataset/fragments/copyable-tooltip.jsx
@@ -1,3 +1,4 @@
+import * as Sentry from "@sentry/react"
import React from "react"
import PropTypes from "prop-types"
import styled from "@emotion/styled"
@@ -44,12 +45,9 @@ function fallbackCopyTextToClipboard(text) {
textArea.select()
try {
- const success = document.execCommand("copy")
- console.log(
- `Copying text command was ${success ? "successful!" : "unsuccessful."}`,
- )
+ document.execCommand("copy")
} catch (err) {
- console.error("Could not copy text: ", err)
+ Sentry.captureException(err)
}
document.body.removeChild(textArea)
@@ -59,8 +57,8 @@ function copyTextToClipboard(text) {
if (!navigator.clipboard) fallbackCopyTextToClipboard(text)
else {
navigator.clipboard.writeText(text).then(
- () => console.log("Copying to clipboard was successful!"),
- (err) => console.error("Could not copy text: ", err),
+ () => {},
+ (err) => Sentry.captureException(err),
)
}
}
diff --git a/packages/openneuro-app/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx b/packages/openneuro-app/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx
index 98f1e79f2..c4236c8e0 100644
--- a/packages/openneuro-app/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx
@@ -1,7 +1,6 @@
import React from "react"
import type { FC } from "react"
import { gql, useMutation } from "@apollo/client"
-import { Link } from "react-router-dom"
import { Tooltip } from "@openneuro/components/tooltip"
import { Button } from "@openneuro/components/button"
diff --git a/packages/openneuro-app/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx b/packages/openneuro-app/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx
index 0476c4d8f..3d53ac1ad 100644
--- a/packages/openneuro-app/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx
@@ -13,6 +13,12 @@ const DELETE_REVIEWER = gql`
}
`
+// TODO - derive from GraphQL
+interface ReviewerUser {
+ id: string
+ email: string
+}
+
interface DeleteReviewerLinkProps {
datasetId: string
id: string
@@ -27,7 +33,7 @@ export const DeleteReviewerLink: FC = ({
}) => {
const [DeleteReviewerLink] = useMutation(DELETE_REVIEWER, {
update(cache, { data: { deleteReviewer } }) {
- const { reviewers } = cache.readFragment<{ reviewers: any[] }>({
+ const { reviewers } = cache.readFragment<{ reviewers: ReviewerUser[] }>({
id: `Dataset:${datasetId}`,
fragment: DATASET_REVIEWERS,
})
diff --git a/packages/openneuro-app/src/scripts/dataset/mutations/import-dataset.tsx b/packages/openneuro-app/src/scripts/dataset/mutations/import-dataset.tsx
index 019aa8718..6b3817941 100644
--- a/packages/openneuro-app/src/scripts/dataset/mutations/import-dataset.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/mutations/import-dataset.tsx
@@ -1,4 +1,4 @@
-import React, { FC, useState } from "react"
+import React, { useState } from "react"
import { gql, useApolloClient, useMutation } from "@apollo/client"
import { Button } from "@openneuro/components/button"
import { createDataset } from "../../uploader/upload-mutation"
@@ -25,7 +25,7 @@ interface ImportDatasetMutationProps {
disabled?: boolean | null
}
-export const ImportDatasetMutation: FC = ({
+export const ImportDatasetMutation: React.FC = ({
url,
disabled,
affirmedDefaced,
diff --git a/packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx b/packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx
index 64ca92778..ddfc62f32 100644
--- a/packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx
@@ -20,7 +20,7 @@ const CREATE_SNAPSHOT = gql`
interface CreateSnapshotMutationProps {
datasetId: string
tag: string
- changes: Array
+ changes: string[]
disabled: boolean
}
@@ -47,8 +47,7 @@ const CreateSnapshotMutation = ({
onClick={(): void => {
void snapshotDataset({
variables: { datasetId, tag, changes },
- }).then((data) => {
- console.log(data)
+ }).then((_data) => {
navigate(`/datasets/${datasetId}/versions/${tag}`)
})
}}
@@ -62,7 +61,7 @@ const CreateSnapshotMutation = ({
interface SnapshotDatasetProps {
datasetId: string
tag: string
- changes: Array
+ changes: string[]
disabled: boolean
}
diff --git a/packages/openneuro-app/src/scripts/dataset/routes/add-metadata.jsx b/packages/openneuro-app/src/scripts/dataset/routes/add-metadata.jsx
index a3865a5bb..dda3eaa6c 100644
--- a/packages/openneuro-app/src/scripts/dataset/routes/add-metadata.jsx
+++ b/packages/openneuro-app/src/scripts/dataset/routes/add-metadata.jsx
@@ -25,7 +25,7 @@ const runValidations = (values) =>
.map((validation) => {
const relevantValues = validation.fields.map((key) => values[key])
// TODO - This doesn't seem necessary?
- // @ts-expect-error
+ // @ts-expect-error this is a size 2 tuple but not checked due to jsx instead of tsx
const isValid = validation.check(relevantValues)
if (!isValid) return validation.errorMessage
})
@@ -52,7 +52,7 @@ const AddMetadata = ({ dataset }) => {
const errors = runValidations(newValues)
if (hasChanged(errors, validationErrors)) setValidationErrors(errors)
}
- // @ts-ignore-next-line
+ // @ts-expect-error location.state is not fully typed
const submitPath = location.state && location.state.submitPath
const user = getProfile(cookies)
const hasEdit = (user && user.admin) ||
diff --git a/packages/openneuro-app/src/scripts/dataset/routes/delete-page.tsx b/packages/openneuro-app/src/scripts/dataset/routes/delete-page.tsx
index db6660b49..876215c50 100644
--- a/packages/openneuro-app/src/scripts/dataset/routes/delete-page.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/routes/delete-page.tsx
@@ -11,7 +11,7 @@ import { HeaderRow3 } from "./styles/header-row"
interface DeletePageProps {
dataset: {
- permissions: Record
+ permissions: Record
id: string
}
}
diff --git a/packages/openneuro-app/src/scripts/dataset/routes/snapshot.tsx b/packages/openneuro-app/src/scripts/dataset/routes/snapshot.tsx
index 3b6c046bc..57a6a6d72 100644
--- a/packages/openneuro-app/src/scripts/dataset/routes/snapshot.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/routes/snapshot.tsx
@@ -1,5 +1,6 @@
import React, { useState } from "react"
-import semver, { ReleaseType } from "semver"
+import semver from "semver"
+import type { ReleaseType } from "semver"
import SnapshotDataset from "../mutations/snapshot"
import EditList from "../fragments/edit-list.jsx"
import { Button } from "@openneuro/components/button"
diff --git a/packages/openneuro-app/src/scripts/errors/errorBoundary.jsx b/packages/openneuro-app/src/scripts/errors/errorBoundary.jsx
index 6fd49b396..49a8693af 100644
--- a/packages/openneuro-app/src/scripts/errors/errorBoundary.jsx
+++ b/packages/openneuro-app/src/scripts/errors/errorBoundary.jsx
@@ -74,7 +74,7 @@ ErrorBoundary.propTypes = {
// specific use case
// ignore error in apollo lib
-// @ts-expect-error
+// @ts-expect-error TODO - this is incorrectly extended but working
class ErrorBoundaryAssertionFailureException extends ErrorBoundary {
constructor(props) {
super(props)
@@ -104,7 +104,6 @@ class ErrorBoundaryDeletePageException extends ErrorBoundary {
const throwError = !/^\/datasets\/ds\d{6}\/delete$/.test(
window.location.pathname,
)
- console.log(throwError)
return throwError
},
)
diff --git a/packages/openneuro-app/src/scripts/search/inputs/modality-select.tsx b/packages/openneuro-app/src/scripts/search/inputs/modality-select.tsx
index 04c7d291b..8b0472205 100644
--- a/packages/openneuro-app/src/scripts/search/inputs/modality-select.tsx
+++ b/packages/openneuro-app/src/scripts/search/inputs/modality-select.tsx
@@ -2,7 +2,8 @@ import React, { useContext } from "react"
import type { FC } from "react"
import { useNavigate } from "react-router-dom"
import { SearchParamsCtx } from "../search-params-ctx"
-import { flattenedModalities, SearchParams } from "../initial-search-params"
+import { flattenedModalities } from "../initial-search-params"
+import type { SearchParams } from "../initial-search-params"
import { FacetSelect } from "@openneuro/components/facets"
import { AccordionTab, AccordionWrap } from "@openneuro/components/accordion"
import initialSearchParams from "../initial-search-params"
diff --git a/packages/openneuro-app/src/scripts/search/inputs/sort-by-select.tsx b/packages/openneuro-app/src/scripts/search/inputs/sort-by-select.tsx
index e260610ea..792e9ff18 100644
--- a/packages/openneuro-app/src/scripts/search/inputs/sort-by-select.tsx
+++ b/packages/openneuro-app/src/scripts/search/inputs/sort-by-select.tsx
@@ -4,6 +4,7 @@ import { SearchParamsCtx } from "../search-params-ctx"
import { SearchSort } from "@openneuro/components/search-page"
interface SortBySelectProps {
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
variables: any
}
diff --git a/packages/openneuro-app/src/scripts/search/search-container.tsx b/packages/openneuro-app/src/scripts/search/search-container.tsx
index 989152314..6e1a20acf 100644
--- a/packages/openneuro-app/src/scripts/search/search-container.tsx
+++ b/packages/openneuro-app/src/scripts/search/search-container.tsx
@@ -45,6 +45,7 @@ import Helmet from "react-helmet"
import AdminUser from "../authentication/admin-user.jsx"
export interface SearchContainerProps {
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
portalContent?: Record
}
@@ -53,7 +54,9 @@ export interface SearchContainerProps {
*/
export const setDefaultSearch = (
modality: string,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
searchParams: Record,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
setSearchParams: (newParams: Record) => void,
query: URLSearchParams,
): void => {
diff --git a/packages/openneuro-app/src/scripts/search/search-params-ctx.tsx b/packages/openneuro-app/src/scripts/search/search-params-ctx.tsx
index d1007bbc3..3bfbe8e66 100644
--- a/packages/openneuro-app/src/scripts/search/search-params-ctx.tsx
+++ b/packages/openneuro-app/src/scripts/search/search-params-ctx.tsx
@@ -1,14 +1,16 @@
-import React, { createContext, FC, ReactNode, useContext } from "react"
+import * as Sentry from "@sentry/react"
+import React, { createContext, useContext } from "react"
import { useSearchParams } from "react-router-dom"
-import initialSearchParams, { SearchParams } from "./initial-search-params"
+import initialSearchParams from "./initial-search-params"
+import type { SearchParams } from "./initial-search-params"
export const SearchParamsCtx = createContext(null)
interface SearchParamsProviderProps {
- children: ReactNode
+ children: React.ReactNode
}
-export const SearchParamsProvider: FC = ({
+export const SearchParamsProvider: React.FC = ({
children,
}) => {
const [searchQuery, setSearch] = useSearchParams()
@@ -20,7 +22,7 @@ export const SearchParamsProvider: FC = ({
searchParams = JSON.parse(query)
}
} catch (err) {
- console.error(err)
+ Sentry.captureException(err)
}
const setSearchParams = (
diff --git a/packages/openneuro-app/src/scripts/sw.ts b/packages/openneuro-app/src/scripts/sw.ts
index c777981ec..6e222ac81 100644
--- a/packages/openneuro-app/src/scripts/sw.ts
+++ b/packages/openneuro-app/src/scripts/sw.ts
@@ -5,6 +5,7 @@
*/
export default null
declare const self: ServiceWorkerGlobalScope
+/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
const globalAny: any = global // Workaround for serviceWorkerOption type missing
const CACHE_NAME = "openneuro"
const CACHE_PATHS = globalAny.serviceWorkerOption.assets
diff --git a/packages/openneuro-app/src/scripts/users/username.tsx b/packages/openneuro-app/src/scripts/users/username.tsx
index 4cd6655a1..f697527f0 100644
--- a/packages/openneuro-app/src/scripts/users/username.tsx
+++ b/packages/openneuro-app/src/scripts/users/username.tsx
@@ -8,7 +8,6 @@ import { config } from "../config"
export const Username = ({ user }): JSX.Element => {
if (user.orcid) {
let orcidURL = "https://orcid.org/"
- console.log(config.auth.orcid)
if (config.auth.orcid.ORCID_API_ENDPOINT.includes("sandbox")) {
orcidURL = "https://sandbox.orcid.org/"
}
diff --git a/packages/openneuro-app/src/scripts/utils/gtag.js b/packages/openneuro-app/src/scripts/utils/gtag.js
index 58ca52499..b649296f7 100644
--- a/packages/openneuro-app/src/scripts/utils/gtag.js
+++ b/packages/openneuro-app/src/scripts/utils/gtag.js
@@ -1,8 +1,8 @@
/*global globalThis*/
globalThis.dataLayer = globalThis.dataLayer || []
-function gtag() {
- globalThis.dataLayer.push(arguments)
+function gtag(...args) {
+ globalThis.dataLayer.push(args)
}
gtag("js", new Date())
diff --git a/packages/openneuro-app/src/scripts/utils/user-login-modal-ctx.tsx b/packages/openneuro-app/src/scripts/utils/user-login-modal-ctx.tsx
index 2c436c788..d9656b32d 100644
--- a/packages/openneuro-app/src/scripts/utils/user-login-modal-ctx.tsx
+++ b/packages/openneuro-app/src/scripts/utils/user-login-modal-ctx.tsx
@@ -1,14 +1,14 @@
-import React, { createContext, FC, ReactNode, useState } from "react"
+import React, { createContext, useState } from "react"
import { UserLoginModal } from "@openneuro/components/modal"
import loginUrls from "../authentication/loginUrls"
export const UserModalOpenCtx = createContext(null)
interface UserModalOpenProviderProps {
- children: ReactNode
+ children: React.ReactNode
}
-export const UserModalOpenProvider: FC = ({
+export const UserModalOpenProvider: React.FC = ({
children,
}) => {
const [userModalOpen, setUserModalOpen] = useState(false)
diff --git a/packages/openneuro-app/src/scripts/workers/schema.ts b/packages/openneuro-app/src/scripts/workers/schema.ts
index dcbf3343c..430304b56 100644
--- a/packages/openneuro-app/src/scripts/workers/schema.ts
+++ b/packages/openneuro-app/src/scripts/workers/schema.ts
@@ -1,4 +1,4 @@
-import { runValidator } from "./schema.worker" // eslint-disable-line import/no-unresolved
+import { runValidator } from "./schema.worker"
import type { BIDSValidatorIssues } from "./worker-interface"
function init(files, options): Promise {
diff --git a/packages/openneuro-app/src/scripts/workers/validate.ts b/packages/openneuro-app/src/scripts/workers/validate.ts
index d72e76c18..41aa03d12 100644
--- a/packages/openneuro-app/src/scripts/workers/validate.ts
+++ b/packages/openneuro-app/src/scripts/workers/validate.ts
@@ -1,4 +1,4 @@
-import { runValidator } from "./validate.worker" // eslint-disable-line import/no-unresolved
+import { runValidator } from "./validate.worker"
import type { BIDSValidatorIssues } from "./worker-interface"
function init(files, options): Promise {
diff --git a/packages/openneuro-cli/src/actions.js b/packages/openneuro-cli/src/actions.js
index 3de2d0edd..589e6a1c9 100644
--- a/packages/openneuro-cli/src/actions.js
+++ b/packages/openneuro-cli/src/actions.js
@@ -70,7 +70,6 @@ const uploadDataset = async (
if (datasetId) {
// Check for dataset -> validation -> upload
// Get remote files and filter successful files out
- // eslint-disable-next-line no-console
console.log("Checking remote files...")
remoteFiles = await getDatasetFiles(client, datasetId)
} else {
@@ -79,7 +78,6 @@ const uploadDataset = async (
affirmedDefaced,
affirmedConsent,
})
- // eslint-disable-next-line no-console
console.log(`"${datasetId}" created`)
remoteFiles = [] // New dataset has no remote files
}
@@ -131,15 +129,12 @@ function isMissingDotOpenneuroError(err) {
function logSpecificError(errors) {
errors.forEach((err) => {
- // eslint-disable-next-line no-console
console.error(err)
})
}
function handleGenericErrors(err, dir) {
- // eslint-disable-next-line no-console
console.error(err)
- // eslint-disable-next-line no-console
console.error(`"${dir}" may not exist or is inaccessible`)
}
@@ -162,7 +157,6 @@ export const upload = (dir, cmd) => {
blacklistModalities: ["Microscopy"],
}
if (cmd.dataset) {
- // eslint-disable-next-line no-console
console.log(`Adding files to "${cmd.dataset}"`)
uploadDataset(dir, cmd.dataset, validatorOptions).then((datasetId) => {
if (datasetId) {
diff --git a/packages/openneuro-cli/src/createDataset.js b/packages/openneuro-cli/src/createDataset.js
index f7460bd9f..9a3070b8d 100644
--- a/packages/openneuro-cli/src/createDataset.js
+++ b/packages/openneuro-cli/src/createDataset.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import { gql } from "@apollo/client"
import inquirer from "inquirer"
import { getUrl } from "./config.js"
diff --git a/packages/openneuro-cli/src/download.js b/packages/openneuro-cli/src/download.js
index ecf3ddfea..c66909fd9 100644
--- a/packages/openneuro-cli/src/download.js
+++ b/packages/openneuro-cli/src/download.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import fs from "fs"
import path from "path"
import mkdirp from "mkdirp"
@@ -59,40 +60,36 @@ export const downloadFile = async (
fileUrl,
downloadProgress,
) => {
+ const fullPath = path.join(destination, filename)
+ // Create any needed parent dirs
+ mkdirp.sync(path.dirname(fullPath))
+ const writeStream = fs.createWriteStream(fullPath)
try {
- const fullPath = path.join(destination, filename)
- // Create any needed parent dirs
- mkdirp.sync(path.dirname(fullPath))
- const writeStream = fs.createWriteStream(fullPath)
- try {
- const response = await fetch(fileUrl, {
- headers: getFetchHeaders(),
- })
- const stream = response.body
- if (response.status === 200) {
- // Setup end/error handler with Promise interface
- const responsePromise = new Promise((resolve, reject) => {
- stream.on("end", () => resolve())
- stream.on("data", () => {
- downloadProgress.update(writeStream.bytesWritten)
- })
- stream.on("error", (err) => {
- reject(err)
- })
+ const response = await fetch(fileUrl, {
+ headers: getFetchHeaders(),
+ })
+ const stream = response.body
+ if (response.status === 200) {
+ // Setup end/error handler with Promise interface
+ const responsePromise = new Promise((resolve, reject) => {
+ stream.on("end", () => resolve())
+ stream.on("data", () => {
+ downloadProgress.update(writeStream.bytesWritten)
})
- // Start piping data
- stream.pipe(writeStream)
- return responsePromise
- } else {
- console.error(
- `Error ${response.status} fetching "${filename}" - ${response.statusText}`,
- )
- }
- } catch (err) {
- handleFetchReject(err)
+ stream.on("error", (err) => {
+ reject(err)
+ })
+ })
+ // Start piping data
+ stream.pipe(writeStream)
+ return responsePromise
+ } else {
+ console.error(
+ `Error ${response.status} fetching "${filename}" - ${response.statusText}`,
+ )
}
} catch (err) {
- throw err
+ handleFetchReject(err)
}
}
diff --git a/packages/openneuro-cli/src/gitAnnexRemote.js b/packages/openneuro-cli/src/gitAnnexRemote.js
index 37a603fb0..e55154432 100644
--- a/packages/openneuro-cli/src/gitAnnexRemote.js
+++ b/packages/openneuro-cli/src/gitAnnexRemote.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import readline from "readline"
import { once } from "events"
import { getRepoToken } from "./gitCredential.js"
diff --git a/packages/openneuro-cli/src/gitCredential.js b/packages/openneuro-cli/src/gitCredential.js
index cc91145be..fb4ef29ea 100644
--- a/packages/openneuro-cli/src/gitCredential.js
+++ b/packages/openneuro-cli/src/gitCredential.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import readline from "readline"
import { configuredClient } from "./configuredClient.js"
import { gql } from "@apollo/client"
diff --git a/packages/openneuro-cli/src/transferKey.js b/packages/openneuro-cli/src/transferKey.js
index 2a5e6de87..d102b9036 100644
--- a/packages/openneuro-cli/src/transferKey.js
+++ b/packages/openneuro-cli/src/transferKey.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import { stat } from "fs/promises"
import { createReadStream, createWriteStream } from "fs"
import { once } from "events"
diff --git a/packages/openneuro-client/src/client.d.ts b/packages/openneuro-client/src/client.d.ts
index 438ed9e19..16c84ac80 100644
--- a/packages/openneuro-client/src/client.d.ts
+++ b/packages/openneuro-client/src/client.d.ts
@@ -1,4 +1,5 @@
-import { ApolloClient, Query } from "@apollo/client"
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import type { ApolloClient, Query } from "@apollo/client"
export declare function createClient(
uri: string,
@@ -6,13 +7,13 @@ export declare function createClient(
getAuthorization?: () => string
fetch?: typeof fetch
clientVersion?: string
- links?: Array
+ links?: ApolloLink[]
ssrMode?: boolean
cache?: ApolloCache
},
): ApolloClient
-export async function* datasetGenerator(
+export declare function datasetGenerator(
client: ApolloClient,
query: Query,
): AsyncGenerator
diff --git a/packages/openneuro-client/src/client.js b/packages/openneuro-client/src/client.js
index 62e67080f..54c343a54 100644
--- a/packages/openneuro-client/src/client.js
+++ b/packages/openneuro-client/src/client.js
@@ -83,6 +83,7 @@ const compareVersionsLink = (clientVersion) =>
}
observer.next(result)
},
+ /* eslint-disable-next-line no-console */
error: console.error,
complete: observer.complete.bind(observer),
})
diff --git a/packages/openneuro-client/src/datasetGenerator.js b/packages/openneuro-client/src/datasetGenerator.js
index a4357e330..b430dce60 100644
--- a/packages/openneuro-client/src/datasetGenerator.js
+++ b/packages/openneuro-client/src/datasetGenerator.js
@@ -30,6 +30,7 @@ export async function* datasetGenerator(client, query = getDatasets) {
return null
}
} catch (e) {
+ // eslint-disable-next-line no-console
console.error(e)
return null
}
diff --git a/packages/openneuro-components/src/accordion/AccordionTab.tsx b/packages/openneuro-components/src/accordion/AccordionTab.tsx
index 72072c7d4..e5d963fb4 100644
--- a/packages/openneuro-components/src/accordion/AccordionTab.tsx
+++ b/packages/openneuro-components/src/accordion/AccordionTab.tsx
@@ -1,4 +1,4 @@
-import React, { FC, ReactNode } from "react"
+import React from "react"
import { Icon } from "../icon/Icon"
@@ -8,7 +8,7 @@ export interface AccordionTabProps {
children: React.ReactNode
id?: string
className?: string
- label: string | number | ReactNode
+ label: string | number | React.ReactNode
startOpen?: boolean
dropdown?: boolean
accordionStyle: AccordionTabStyle
@@ -18,7 +18,7 @@ export interface AccordionTabProps {
/**
* Primary UI component for user interaction
*/
-export const AccordionTab: FC = ({
+export const AccordionTab: React.FC = ({
children,
id,
label,
diff --git a/packages/openneuro-components/src/activity-slider/ActivitySlider.tsx b/packages/openneuro-components/src/activity-slider/ActivitySlider.tsx
index 6dfed674b..23a16e649 100644
--- a/packages/openneuro-components/src/activity-slider/ActivitySlider.tsx
+++ b/packages/openneuro-components/src/activity-slider/ActivitySlider.tsx
@@ -15,7 +15,8 @@ export interface ActivitySliderProps {
itemClass?: string
slideHeader?: React.ReactNode
responsive: ResponsiveType
- data: Array
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
+ data: any[]
}
const LeftArrow = ({ onClick }: ArrowProps) => (
@@ -46,7 +47,7 @@ export const ActivitySlider = ({
return (
{slideHeader}
- {/* @ts-expect-error */}
+ {/* @ts-expect-error type issues with react-multi-carousel package */}
- contentTwo?: Record
+ contentOne?: React.ReactNode
+ contentTwo?: React.ReactNode
}
export const AffiliateArticle: React.FC = ({
diff --git a/packages/openneuro-components/src/dropdown/Dropdown.tsx b/packages/openneuro-components/src/dropdown/Dropdown.tsx
index e36507cc7..8f10a79aa 100644
--- a/packages/openneuro-components/src/dropdown/Dropdown.tsx
+++ b/packages/openneuro-components/src/dropdown/Dropdown.tsx
@@ -1,29 +1,25 @@
import React, { useEffect, useRef } from "react"
export interface DropdownProps {
- label: Record
+ label: React.ReactNode
children: React.ReactNode
className?: string
}
export const Dropdown = ({ children, label, className }: DropdownProps) => {
const [isOpen, setIsOpen] = React.useState(false)
-
- function removeIsOpen(ref) {
- useEffect(() => {
- function handleClickOutside(event) {
- if (ref.current && !ref.current.contains(event.target)) {
- setIsOpen((_prevIsOpen) => false)
- }
- }
- document.addEventListener("mousedown", handleClickOutside)
- return () => {
- document.removeEventListener("mousedown", handleClickOutside)
- }
- }, [ref])
- }
const wrapperRef = useRef(null)
- removeIsOpen(wrapperRef)
+ useEffect(() => {
+ function handleClickOutside(event) {
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
+ setIsOpen((_prevIsOpen) => false)
+ }
+ }
+ document.addEventListener("mousedown", handleClickOutside)
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside)
+ }
+ }, [wrapperRef])
return (
diff --git a/packages/openneuro-components/src/facets/FacetSearch.tsx b/packages/openneuro-components/src/facets/FacetSearch.tsx
index 2c9400b7c..682dfd503 100644
--- a/packages/openneuro-components/src/facets/FacetSearch.tsx
+++ b/packages/openneuro-components/src/facets/FacetSearch.tsx
@@ -5,7 +5,7 @@ import type { InputPropsStyle } from "../input/Input"
export interface FacetSearchProps {
setTermValue: (string) => void
- pushTerm: React.Dispatch
>
+ pushTerm: React.Dispatch>
allTerms: string[]
className?: string
type?: string
diff --git a/packages/openneuro-components/src/front-page/ActivityHeader.tsx b/packages/openneuro-components/src/front-page/ActivityHeader.tsx
index 9e2fa31d7..0f3164237 100644
--- a/packages/openneuro-components/src/front-page/ActivityHeader.tsx
+++ b/packages/openneuro-components/src/front-page/ActivityHeader.tsx
@@ -2,7 +2,7 @@ import React from "react"
import { Icon } from "../icon/Icon"
import activityIcon from "../assets/activity-icon.png"
-export const ActivityHeader: React.FC = ({}) => {
+export const ActivityHeader: React.FC = () => {
return (
diff --git a/packages/openneuro-components/src/front-page/Contributors.tsx b/packages/openneuro-components/src/front-page/Contributors.tsx
index 9403757ac..5e8aedff1 100644
--- a/packages/openneuro-components/src/front-page/Contributors.tsx
+++ b/packages/openneuro-components/src/front-page/Contributors.tsx
@@ -3,7 +3,7 @@ import { Logo } from "../logo/Logo"
import { frontPage } from "../content/front-page-content.jsx"
-export const Contributors: React.FC = ({}) => {
+export const Contributors: React.FC = () => {
return (
diff --git a/packages/openneuro-components/src/front-page/Infographic.tsx b/packages/openneuro-components/src/front-page/Infographic.tsx
index 0bf5f5d44..9409dbf21 100644
--- a/packages/openneuro-components/src/front-page/Infographic.tsx
+++ b/packages/openneuro-components/src/front-page/Infographic.tsx
@@ -2,7 +2,7 @@ import React from "react"
import { frontPage } from "../content/front-page-content.jsx"
-export const Infographic: React.FC = ({}) => {
+export const Infographic: React.FC = () => {
return (
diff --git a/packages/openneuro-components/src/header/Header.tsx b/packages/openneuro-components/src/header/Header.tsx
index 50be9212f..9630cc249 100644
--- a/packages/openneuro-components/src/header/Header.tsx
+++ b/packages/openneuro-components/src/header/Header.tsx
@@ -14,7 +14,9 @@ export interface HeaderProps {
}
expanded?: boolean
isOpenSupport: boolean
- toggleLoginModal: (userModalParams?: Record
) => void
+ toggleLoginModal: (
+ userModalParams?: React.MouseEvent,
+ ) => void
signOutAndRedirect: () => void
toggleSupport: () => void
navigateToNewSearch: (resetSearchParams?: boolean) => void
diff --git a/packages/openneuro-components/src/icon/Icon.tsx b/packages/openneuro-components/src/icon/Icon.tsx
index a96eb1d1d..a56c4ae28 100644
--- a/packages/openneuro-components/src/icon/Icon.tsx
+++ b/packages/openneuro-components/src/icon/Icon.tsx
@@ -1,10 +1,10 @@
-import React, { ReactNode } from "react"
+import React from "react"
export interface IconProps {
primary?: boolean
secondary?: boolean
backgroundColor?: string
- label?: string | number | ReactNode
+ label?: string | number | React.ReactNode
disabled?: boolean
icon?: string
color?: string
diff --git a/packages/openneuro-components/src/input/TermSearch.tsx b/packages/openneuro-components/src/input/TermSearch.tsx
index 87b1d2c47..be1cdadb5 100644
--- a/packages/openneuro-components/src/input/TermSearch.tsx
+++ b/packages/openneuro-components/src/input/TermSearch.tsx
@@ -1,9 +1,12 @@
import React from "react"
-import { Input, InputPropsStyle } from "../input/Input"
-import { Button, ButtonPropsSize } from "../button/Button"
+import { Input } from "../input/Input"
+import type { InputPropsStyle } from "../input/Input"
+import { Button } from "../button/Button"
+import type { ButtonPropsSize } from "../button/Button"
export interface TermSearchProps {
setTermValue: (string) => void
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
pushTerm: React.Dispatch>
allTerms: string[]
className?: string
@@ -58,6 +61,7 @@ export const TermSearch = ({
onKeyDown={(e) =>
e.keyCode === 13 &&
!disabled &&
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
pushTerm(termValue as React.SetStateAction)}
/>