diff --git a/client/eslint.config.ts b/client/eslint.config.ts index e96856941a..d9d29b4f96 100644 --- a/client/eslint.config.ts +++ b/client/eslint.config.ts @@ -11,6 +11,8 @@ export default defineConfig([ { files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], plugins: { js }, + languageOptions: { globals: globals.jest, }, + ...js.configs.recommended, }, // tseslint.configs.recommended, pluginReact.configs.flat.recommended, @@ -40,6 +42,11 @@ export default defineConfig([ 'react-hooks/refs': 0, 'react/display-name': 0, 'react/prop-types': 0, + "no-unused-vars": ["error", { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + }], }, }, ]); diff --git a/client/src/components/Allocations/AllocationsCells.jsx b/client/src/components/Allocations/AllocationsCells.jsx index 45ef83d535..20cb176230 100644 --- a/client/src/components/Allocations/AllocationsCells.jsx +++ b/client/src/components/Allocations/AllocationsCells.jsx @@ -63,7 +63,7 @@ export const Remaining = ({ cell }) => { }; return (
- {cell.value.map(({ remaining, ratio, type, id }) => ( + {cell.value.map(({ remaining, ratio, type, _id }) => (
{ }; Header.propTypes = { page: string.isRequired }; -export const Actions = ({ page }) => { - const root = `${ROUTES.WORKBENCH}${ROUTES.ALLOCATIONS}/${page}`; +export const Actions = ({ _page }) => { return ( { @@ -48,7 +48,7 @@ const DataFilesLinkActions = ({ status, onClick }) => { disabled={disabled} type="primary" size="medium" - onClick={(e) => onClick('put')} + onClick={(_e) => onClick('put')} > Replace Link @@ -61,7 +61,7 @@ const DataFilesLinkActions = ({ status, onClick }) => { disabled={disabled} type="primary" size="long" - onClick={(e) => onClick('post')} + onClick={(_e) => onClick('post')} > Generate Link diff --git a/client/src/components/DataFiles/DataFilesModals/DataFilesModalTables/DataFilesModalListingTable.jsx b/client/src/components/DataFiles/DataFilesModals/DataFilesModalTables/DataFilesModalListingTable.jsx index 6072ef4e1f..c37227d8a9 100644 --- a/client/src/components/DataFiles/DataFilesModals/DataFilesModalTables/DataFilesModalListingTable.jsx +++ b/client/src/components/DataFiles/DataFilesModals/DataFilesModalTables/DataFilesModalListingTable.jsx @@ -10,7 +10,6 @@ import { import DataFilesTable from '../../DataFilesTable/DataFilesTable'; import { FileIcon } from '../../DataFilesListing/DataFilesListingCells'; import styles from './DataFilesModalListingTable.module.scss'; -import { useSelector, shallowEqual } from 'react-redux'; export function getCurrentDirectory(path) { return path.split('/').pop(); diff --git a/client/src/components/DataFiles/DataFilesModals/DataFilesMoveModal.jsx b/client/src/components/DataFiles/DataFilesModals/DataFilesMoveModal.jsx index 1faa2995ef..13424ce054 100644 --- a/client/src/components/DataFiles/DataFilesModals/DataFilesMoveModal.jsx +++ b/client/src/components/DataFiles/DataFilesModals/DataFilesMoveModal.jsx @@ -1,13 +1,8 @@ import React, { useCallback, useMemo, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import { useDispatch } from 'react-redux'; import { Modal, ModalHeader, ModalBody } from 'reactstrap'; import { useHistory, useLocation } from 'react-router-dom'; -import { - useSelectedFiles, - useFileListing, - useSystems, - useModal, -} from 'hooks/datafiles'; +import { useSelectedFiles, useFileListing, useModal } from 'hooks/datafiles'; import { useMove } from 'hooks/datafiles/mutations'; import DataFilesBreadcrumbs from '../DataFilesBreadcrumbs/DataFilesBreadcrumbs'; @@ -28,11 +23,6 @@ const DataFilesMoveModal = React.memo(() => { const { move, status, setStatus } = useMove(); const dispatch = useDispatch(); - const { data: systems } = useSystems(); - - const { fetchSelectedSystem } = useSystems(); - - const selectedSystem = fetchSelectedSystem(params); const reloadPage = () => { history.push(location.pathname); diff --git a/client/src/components/DataFiles/DataFilesModals/DataFilesRenameModal.jsx b/client/src/components/DataFiles/DataFilesModals/DataFilesRenameModal.jsx index f90b8235dc..0726928f73 100644 --- a/client/src/components/DataFiles/DataFilesModals/DataFilesRenameModal.jsx +++ b/client/src/components/DataFiles/DataFilesModals/DataFilesRenameModal.jsx @@ -17,14 +17,14 @@ const DataFilesRenameModal = () => { params: { api, scheme }, } = useFileListing('FilesListing'); - const { rename: renameCallback, setStatus } = useRename(); + const { rename: renameCallback, _setStatus } = useRename(); const toggle = () => toggleModal({ operation: 'rename', props: {} }); const dispatch = useDispatch(); const history = useHistory(); const location = useLocation(); - const reloadPage = (name, newPath) => { + const reloadPage = (_name, _newPath) => { history.push(location.pathname); }; diff --git a/client/src/components/DataFiles/DataFilesModals/DataFilesUploadModalListing/DataFilesUploadModalListingTable.jsx b/client/src/components/DataFiles/DataFilesModals/DataFilesUploadModalListing/DataFilesUploadModalListingTable.jsx index b692be1dd2..7e05ebdf93 100644 --- a/client/src/components/DataFiles/DataFilesModals/DataFilesUploadModalListing/DataFilesUploadModalListingTable.jsx +++ b/client/src/components/DataFiles/DataFilesModals/DataFilesUploadModalListing/DataFilesUploadModalListingTable.jsx @@ -58,7 +58,7 @@ function DataFilesUploadModalListingTable({ - {uploadedFiles.map((file, i) => ( + {uploadedFiles.map((file, _i) => ( {file.data.name} diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCompressModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCompressModal.test.jsx index bae234d732..fab9536d8c 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCompressModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCompressModal.test.jsx @@ -8,10 +8,7 @@ import DataFilesToolbarAppsModalFixture, { compressAppFixture, } from './DataFilesToolbarAppsModals.fixture'; import DataFilesCompressModal from '../DataFilesCompressModal'; -import { - getAllocationForToolbarAction, - getAppUtil, -} from 'hooks/datafiles/mutations/toolbarAppUtils'; +import { getAppUtil } from 'hooks/datafiles/mutations/toolbarAppUtils'; vi.mock('@tanstack/react-query'); vi.mock('hooks/datafiles/mutations/toolbarAppUtils'); diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCopyModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCopyModal.test.jsx index ca1ac5735d..36eb48d02a 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCopyModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesCopyModal.test.jsx @@ -161,7 +161,7 @@ describe('DataFilesCopyModal', () => { history.push('/workbench/data/tapis/private/test.system/'); const store = mockStore(initialMockState); - const { getByText, getByTestId } = renderComponent( + const { getByTestId } = renderComponent( , store, history diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesDownloadMessageModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesDownloadMessageModal.test.jsx index a206c9954a..c2cf711957 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesDownloadMessageModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesDownloadMessageModal.test.jsx @@ -39,7 +39,6 @@ describe('DataFilesDownloadMessageModal', () => { }); it('renders the data files download message modal', async () => { - const foo = {}; const store = mockStore({ ...DataFilesDownloadMessageModalFixture, allocations: { @@ -48,10 +47,7 @@ describe('DataFilesDownloadMessageModal', () => { } /*TODO fix DataFilesDownloadMessageModalFixture fixture*/, }); - const { findAllByText } = renderComponent( - , - store - ); + renderComponent(, store); await waitFor(async () => { await screen.findByText('Download'); @@ -93,7 +89,7 @@ describe('DataFilesDownloadMessageModal', () => { // Click on the Compress button to try and download the folder fireEvent.click(screen.getByText('Compress')); - const expectedArg = { + const _expectedArg = { filename: `Archive_${new Date().toISOString().split('.')[0]}`, files: DataFilesDownloadMessageModalFixture.files.selected.FilesListing.map( diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesMakePublicModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesMakePublicModal.test.jsx index a3ef10f2bc..6e53af503c 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesMakePublicModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesMakePublicModal.test.jsx @@ -5,7 +5,7 @@ import configureStore from 'redux-mock-store'; import DataFilesMakePublicModalFixture from './DataFilesMakePublicModal.fixture'; import systemsFixture from '../../fixtures/DataFiles.systems.fixture'; import renderComponent from 'utils/testing'; -import { fireEvent, wait } from '@testing-library/react'; +import { fireEvent } from '@testing-library/react'; const mockStore = configureStore(); @@ -25,7 +25,7 @@ describe('DataFilesMakePublicModal', () => { history.push('/workbench/data/tapis/private/test.system/'); const store = mockStore(initialMockState); - const { getAllByText, getAllByRole } = renderComponent( + const { getAllByText } = renderComponent( , store, history diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesManageProjectModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesManageProjectModal.test.jsx index 95430a66c9..fa2444f559 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesManageProjectModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesManageProjectModal.test.jsx @@ -51,7 +51,7 @@ const initialMockState = { describe('DataFilesManageProjectModal', () => { it('renders the manage project modal', () => { const store = mockStore(initialMockState); - const { getAllByText, debug } = renderComponent( + const { getAllByText } = renderComponent( , store ); diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesModalListingTable.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesModalListingTable.test.jsx index f8a9296021..d474d22f53 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesModalListingTable.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesModalListingTable.test.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { getCurrentDirectory, getParentPath, diff --git a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesProjectEditDescriptionModal.test.jsx b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesProjectEditDescriptionModal.test.jsx index 6a446f5289..1a2e770568 100644 --- a/client/src/components/DataFiles/DataFilesModals/tests/DataFilesProjectEditDescriptionModal.test.jsx +++ b/client/src/components/DataFiles/DataFilesModals/tests/DataFilesProjectEditDescriptionModal.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import configureStore from 'redux-mock-store'; import { createMemoryHistory } from 'history'; import renderComponent from 'utils/testing'; -import { fireEvent, waitFor, screen } from '@testing-library/react'; +import { fireEvent, waitFor } from '@testing-library/react'; import DataFilesProjectEditDescriptionModal from '../DataFilesProjectEditDescriptionModal'; import { projectsListingFixture, diff --git a/client/src/components/DataFiles/DataFilesProjectMembers/DataFilesProjectMembers.jsx b/client/src/components/DataFiles/DataFilesProjectMembers/DataFilesProjectMembers.jsx index 165191e524..6f8d8a850b 100644 --- a/client/src/components/DataFiles/DataFilesProjectMembers/DataFilesProjectMembers.jsx +++ b/client/src/components/DataFiles/DataFilesProjectMembers/DataFilesProjectMembers.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { Button, InfiniteScrollTable, LoadingSpinner } from '_common'; import { useDispatch, useSelector } from 'react-redux'; import { Input, Label } from 'reactstrap'; -import { SystemRoleSelector, ProjectRoleSelector } from './_cells'; +import { SystemRoleSelector } from './_cells'; import styles from './DataFilesProjectMembers.module.scss'; import { useSystemRole } from './_cells/SystemRoleSelector'; import './DataFilesProjectMembers.scss'; @@ -160,7 +160,7 @@ const DataFilesProjectMembers = ({ el.row.original.access !== 'owner' && !readOnlyTeam ? (