From 615b1e33201819d04a3bdbbe69236b5f56e675e7 Mon Sep 17 00:00:00 2001 From: Colin Diesh Date: Mon, 12 Aug 2024 13:00:33 -0400 Subject: [PATCH] Add new eslint rules (no-unnecessary-condition, no-unused-expressions, etc) and tsconfig noUncheckedIndexedAccess (#4513) --- .eslintignore | 26 - .eslintrc.js | 206 ----- config/jest/babelTransform.js | 1 - config/jest/console.js | 3 +- config/jest/textEncoder.js | 11 +- docs/generateConfigDocs.ts | 2 +- docs/generateStateModelDocs.ts | 8 +- eslint.config.mjs | 205 +++++ package.json | 10 +- .../@jbrowse/core/util/useMeasure.ts | 2 +- packages/app-core/src/JBrowseModel/index.ts | 10 +- packages/app-core/src/RootMenu/index.ts | 12 +- packages/app-core/src/ui/App/App.tsx | 2 +- packages/app-core/src/ui/App/AppFab.tsx | 4 +- packages/app-core/src/ui/App/AppToolbar.tsx | 2 +- packages/app-core/src/ui/App/Drawer.tsx | 2 +- .../app-core/src/ui/App/DrawerControls.tsx | 12 +- packages/app-core/src/ui/App/DrawerHeader.tsx | 11 +- packages/app-core/src/ui/App/DrawerWidget.tsx | 11 +- .../src/ui/App/DrawerWidgetSelector.tsx | 8 +- packages/app-core/src/ui/App/ModalWidget.tsx | 19 +- .../app-core/src/ui/App/ViewContainer.tsx | 2 +- .../src/ui/App/ViewContainerTitle.tsx | 4 +- packages/app-core/src/ui/App/ViewHeader.tsx | 4 +- packages/app-core/src/ui/App/ViewLauncher.tsx | 16 +- packages/app-core/src/ui/App/ViewMenu.tsx | 29 +- packages/app-core/src/ui/App/ViewPanel.tsx | 8 +- .../BaseFeatureDetail/DataGridDetails.tsx | 6 +- .../BaseFeatureDetail/index.tsx | 8 +- .../BaseFeatureDetail/util.ts | 2 +- .../SequenceFeatureDetails.test.tsx | 8 +- .../SequenceFeatureDetails.tsx | 52 +- .../SequenceFeaturePanel.tsx | 15 +- .../dialogs/HelpDialog.tsx | 12 +- .../dialogs/SequenceDialog.tsx | 55 +- .../dialogs/SequenceFeatureMenu.tsx | 20 +- .../dialogs/SequenceTypeSelector.tsx | 4 +- .../dialogs/SettingsDialog.tsx | 20 +- .../SequenceFeatureDetails/hooks.ts | 2 +- .../seqtypes/CDNASequence.tsx | 2 +- .../__snapshots__/index.test.tsx.snap | 38 +- .../core/BaseFeatureWidget/index.test.tsx | 6 +- .../BaseFeatureWidget/stateModelFactory.ts | 2 - packages/core/BaseFeatureWidget/util.tsx | 6 +- packages/core/PluginLoader.ts | 32 +- packages/core/PluginManager.ts | 30 +- packages/core/ReExports/modules.tsx | 12 +- packages/core/TextSearch/TextSearchManager.ts | 2 +- packages/core/assemblyManager/assembly.ts | 15 +- .../assemblyManager/assemblyConfigSchema.ts | 31 +- .../core/assemblyManager/assemblyManager.ts | 7 +- .../core/configuration/configurationSchema.ts | 1 - .../core/configuration/configurationSlot.ts | 16 +- packages/core/configuration/types.ts | 1 - packages/core/configuration/util.ts | 9 +- .../BaseAdapter/BaseFeatureDataAdapter.ts | 14 +- .../CytobandAdapter/CytobandAdapter.ts | 10 +- .../core/data_adapters/dataAdapterCache.ts | 42 +- .../AddTrackWorkflowType.ts | 8 +- .../pluggableElementTypes/ConnectionType.ts | 6 - .../core/pluggableElementTypes/DisplayType.ts | 20 - .../InternetAccountType.ts | 15 - .../TextSearchAdapterType.ts | 3 - .../core/pluggableElementTypes/TrackType.ts | 11 - .../core/pluggableElementTypes/ViewType.ts | 19 +- .../core/pluggableElementTypes/WidgetType.ts | 7 - .../models/BaseConnectionModelFactory.ts | 10 +- .../models/BaseDisplayModel.tsx | 23 +- .../models/BaseTrackModel.ts | 16 +- .../models/InternetAccountModel.ts | 10 +- .../models/baseTrackConfig.ts | 9 +- .../renderers/BoxRendererType.ts | 49 +- .../renderers/CircularChordRendererType.tsx | 3 +- .../ComparativeServerSideRendererType.ts | 29 +- .../renderers/FeatureRendererType.ts | 18 +- .../renderers/RendererType.ts | 13 - .../renderers/RpcRenderedSvgGroup.tsx | 16 +- .../renderers/ServerSideRenderedContent.tsx | 10 +- .../renderers/ServerSideRendererType.tsx | 18 +- .../renderers/util/serializableFilterChain.ts | 2 - packages/core/rpc/BaseRpcDriver.ts | 32 +- packages/core/rpc/MainThreadRpcDriver.ts | 3 + packages/core/rpc/RpcManager.ts | 7 +- packages/core/rpc/WebWorkerRpcDriver.ts | 8 +- packages/core/rpc/configSchema.ts | 1 - .../core/rpc/methods/CoreGetFeatureDetails.ts | 16 +- packages/core/rpc/methods/CoreGetFeatures.ts | 2 +- packages/core/rpc/methods/util.ts | 3 - packages/core/ui/AssemblySelector.tsx | 4 +- packages/core/ui/CascadingMenu.tsx | 2 +- packages/core/ui/CascadingMenuButton.tsx | 4 +- packages/core/ui/ColorPicker.tsx | 16 +- packages/core/ui/DropDownMenu.tsx | 6 +- packages/core/ui/EditableTypography.tsx | 8 +- packages/core/ui/ErrorMessage.tsx | 15 +- .../core/ui/ErrorMessageStackTraceDialog.tsx | 18 +- packages/core/ui/FactoryResetDialog.tsx | 19 +- packages/core/ui/FatalErrorDialog.tsx | 12 +- .../core/ui/FileSelector/FileSelector.tsx | 18 +- .../core/ui/FileSelector/LocalFileChooser.tsx | 2 +- packages/core/ui/LoadingEllipses.tsx | 2 +- packages/core/ui/Menu.tsx | 8 +- packages/core/ui/MenuButton.tsx | 11 +- packages/core/ui/PrerenderedCanvas.tsx | 1 - packages/core/ui/ReturnToImportFormDialog.tsx | 4 +- packages/core/ui/SanitizedHTML.tsx | 1 - packages/core/ui/theme.ts | 12 +- packages/core/util/Base1DUtils.ts | 16 +- packages/core/util/QuickLRU.js | 16 +- packages/core/util/TimeTraveller.ts | 18 +- packages/core/util/analytics.ts | 3 +- packages/core/util/blockTypes.ts | 18 +- packages/core/util/calculateDynamicBlocks.ts | 2 +- .../core/util/calculateStaticBlocks.test.ts | 5 +- packages/core/util/calculateStaticBlocks.ts | 2 +- packages/core/util/compositeMap.ts | 4 +- packages/core/util/idMaker.ts | 2 +- packages/core/util/index.test.ts | 4 +- packages/core/util/index.ts | 109 ++- .../core/util/io/RemoteFileWithRangeCache.ts | 8 +- packages/core/util/io/index.ts | 20 +- packages/core/util/jexlStrings.test.ts | 1 - packages/core/util/jexlStrings.ts | 17 +- .../util/layouts/GranularRectLayout.test.js | 127 --- .../util/layouts/GranularRectLayout.test.ts | 134 +++ .../core/util/layouts/GranularRectLayout.ts | 5 +- packages/core/util/layouts/MultiLayout.ts | 1 - .../core/util/layouts/PrecomputedLayout.ts | 2 +- packages/core/util/layouts/SceneGraph.ts | 4 +- packages/core/util/map-obj.ts | 10 +- packages/core/util/mst-reflection.ts | 5 +- packages/core/util/nanoid.js | 4 +- .../core/util/offscreenCanvasPonyfill.tsx | 19 +- packages/core/util/offscreenCanvasUtils.tsx | 5 +- .../util/{range.test.js => range.test.ts} | 3 +- packages/core/util/rxjs.ts | 4 +- packages/core/util/simpleFeature.ts | 52 +- packages/core/util/stats.ts | 7 +- packages/core/util/tracks.ts | 17 +- packages/core/util/types/index.ts | 13 +- packages/core/util/types/mst.ts | 1 + packages/core/util/types/util.ts | 1 - packages/core/util/useMeasure.ts | 4 +- packages/core/util/when.ts | 8 +- packages/embedded-core/src/ui/ModalWidget.tsx | 49 +- packages/embedded-core/src/ui/ViewMenu.tsx | 10 +- packages/embedded-core/src/ui/ViewTitle.tsx | 10 +- .../src/RootModel/InternetAccounts.ts | 5 +- .../product-core/src/Session/Connections.ts | 4 +- .../src/Session/ReferenceManagement.ts | 8 +- packages/product-core/src/Session/Tracks.ts | 4 +- packages/product-core/src/ui/AboutDialog.tsx | 1 - .../src/ui/AboutDialogContents.tsx | 15 +- .../product-core/src/ui/FileInfoPanel.tsx | 4 +- .../product-core/src/ui/RefNameInfoDialog.tsx | 12 +- packages/text-indexing/src/TextIndexing.ts | 25 +- .../text-indexing/src/types/common.test.ts | 8 +- packages/text-indexing/src/types/common.ts | 2 +- .../text-indexing/src/types/gff3Adapter.ts | 10 +- .../text-indexing/src/types/vcfAdapter.ts | 9 +- packages/text-indexing/src/util.ts | 9 +- packages/web-core/src/BaseWebSession/index.ts | 27 +- plugin-development-tools/tsconfig.json | 1 - .../BreakendOptionDialog.tsx | 16 +- .../src/AlignmentsFeatureDetail/Formatter.tsx | 11 +- .../LaunchBreakpointSplitViewPanel.tsx | 2 +- .../SuppAlignmentsLocStrings.tsx | 6 +- .../__snapshots__/index.test.tsx.snap | 75 +- .../AlignmentsFeatureDetail/getSAFeatures.ts | 10 +- .../AlignmentsFeatureDetail/index.test.tsx | 6 +- .../launchBreakpointSplitView.tsx | 10 +- .../alignments/src/AlignmentsTrack/index.ts | 4 +- .../src/BamAdapter/BamAdapter.test.ts | 6 +- .../alignments/src/BamAdapter/BamAdapter.ts | 4 +- .../src/BamAdapter/BamSlightlyLazyFeature.ts | 2 - .../src/CramAdapter/CramAdapter.test.ts | 4 +- .../alignments/src/CramAdapter/CramAdapter.ts | 4 +- .../CramAdapter/CramSlightlyLazyFeature.ts | 1 - .../src/CramAdapter/CramTestAdapters.ts | 12 +- .../models/alignmentsModel.tsx | 2 +- .../models/configSchema.test.ts | 60 -- .../models/configSchema.ts | 4 +- .../LinearAlignmentsDisplay/models/model.tsx | 9 +- .../SharedLinearPileupDisplayMixin.ts | 43 +- .../components/ColorByModifications.tsx | 4 +- .../components/ColorByTag.tsx | 4 +- .../components/LinearPileupDisplayBlurb.tsx | 8 +- .../components/SetFeatureHeight.tsx | 12 +- .../components/SetMaxHeight.tsx | 8 +- .../components/SortByTag.tsx | 8 +- .../src/LinearPileupDisplay/configSchema.ts | 3 +- .../src/LinearPileupDisplay/model.ts | 21 +- .../src/LinearReadArcsDisplay/drawFeats.ts | 10 +- .../src/LinearReadArcsDisplay/model.ts | 49 +- .../src/LinearReadArcsDisplay/util.ts | 2 +- .../components/ReactComponent.tsx | 4 +- .../src/LinearReadCloudDisplay/drawFeats.ts | 2 +- .../drawLongReadChains.ts | 10 +- .../LinearReadCloudDisplay/drawPairChains.ts | 6 +- .../src/LinearReadCloudDisplay/model.ts | 21 +- .../components/Tooltip.tsx | 30 +- .../models/configSchema.test.js | 67 -- .../models/configSchema.ts | 2 +- .../LinearSNPCoverageDisplay/models/model.ts | 14 +- .../alignments/src/MismatchParser/index.ts | 50 +- .../src/PileupRenderer/PileupLayoutSession.ts | 8 +- .../src/PileupRenderer/PileupRenderer.ts | 36 +- .../alignments/src/PileupRenderer/colorBy.ts | 2 +- .../components/PileupRendering.tsx | 42 +- .../PileupRenderer/getAlignmentShapeColor.ts | 36 +- .../src/PileupRenderer/layoutFeature.ts | 6 +- .../src/PileupRenderer/layoutFeatures.ts | 9 +- .../src/PileupRenderer/renderAlignment.ts | 2 +- .../PileupRenderer/renderAlignmentShape.ts | 2 +- .../src/PileupRenderer/renderMismatches.ts | 4 +- .../PileupRenderer/renderPerBaseLettering.ts | 8 +- .../PileupRenderer/renderPerBaseQuality.ts | 6 +- .../src/PileupRenderer/renderSoftClipping.ts | 8 +- .../alignments/src/PileupRenderer/sortUtil.ts | 2 +- .../generateCoverageBins.ts | 20 +- .../SNPCoverageRenderer.ts | 20 +- .../src/__snapshots__/index.test.ts.snap | 3 - plugins/alignments/src/index.test.ts | 17 - plugins/alignments/src/index.ts | 4 +- .../src/shared/BaseDisplayComponent.tsx | 7 +- plugins/alignments/src/shared/FilterByTag.tsx | 20 +- plugins/alignments/src/shared/index.ts | 4 +- plugins/alignments/src/shared/renderSvg.tsx | 1 - plugins/alignments/src/shared/util.ts | 2 +- plugins/alignments/src/util.ts | 2 +- plugins/arc/src/ArcRenderer/ArcRendering.tsx | 26 +- plugins/arc/src/ArcTooltip.tsx | 2 +- plugins/arc/src/LinearArcDisplay/model.ts | 8 +- .../components/Arcs.tsx | 42 +- .../components/BaseDisplayComponent.tsx | 4 +- .../LinearPairedArcDisplay/components/util.ts | 20 +- .../arc/src/LinearPairedArcDisplay/util.ts | 2 +- plugins/arc/src/index.ts | 2 +- .../src/DropboxOAuthModel/util.ts | 2 +- .../ExternalTokenEntryForm.tsx | 8 +- .../src/ExternalTokenModel/model.tsx | 1 - .../src/HTTPBasicModel/HTTPBasicLoginForm.tsx | 12 +- .../src/HTTPBasicModel/model.tsx | 1 - .../authentication/src/OAuthModel/model.tsx | 48 +- .../src/__snapshots__/index.test.js.snap | 8 - plugins/authentication/src/index.test.js | 96 --- plugins/authentication/src/util.ts | 2 +- plugins/bed/src/BedAdapter/BedAdapter.ts | 12 +- plugins/bed/src/BedpeAdapter/BedpeAdapter.ts | 54 +- .../bed/src/BigBedAdapter/BigBedAdapter.ts | 4 +- .../bed/src/__snapshots__/index.test.ts.snap | 3 - plugins/bed/src/index.test.ts | 16 - plugins/bed/src/util.ts | 35 +- .../BreakpointAlignmentsFeatureDetail.tsx | 33 +- .../BreakpointSplitView.ts | 14 +- .../components/AlignmentConnections.tsx | 24 +- .../components/Breakends.tsx | 24 +- .../components/ExportSvgDialog.tsx | 20 +- .../components/Translocations.tsx | 22 +- .../BreakpointSplitView/components/util.ts | 2 +- .../src/BreakpointSplitView/model.ts | 32 +- .../svgcomponents/SVGBreakpointSplitView.tsx | 26 +- .../src/BreakpointSplitView/util.ts | 6 +- .../BaseChordDisplay/components/Loading.tsx | 8 +- .../src/BaseChordDisplay/models/model.tsx | 32 +- .../BaseChordDisplay/models/renderReaction.ts | 5 +- .../CircularView/components/CircularView.tsx | 2 +- .../src/CircularView/components/Controls.tsx | 10 +- .../components/ExportSvgDialog.tsx | 16 +- .../CircularView/components/ImportForm.tsx | 8 +- .../src/CircularView/components/Ruler.tsx | 2 +- ...lices.test.js.snap => slices.test.ts.snap} | 8 +- .../src/CircularView/models/model.ts | 29 +- .../models/{slices.test.js => slices.test.ts} | 25 +- .../src/CircularView/models/slices.ts | 2 +- ....test.js => viewportVisibleRegion.test.ts} | 6 +- .../models/viewportVisibleRegion.ts | 6 +- .../svgcomponents/SVGCircularView.tsx | 2 +- .../src/LaunchCircularView/index.ts | 4 +- .../src/ChainAdapter/util.ts | 22 +- .../src/DeltaAdapter/util.ts | 30 +- .../MCScanAnchorsAdapter.ts | 10 +- .../MCScanSimpleAnchorsAdapter.ts | 10 +- .../src/MashMapAdapter/MashMapAdapter.ts | 14 +- .../src/PAFAdapter/PAFAdapter.test.ts | 4 +- .../src/PAFAdapter/PAFAdapter.ts | 4 +- .../src/PAFAdapter/util.ts | 1 - .../PairwiseIndexedPAFAdapter.ts | 8 +- .../src/SyntenyFeature/index.ts | 1 - plugins/comparative-adapters/src/util.ts | 20 +- .../components/BooleanEditor.tsx | 4 +- .../components/CallbackEditor.tsx | 4 +- .../components/ColorEditor.tsx | 19 +- .../components/ConfigurationEditor.test.tsx | 16 +- .../components/ConfigurationEditor.tsx | 14 +- .../components/HeadingComponent.tsx | 8 +- .../components/JsonEditor.tsx | 4 +- .../components/NumberEditor.tsx | 4 +- .../components/NumberMapEditor.tsx | 14 +- .../components/SlotEditor.tsx | 24 +- .../components/StringArrayEditor.tsx | 18 +- .../components/StringArrayMapEditor.tsx | 23 +- .../ConfigurationEditor.test.tsx.snap | 783 ++++++------------ .../src/ConfigurationEditorWidget/model.ts | 1 - .../FromConfigAdapter.test.ts | 2 +- .../FromConfigAdapter/FromConfigAdapter.ts | 24 +- .../FromConfigRegionsAdapter.ts | 2 +- .../FromConfigSequenceAdapter.test.ts | 8 +- .../FromConfigSequenceAdapter.ts | 2 +- .../RefNameAliasAdapter.test.ts | 8 +- .../RefNameAliasAdapter.ts | 5 +- .../src/__snapshots__/index.test.ts.snap | 10 - plugins/config/src/index.test.ts | 38 - .../scripts/getUcscAssemblies.js | 5 +- .../components/AddConnectionWidget.test.tsx | 16 +- .../components/AddConnectionWidget.tsx | 4 +- .../components/ConnectionTypeSelect.tsx | 4 +- .../AddConnectionWidget.test.tsx.snap | 32 +- .../components/AddTrackWidget.test.tsx | 8 +- .../components/AddTrackWidget.tsx | 9 +- .../components/ConfirmTrack.tsx | 26 +- .../components/DefaultAddTrackWorkflow.tsx | 3 +- .../components/PasteConfigWorkflow.tsx | 8 +- .../components/TextIndexingConfig.tsx | 18 +- .../components/TrackAdapterSelector.tsx | 4 +- .../components/TrackTypeSelector.tsx | 4 +- .../src/AssemblyManager/AssemblyAddForm.tsx | 190 +++-- .../src/AssemblyManager/AssemblyManager.tsx | 28 +- .../src/AssemblyManager/AssemblyTable.tsx | 4 +- .../components/HierarchicalFab.tsx | 8 +- .../HierarchicalTrackSelector.test.tsx | 6 +- .../components/ShoppingCart.tsx | 15 +- .../dialogs/CloseConnectionDialog.tsx | 19 +- .../dialogs/DeleteConnectionDialog.tsx | 16 +- .../dialogs/ManageConnectionsDialog.tsx | 10 +- .../dialogs/ToggleConnectionsDialog.tsx | 4 +- .../components/faceted/FacetFilter.tsx | 27 +- .../components/faceted/FacetedHeader.tsx | 36 +- .../components/faceted/FacetedSelector.tsx | 10 +- .../components/tree/FavoriteTracks.tsx | 8 +- .../components/tree/HamburgerMenu.tsx | 50 +- .../components/tree/HierarchicalHeader.tsx | 14 +- .../components/tree/HierarchicalTree.tsx | 5 +- .../components/tree/RecentlyUsedTracks.tsx | 8 +- .../components/tree/TrackCategory.tsx | 4 +- .../components/tree/TrackLabel.tsx | 6 +- .../components/tree/TrackLabelMenu.tsx | 16 +- .../filterTracks.ts | 6 +- .../HierarchicalTrackSelectorWidget/model.ts | 4 +- .../components/AddCustomPluginDialog.tsx | 20 +- .../components/DeletePluginDialog.tsx | 16 +- .../components/InstalledPlugin.tsx | 8 +- .../components/PluginCard.tsx | 2 +- .../components/PluginStoreWidget.test.tsx | 12 +- .../components/PluginStoreWidget.tsx | 18 +- .../src/__snapshots__/index.test.ts.snap | 9 - plugins/data-management/src/index.test.ts | 54 -- .../src/ucsc-trackhub/doConnect.ts | 12 +- .../src/ucsc-trackhub/ucscTrackHub.ts | 5 +- .../dotplot-view/src/DotplotDisplay/index.ts | 1 - .../src/DotplotDisplay/stateModelFactory.tsx | 3 +- .../src/DotplotReadVsRef/DotplotReadVsRef.ts | 2 +- .../src/DotplotReadVsRef/index.ts | 4 +- .../src/DotplotRenderer/DotplotRenderer.ts | 30 +- .../dotplot-view/src/DotplotView/1dview.ts | 2 - .../src/DotplotView/components/Axes.tsx | 2 +- .../components/DotplotControls.tsx | 40 +- .../DotplotView/components/DotplotTooltip.tsx | 4 +- .../DotplotView/components/DotplotView.tsx | 18 +- .../components/DotplotWarnings.tsx | 19 +- .../components/ExportSvgDialog.tsx | 16 +- .../src/DotplotView/components/Grid.tsx | 4 +- .../ImportForm/ImportCustomTrack.tsx | 20 +- .../ImportForm/ImportSyntenyTrackSelector.tsx | 4 +- .../components/ImportForm/index.tsx | 12 +- .../DotplotView/components/ImportForm/util.ts | 2 +- .../DotplotView/components/WarningDialog.tsx | 7 +- .../src/DotplotView/components/util.ts | 7 +- .../src/DotplotView/model.test.ts | 17 - plugins/dotplot-view/src/DotplotView/model.ts | 32 +- .../svgcomponents/SVGDotplotView.tsx | 2 +- plugins/dotplot-view/src/LaunchDotplotView.ts | 6 +- .../src/ServerSideRenderedBlockContent.tsx | 10 +- .../components/EditGCContentParams.tsx | 16 +- .../src/LinearGCContentDisplay/config1.ts | 2 +- .../src/LinearGCContentDisplay/config2.ts | 2 +- plugins/gff3/src/Gff3Adapter/Gff3Adapter.ts | 21 +- .../src/Gff3TabixAdapter/Gff3TabixAdapter.ts | 20 +- .../components/AssemblySelector.tsx | 4 +- .../components/BookmarkGrid.tsx | 8 +- .../components/GridBookmarkWidget.tsx | 5 - .../components/Highlight/Highlight.tsx | 11 +- .../Highlight/OverviewHighlight.tsx | 6 +- .../dialogs/DeleteBookmarksDialog.tsx | 8 +- .../dialogs/EditBookmarkLabelDialog.tsx | 6 +- .../dialogs/EditHighlightColorDialog.tsx | 15 +- .../dialogs/ExportBookmarksDialog.tsx | 4 +- .../dialogs/HighlightSettingsDialog.tsx | 8 +- .../dialogs/ImportBookmarksDialog.tsx | 40 +- .../dialogs/ShareBookmarksDialog.tsx | 19 +- .../src/GridBookmarkWidget/model.ts | 12 +- .../src/GridBookmarkWidget/sessionSharing.ts | 2 +- .../src/GridBookmarkWidget/utils.ts | 10 +- .../src/__snapshots__/index.test.ts.snap | 3 - plugins/grid-bookmark/src/index.test.ts | 26 - plugins/grid-bookmark/src/index.ts | 29 +- plugins/gtf/src/GtfAdapter/GtfAdapter.ts | 8 +- plugins/gtf/src/util.ts | 7 +- plugins/hic/src/HicAdapter/HicAdapter.ts | 4 +- plugins/hic/src/HicRenderer/HicRenderer.tsx | 8 +- .../hic/src/LinearHicDisplay/configSchema.ts | 2 +- plugins/hic/src/LinearHicDisplay/model.ts | 28 +- .../components/CurrentJobCard.tsx | 30 +- .../src/JobsListWidget/model.ts | 2 +- .../src/JBrowse1Connection/jb1ConfigLoad.ts | 6 +- .../src/JBrowse1Connection/jb1ConfigParse.ts | 20 +- .../src/JBrowse1Connection/jb1ToJb2.ts | 6 +- .../src/JBrowse1Connection/util.ts | 8 +- .../JBrowse1TextSearchAdapter.test.ts | 20 +- .../src/NCListAdapter/NCListAdapter.test.ts | 4 +- .../src/NCListAdapter/NCListAdapter.ts | 2 - .../src/NCListAdapter/NCListFeature.ts | 3 - .../src/__snapshots__/index.test.ts.snap | 16 - plugins/legacy-jbrowse/src/index.test.ts | 35 - .../components/LaunchSyntenyViewDialog.tsx | 12 +- .../src/LGVSyntenyDisplay/components/util.ts | 15 +- .../src/LaunchLinearSyntenyView.ts | 10 +- .../LinearComparativeDisplay/configSchemaF.ts | 1 - .../stateModelFactory.ts | 4 +- .../components/Header.tsx | 8 +- .../components/LinearComparativeView.tsx | 4 +- .../components/Rubberband.tsx | 14 +- .../src/LinearComparativeView/model.ts | 27 +- .../src/LinearReadVsRef/LinearReadVsRef.tsx | 18 +- .../src/LinearSyntenyDisplay/afterAttach.ts | 8 +- .../components/Component.tsx | 8 +- .../components/LinearSyntenyRendering.tsx | 43 +- .../components/SyntenyContextMenu.tsx | 24 +- .../components/SyntenyTooltip.tsx | 2 +- .../LinearSyntenyDisplay/components/util.ts | 14 +- .../src/LinearSyntenyDisplay/drawSynteny.ts | 51 +- .../components/ExportSvgDialog.tsx | 20 +- .../ImportForm/ImportCustomTrack.tsx | 20 +- .../ImportForm/ImportSyntenyTrackSelector.tsx | 4 +- .../components/ImportForm/index.tsx | 20 +- .../components/ImportForm/util.ts | 2 +- .../src/LinearSyntenyView/model.ts | 4 +- .../svgcomponents/SVGLinearSyntenyView.tsx | 27 +- .../SyntenyFeatureDetail.tsx | 7 +- plugins/linear-comparative-view/src/util.ts | 15 +- .../ServerSideRenderedBlockContent.tsx | 4 +- .../BaseLinearDisplay/components/Tooltip.tsx | 2 +- .../models/BaseLinearDisplayModel.tsx | 14 +- .../models/FeatureDensityMixin.tsx | 5 +- .../BaseLinearDisplay/models/renderSvg.tsx | 2 +- .../models/serverSideRenderedBlock.ts | 1 - .../src/BaseLinearDisplay/models/util.ts | 6 +- .../src/LaunchLinearGenomeView/index.ts | 36 +- .../src/LinearBareDisplay/index.test.js | 34 - .../components/AddFiltersDialog.tsx | 12 +- .../components/SetMaxHeightDialog.tsx | 8 +- .../src/LinearBasicDisplay/model.ts | 12 +- .../LinearGenomeView/components/Cytobands.tsx | 24 +- .../components/ExportSvgDialog.tsx | 20 +- .../components/GetSequenceDialog.tsx | 74 +- .../LinearGenomeView/components/Header.tsx | 8 +- .../LinearGenomeView/components/Highlight.tsx | 52 +- .../components/ImportForm.tsx | 8 +- .../ImportFormRefNameAutocomplete.tsx | 8 +- .../components/LinearGenomeView.test.tsx | 40 +- .../components/LinearGenomeView.tsx | 14 +- .../components/MiniControls.tsx | 8 +- .../components/OverviewHighlight.tsx | 61 +- .../components/OverviewRubberband.tsx | 2 +- .../components/OverviewScalebar.tsx | 4 +- .../components/OverviewScalebarPolygon.tsx | 4 +- .../AutocompleteTextField.tsx | 8 +- .../RefNameAutocomplete/EndAdornment.tsx | 13 +- .../RefNameAutocomplete/HelpDialog.tsx | 7 +- .../components/RefNameAutocomplete/index.tsx | 4 +- .../components/RefNameAutocomplete/util.ts | 2 +- .../components/RubberbandSpan.tsx | 10 +- .../components/Scalebar.test.tsx | 1 - .../LinearGenomeView/components/Scalebar.tsx | 2 +- .../LinearGenomeView/components/SearchBox.tsx | 2 +- .../components/SearchResultsDialog.tsx | 7 +- .../components/SearchResultsTable.tsx | 4 +- .../components/SequenceSearchDialog.tsx | 22 +- .../components/TrackLabel.tsx | 20 +- .../components/TrackLabelDragHandle.tsx | 4 +- .../components/ZoomControls.tsx | 12 +- .../LinearGenomeView.test.tsx.snap | 166 ++-- .../src/LinearGenomeView/components/hooks.ts | 2 +- .../src/LinearGenomeView/components/util.ts | 7 +- .../src/LinearGenomeView/index.test.ts | 96 ++- .../src/LinearGenomeView/model.ts | 131 +-- .../svgcomponents/SVGHeader.tsx | 4 +- .../svgcomponents/SVGLinearGenomeView.tsx | 2 +- .../svgcomponents/SVGTracks.tsx | 2 +- .../LinearGenomeView/svgcomponents/util.ts | 2 +- .../src/LinearGenomeView/util.ts | 9 +- plugins/linear-genome-view/src/searchUtils.ts | 4 +- .../lollipop/src/LollipopRenderer/Layout.ts | 4 +- .../LollipopRenderer/components/Lollipop.tsx | 1 - .../components/LollipopRendering.tsx | 3 +- .../components/ImportSessionWidget.tsx | 10 +- .../components/AutosavedSessionsList.tsx | 6 +- .../components/DeleteSavedSessionDialog.tsx | 15 +- .../components/RegularSavedSessionsList.tsx | 12 +- .../components/SessionListItem.tsx | 2 +- .../rdf/src/SPARQLAdapter/SPARQLAdapter.ts | 53 +- .../rdf/src/__snapshots__/index.test.ts.snap | 3 - plugins/rdf/src/index.test.ts | 18 - .../ChromSizesAdapter/ChromSizesAdapter.ts | 8 +- .../components/DivSequenceRendering.tsx | 4 +- .../IndexedFastaAdapter.test.ts | 2 +- .../IndexedFastaAdapter.ts | 6 +- .../LinearReferenceSequenceDisplay/model.ts | 16 +- .../ReferenceSequenceTrack/configSchema.ts | 3 +- .../src/TwoBitAdapter/TwoBitAdapter.test.ts | 2 +- .../src/TwoBitAdapter/TwoBitAdapter.ts | 8 +- plugins/sequence/src/index.test.ts | 4 +- .../src/LaunchSpreadsheetView/index.ts | 8 +- .../SpreadsheetView/components/CellData.tsx | 1 - .../components/ColumnFilterControls.tsx | 5 +- .../SpreadsheetView/components/ColumnMenu.tsx | 42 +- .../SpreadsheetView/components/DataRow.tsx | 2 +- .../components/DataTableHeader.tsx | 14 +- .../components/GlobalFilterControls.tsx | 9 +- .../components/ImportWizard.tsx | 26 +- .../components/NumberEditor.tsx | 4 +- .../components/RowCountMessage.tsx | 4 +- .../SpreadsheetView/components/RowMenu.tsx | 2 +- .../components/Spreadsheet.tsx | 13 +- .../SpreadsheetView/components/StatusBar.tsx | 42 +- .../importAdapters/BedImport.ts | 16 +- .../importAdapters/ImportUtils.ts | 11 +- .../importAdapters/STARFusionImport.ts | 9 +- .../importAdapters/VcfImport.ts | 10 +- .../models/ColumnDataTypes/LocString.tsx | 24 +- .../MakeSpreadsheetColumnType.tsx | 1 - .../models/ColumnDataTypes/Number.tsx | 6 +- .../models/ColumnDataTypes/Text.tsx | 8 +- .../models/ColumnDataTypes/index.ts | 2 +- .../SpreadsheetView/models/FilterControls.ts | 3 +- .../SpreadsheetView/models/ImportWizard.ts | 10 +- .../src/SpreadsheetView/models/Row.ts | 3 +- .../src/SpreadsheetView/models/Spreadsheet.ts | 9 +- .../SpreadsheetView/models/SpreadsheetView.ts | 24 +- .../SpreadsheetView/models/StaticRowSet.ts | 11 +- .../src/LaunchSvInspectorView/index.ts | 9 +- .../components/CircularViewOptions.tsx | 4 +- .../sv-inspector/src/SvInspectorView/index.ts | 4 +- .../SvInspectorView/models/SvInspectorView.ts | 31 +- ...ocFeatureUtils.js => adhocFeatureUtils.ts} | 1 + ....js => breakpointSplitViewFromTableRow.ts} | 1 + .../components/ProcessedTranscript.tsx | 9 +- .../components/SvgFeatureRendering.tsx | 2 +- .../components/SvgOverlay.tsx | 20 +- .../TrixTextSearchAdapter.test.ts | 8 +- .../TrixTextSearchAdapter.ts | 4 +- .../models/stateModelFactory.ts | 4 +- .../StructuralVariantChordRenderer/Chord.tsx | 4 +- .../src/VariantFeatureWidget/AnnotGrid.tsx | 4 +- .../BreakendOptionDialog.tsx | 12 +- .../VariantFeatureWidget/BreakendPanel.tsx | 2 +- .../VariantAnnotationTable.tsx | 10 +- .../VariantFeatureWidget.test.tsx | 8 +- .../VariantFeatureWidget.tsx | 8 +- .../VariantSampleGrid.tsx | 10 +- .../VariantFeatureWidget.test.tsx.snap | 54 +- plugins/variants/src/VcfAdapter/VcfAdapter.ts | 7 +- plugins/variants/src/VcfFeature/index.ts | 16 +- plugins/variants/src/VcfFeature/util.ts | 14 +- .../src/VcfTabixAdapter/VcfTabixAdapter.ts | 2 +- plugins/variants/src/index.test.ts | 4 +- .../wiggle/src/BigWigAdapter/BigWigAdapter.ts | 2 +- .../ConfirmDialog.tsx | 19 +- .../DensityRenderer/DensityRenderer.test.ts | 1 - .../components/SetColorDialog.tsx | 16 +- .../components/Tooltip.tsx | 4 +- .../models/configSchema.ts | 6 +- .../src/LinearWiggleDisplay/models/model.ts | 18 +- .../components/SetColorDialog.tsx | 4 +- .../components/SourcesGrid.tsx | 32 +- .../components/Tooltip.tsx | 6 +- .../components/YScaleBars.tsx | 4 +- .../components/util.ts | 4 +- .../models/configSchema.ts | 10 +- .../MultiLinearWiggleDisplay/models/model.ts | 27 +- .../MultiRowLineRenderer.ts | 2 +- .../MultiRowXYPlotRenderer.ts | 2 +- .../MultiWiggleAdapter/MultiWiggleAdapter.ts | 5 +- .../AddTrackWorkflow.tsx | 12 +- plugins/wiggle/src/MultiWiggleRendering.tsx | 10 +- plugins/wiggle/src/Tooltip.tsx | 5 +- plugins/wiggle/src/WiggleBaseRenderer.tsx | 3 +- .../src/WiggleRPC/MultiWiggleGetSources.ts | 1 - .../WiggleGetGlobalQuantitativeStats.ts | 1 - .../WiggleGetMultiRegionQuantitativeStats.ts | 1 - plugins/wiggle/src/WiggleRendering.tsx | 2 +- .../src/XYPlotRenderer/XYPlotRenderer.test.ts | 1 - plugins/wiggle/src/drawDensity.ts | 6 +- plugins/wiggle/src/drawLine.ts | 6 +- plugins/wiggle/src/drawXY.ts | 6 +- plugins/wiggle/src/index.test.ts | 2 +- plugins/wiggle/src/shared/SetMinMaxDialog.tsx | 8 +- plugins/wiggle/src/shared/modelShared.ts | 26 +- plugins/wiggle/src/util.ts | 7 +- products/jbrowse-cli/src/base.ts | 31 +- .../jbrowse-cli/src/commands/add-assembly.ts | 8 +- .../src/commands/add-connection.ts | 23 +- .../src/commands/add-track-json.ts | 2 +- .../jbrowse-cli/src/commands/add-track.ts | 45 +- .../src/commands/text-index.test.ts | 10 +- .../jbrowse-cli/src/commands/text-index.ts | 30 +- products/jbrowse-cli/src/commands/upgrade.ts | 4 +- products/jbrowse-cli/src/testUtil.ts | 16 - products/jbrowse-cli/src/types/common.ts | 3 +- products/jbrowse-cli/src/types/gff3Adapter.ts | 10 +- products/jbrowse-cli/src/types/vcfAdapter.ts | 8 +- products/jbrowse-cli/src/util.ts | 2 +- products/jbrowse-cli/tsconfig.json | 2 +- products/jbrowse-desktop/electron/electron.ts | 21 +- .../src/components/AdapterInput.tsx | 32 +- .../src/components/JBrowse.test.tsx | 2 - .../src/components/OpenSequenceDialog.tsx | 36 +- .../src/components/PreferencesDialog.tsx | 4 +- .../components/StartScreen/LauncherPanel.tsx | 4 +- .../StartScreen/QuickstartPanel.tsx | 26 +- .../StartScreen/RecentSessionCards.tsx | 6 +- .../StartScreen/RecentSessionList.tsx | 6 +- .../StartScreen/RecentSessionsPanel.tsx | 32 +- .../components/StartScreen/SessionCard.tsx | 22 +- .../dialogs/DeleteQuickstartDialog.tsx | 11 +- .../dialogs/DeleteSessionDialog.tsx | 11 +- .../dialogs/FactoryResetDialog.tsx | 19 +- .../dialogs/RenameQuickstartDialog.tsx | 15 +- .../dialogs/RenameSessionDialog.tsx | 19 +- .../src/components/StartScreen/util.tsx | 17 +- .../src/components/factoryReset.ts | 6 +- products/jbrowse-desktop/src/index.tsx | 2 +- .../jbrowse-desktop/src/indexJobsModel.ts | 37 +- .../jbrowse-desktop/src/rootModel/Menus.ts | 2 +- .../src/sessionModel/TrackMenu.ts | 8 +- .../jbrowse-desktop/src/sessionModel/index.ts | 20 +- .../jbrowse-desktop/src/workerPolyfill.js | 8 +- products/jbrowse-img/src/index.ts | 7 +- products/jbrowse-img/src/parseArgv.ts | 2 +- products/jbrowse-img/src/renderRegion.tsx | 59 +- products/jbrowse-img/src/util.ts | 2 +- products/jbrowse-react-app/output-version.js | 1 - .../src/JBrowseApp/JBrowseApp.tsx | 2 +- .../src/components/PreferencesDialog.tsx | 4 +- products/jbrowse-react-app/src/createModel.ts | 1 - .../jbrowse-react-app/src/createViewState.ts | 1 - .../src/rootModel/index.test.ts | 4 +- .../jbrowse-react-app/src/rootModel/index.ts | 5 +- products/jbrowse-react-app/src/util.ts | 11 +- .../jbrowse-react-app/src/workerPolyfill.js | 8 +- .../stories/examples/util.ts | 2 +- .../output-version.js | 1 - .../src/createModel/createConfigModel.ts | 1 - .../src/createModel/createModel.ts | 15 +- .../src/createModel/createSessionModel.ts | 3 +- .../src/createViewState.ts | 1 - .../output-version.js | 1 - .../JBrowseLinearGenomeView.test.tsx | 18 +- .../src/createModel/createConfigModel.ts | 1 - .../src/createModel/createModel.ts | 9 +- .../src/createModel/createSessionModel.ts | 3 +- .../src/createViewState.ts | 30 +- .../src/workerPolyfill.js | 8 +- .../examples/ShadowDOMOneLinearGenomeView.tsx | 12 +- .../stories/examples/WithInlinePlugins.tsx | 2 +- .../examples/WithObserveVisibleRegions.tsx | 8 +- .../stories/examples/util.ts | 1 - products/jbrowse-web/public/umd_plugin.js | 2 +- products/jbrowse-web/scripts/config.js | 2 +- products/jbrowse-web/src/SessionLoader.ts | 26 +- .../src/components/ConfigWarningDialog.tsx | 12 +- .../src/components/DeleteSessionDialog.tsx | 11 +- .../jbrowse-web/src/components/JBrowse.tsx | 4 +- .../jbrowse-web/src/components/Loader.tsx | 10 +- .../src/components/NewSessionCards.tsx | 8 +- .../src/components/NoConfigMessage.tsx | 2 +- .../src/components/PreferencesDialog.tsx | 4 +- .../src/components/RecentSessionCard.tsx | 10 +- .../src/components/SessionWarningDialog.tsx | 12 +- .../src/components/SetDefaultSession.tsx | 8 +- .../src/components/ShareButton.tsx | 11 +- .../src/components/ShareDialog.tsx | 17 +- .../src/components/ShareInfoDialog.tsx | 4 +- .../src/components/ShareSettingsDialog.tsx | 14 +- .../src/components/StartScreen.tsx | 38 +- .../jbrowse-web/src/createPluginManager.ts | 12 +- products/jbrowse-web/src/index.tsx | 2 +- products/jbrowse-web/src/jbrowseModel.ts | 1 - .../jbrowse-web/src/rootModel/index.test.ts | 4 +- .../jbrowse-web/src/rootModel/rootModel.ts | 14 +- .../jbrowse-web/src/rootModel/test_util.ts | 2 +- products/jbrowse-web/src/sessionSharing.ts | 2 +- .../src/tests/AlignmentArcs.test.tsx | 20 +- .../jbrowse-web/src/tests/Alignments.test.tsx | 12 +- .../src/tests/AlignmentsFilters.test.tsx | 6 +- .../tests/AssemblySelectorImportForm.test.tsx | 12 +- .../src/tests/Authentication.test.tsx | 4 +- .../src/tests/BasicLinearGenomeView.test.tsx | 22 +- .../src/tests/BookmarkWidget.test.tsx | 35 +- .../src/tests/BreakpointSplitView.test.tsx | 25 +- .../src/tests/ConfigurationEditor.test.tsx | 11 +- .../jbrowse-web/src/tests/Connection.test.tsx | 8 +- .../src/tests/CopyAndDelete.test.tsx | 22 +- .../jbrowse-web/src/tests/Dotplot.test.tsx | 2 +- .../src/tests/DrawerWidget.test.tsx | 4 +- .../jbrowse-web/src/tests/ExportSvg.test.tsx | 18 +- .../ExportSvgBreakpointSplitView.test.tsx | 6 +- .../jbrowse-web/src/tests/Loader.test.tsx | 24 +- .../src/tests/OAuthServer/oauth/model.ts | 2 + .../src/tests/OAuthServer/routes/auth.ts | 5 +- .../jbrowse-web/src/tests/ReadVsRef.test.tsx | 16 +- .../jbrowse-web/src/tests/ReloadBam.test.tsx | 4 +- .../src/tests/ReloadBigWig.test.tsx | 2 +- .../jbrowse-web/src/tests/ReloadCram.test.tsx | 4 +- .../jbrowse-web/src/tests/ReloadVcf.test.tsx | 4 +- .../src/tests/SVInspector.test.tsx | 8 +- .../src/tests/Spreadsheet.test.tsx | 7 +- .../src/tests/StatsEstimation.test.tsx | 12 +- .../jbrowse-web/src/tests/Synteny.test.tsx | 2 +- .../src/tests/TextSearching.test.tsx | 26 +- .../tests/TextSearchingImportForm.test.tsx | 16 +- products/jbrowse-web/src/tests/util.tsx | 14 +- products/jbrowse-web/src/util.ts | 22 +- products/jbrowse-web/src/workerPolyfill.js | 8 +- scripts/getSuggestions.js | 2 - scripts/useDist.js | 1 - scripts/useSrc.js | 1 - tsconfig.json | 1 + webpack/config/env.js | 4 +- webpack/config/webpack.config.js | 5 +- webpack/scripts/build.js | 21 +- webpack/scripts/start.js | 9 +- .../developer_guides/creating_renderer.md | 2 +- yarn.lock | 283 +++---- 744 files changed, 5726 insertions(+), 5316 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs delete mode 100644 packages/core/util/layouts/GranularRectLayout.test.js create mode 100644 packages/core/util/layouts/GranularRectLayout.test.ts rename packages/core/util/{range.test.js => range.test.ts} (95%) delete mode 100644 plugins/alignments/src/LinearAlignmentsDisplay/models/configSchema.test.ts delete mode 100644 plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.test.js delete mode 100644 plugins/alignments/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/alignments/src/index.test.ts delete mode 100644 plugins/authentication/src/__snapshots__/index.test.js.snap delete mode 100644 plugins/authentication/src/index.test.js delete mode 100644 plugins/bed/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/bed/src/index.test.ts rename plugins/circular-view/src/CircularView/models/__snapshots__/{slices.test.js.snap => slices.test.ts.snap} (91%) rename plugins/circular-view/src/CircularView/models/{slices.test.js => slices.test.ts} (78%) rename plugins/circular-view/src/CircularView/models/{viewportVisibleRegion.test.js => viewportVisibleRegion.test.ts} (96%) delete mode 100644 plugins/config/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/config/src/index.test.ts delete mode 100644 plugins/data-management/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/data-management/src/index.test.ts delete mode 100644 plugins/dotplot-view/src/DotplotView/model.test.ts delete mode 100644 plugins/grid-bookmark/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/grid-bookmark/src/index.test.ts delete mode 100644 plugins/legacy-jbrowse/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/legacy-jbrowse/src/index.test.ts delete mode 100644 plugins/linear-genome-view/src/LinearBareDisplay/index.test.js delete mode 100644 plugins/rdf/src/__snapshots__/index.test.ts.snap delete mode 100644 plugins/rdf/src/index.test.ts rename plugins/sv-inspector/src/SvInspectorView/models/{adhocFeatureUtils.js => adhocFeatureUtils.ts} (99%) rename plugins/sv-inspector/src/SvInspectorView/models/{breakpointSplitViewFromTableRow.js => breakpointSplitViewFromTableRow.ts} (99%) diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e8877361be..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,26 +0,0 @@ -**/coverage/** -**/templates -**/node_modules/** -**/build/** -**/dist/** -**/esm/** -**/umd/** -**/lib/** -**/tmp/** -**/website/** -# TODO: decide whether or not to bring these up to eslint standards -products/jbrowse-web/scripts/** -/config/ -/products/jbrowse-web/config/ -products/jbrowse-desktop/public/electron.js -products/jbrowse-desktop/public/generateFastaIndex.js -/embedded_demos/ -webpack.config.js -craco.config.js -packages/core/util/QuickLRU.js -packages/core/util/QuickLRU.d.ts -packages/core/util/nanoid.js -packages/core/util/nanoid.d.ts -**/umd_plugin.js -component_tests -.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index c50fd804e1..0000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,206 +0,0 @@ -/** @type {import("eslint").Linter.Config} */ -module.exports = { - root: true, - env: { - browser: true, - node: true, - jest: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-type-checked', - 'plugin:@typescript-eslint/stylistic-type-checked', - 'plugin:prettier/recommended', - 'plugin:unicorn/recommended', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - ], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - tsconfigRootDir: __dirname, - project: './tsconfig.json', - }, - plugins: ['eslint-plugin-tsdoc', 'react-refresh'], - settings: { - react: { - version: 'detect', - }, - }, - rules: { - 'no-empty': 'off', - 'react-refresh/only-export-components': 'warn', - - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/prefer-nullish-coalescing': 'off', - '@typescript-eslint/no-base-to-string': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - argsIgnorePattern: '^_', - ignoreRestSiblings: true, - caughtErrors: 'none', - }, - ], - '@typescript-eslint/no-floating-promises': 'error', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/restrict-plus-operands': 'off', - '@typescript-eslint/no-misused-promises': 'off', - '@typescript-eslint/require-await': 'off', - '@typescript-eslint/unbound-method': 'off', - '@typescript-eslint/no-unused-expressions': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-require-imports': 'off', - - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-return': 'off', - - 'testing-library/render-result-naming-convention': 'off', - 'testing-library/prefer-screen-queries': 'off', - - 'unicorn/no-new-array': 'off', - 'unicorn/no-empty-file': 'off', - 'unicorn/prefer-type-error': 'off', - 'unicorn/prefer-modern-math-apis': 'off', - 'unicorn/prefer-structured-clone': 'off', - 'unicorn/prefer-node-protocol': 'off', - 'unicorn/no-unreadable-array-destructuring': 'off', - 'unicorn/no-abusive-eslint-disable': 'off', - 'unicorn/no-array-callback-reference': 'off', - 'unicorn/number-literal-case': 'off', - 'unicorn/prefer-add-event-listener': 'off', - 'unicorn/prefer-top-level-await': 'off', - 'unicorn/consistent-function-scoping': 'off', - 'unicorn/no-await-expression-member': 'off', - 'unicorn/no-lonely-if': 'off', - 'unicorn/consistent-destructuring': 'off', - 'unicorn/prefer-module': 'off', - 'unicorn/prefer-optional-catch-binding': 'off', - 'unicorn/no-useless-undefined': 'off', - 'unicorn/no-null': 'off', - 'unicorn/no-nested-ternary': 'off', - 'unicorn/filename-case': 'off', - 'unicorn/catch-error-name': 'off', - 'unicorn/prevent-abbreviations': 'off', - 'unicorn/prefer-code-point': 'off', - 'unicorn/numeric-separators-style': 'off', - 'unicorn/no-array-for-each': 'off', - 'unicorn/prefer-spread': 'off', - 'unicorn/explicit-length-check': 'off', - 'unicorn/prefer-regexp-test': 'off', - 'unicorn/relative-url-style': 'off', - 'unicorn/prefer-math-trunc': 'off', - 'unicorn/prefer-query-selector': 'off', - 'unicorn/no-negated-condition': 'off', - 'unicorn/switch-case-braces': 'off', - 'unicorn/prefer-switch': 'off', - 'unicorn/better-regex': 'off', - 'unicorn/no-for-loop': 'off', - 'unicorn/escape-case': 'off', - 'unicorn/prefer-number-properties': 'off', - 'unicorn/no-process-exit': 'off', - - 'no-use-before-define': 'off', - curly: 'error', - 'no-global-assign': 'warn', - 'no-console': [ - 'warn', - { - allow: ['error', 'warn'], - }, - ], - 'no-debugger': 'warn', - 'no-undef': 'error', - 'no-underscore-dangle': 'warn', - - 'prettier/prettier': 'warn', - - 'react/no-danger': 'warn', - 'react/prop-types': 'off', - 'react/destructuring-assignment': 'error', - 'react/no-unused-prop-types': 'error', - 'react/no-unused-state': 'error', - 'react/no-unescaped-entities': 'off', - 'react/prefer-stateless-function': 'error', - - 'spaced-comment': [ - 'error', - 'always', - { - markers: ['/'], - }, - ], - }, - globals: { - globalThis: false, - }, - - overrides: [ - { - files: ['**/*.ts', '**/*.tsx'], - rules: { - 'tsdoc/syntax': 'warn', - }, - }, - { - files: [ - '**/jbrowse-cli/**/*.test.ts', - '**/jbrowse-cli/**/*.test.tsx', - '**/jbrowse-img/**/*.test.ts', - ], - rules: { - 'tsdoc/syntax': 'off', - }, - }, - { - files: [ - '**/test/**', - '**/tests/**', - '**/*.test.[t,j]s', - '**/*.test.[t,j]sx', - '**/rescripts/*', - '**/tests/util.js', - '**/webpack.config.js', - '**/scripts/notarize.js', - '**/src/testUtil.ts', - ], - env: { - jest: true, - }, - globals: { - document: true, - it: true, - describe: true, - test: true, - }, - rules: { - '@typescript-eslint/no-non-null-assertion': 'off', - }, - }, - - { - files: [ - './plugin-development-tools/**/*.[t,j]s', - './plugin-development-tools/**/*.[t,j]sx', - ], - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - project: './plugin-development-tools/tsconfig.json', - }, - }, - ], -} diff --git a/config/jest/babelTransform.js b/config/jest/babelTransform.js index a71a530ef1..63df084876 100644 --- a/config/jest/babelTransform.js +++ b/config/jest/babelTransform.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-extraneous-dependencies module.exports = require('babel-jest').default.createTransformer({ rootMode: 'upward', }) diff --git a/config/jest/console.js b/config/jest/console.js index 7ea7adab7e..2cc39ba1ae 100644 --- a/config/jest/console.js +++ b/config/jest/console.js @@ -1,4 +1,3 @@ -const originalWarn = console.warn const originalError = console.error jest.spyOn(console, 'error').mockImplementation((...args) => { @@ -14,5 +13,5 @@ jest.spyOn(console, 'error').mockImplementation((...args) => { return undefined } - return originalError.call(console, ...args) + originalError.call(console, ...args) }) diff --git a/config/jest/textEncoder.js b/config/jest/textEncoder.js index 25e809f6de..d6ca6bfd3e 100644 --- a/config/jest/textEncoder.js +++ b/config/jest/textEncoder.js @@ -1,7 +1,4 @@ -import util from 'util' -if (!global.TextEncoder) { - global.TextEncoder = util.TextEncoder -} -if (!global.TextDecoder) { - global.TextDecoder = util.TextDecoder -} +import { TextEncoder, TextDecoder } from 'util' + +global.TextEncoder = TextEncoder +global.TextDecoder = TextDecoder diff --git a/docs/generateConfigDocs.ts b/docs/generateConfigDocs.ts index 150369c462..a236cf08b2 100644 --- a/docs/generateConfigDocs.ts +++ b/docs/generateConfigDocs.ts @@ -120,7 +120,7 @@ ${derives.code} ` : '' const slotstr = `${slots.length ? `### ${config.name} - Slots` : ''}\n${slots - // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map(({ name, docs, code }: any) => { return `#### slot: ${name} diff --git a/docs/generateStateModelDocs.ts b/docs/generateStateModelDocs.ts index 74c5c63a07..2dd47282da 100644 --- a/docs/generateStateModelDocs.ts +++ b/docs/generateStateModelDocs.ts @@ -112,7 +112,7 @@ function generateStateModelDocs(files: string[]) { ({ model, getters, properties, actions, methods, filename }) => { if (model) { const getterstr = `${getters.length ? `### ${model.name} - Getters` : ''}\n${getters - // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map(({ name, docs, signature }: any) => join( `#### getter: ${name}`, @@ -123,7 +123,7 @@ function generateStateModelDocs(files: string[]) { .join('\n')}` const methodstr = `${methods.length ? `### ${model.name} - Methods` : ''}\n${methods - // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map(({ name, docs, signature }: any) => join( `#### method: ${name}`, @@ -134,7 +134,7 @@ function generateStateModelDocs(files: string[]) { .join('\n')}` const propertiesstr = `${properties.length ? `### ${model.name} - Properties` : ''}\n${properties - // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map(({ name, docs, code, signature }: any) => join( `#### property: ${name}`, @@ -145,7 +145,7 @@ function generateStateModelDocs(files: string[]) { .join('\n')}` const actionstr = `${actions.length ? `### ${model.name} - Actions` : ''}\n${actions - // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map(({ name, docs, signature }: any) => join( `#### action: ${name}`, diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..6117e9abd0 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,205 @@ +import eslint from '@eslint/js' +import eslintPluginReact from 'eslint-plugin-react' +import eslintPluginReactHooks from 'eslint-plugin-react-hooks' +import eslintPluginReactRefresh from 'eslint-plugin-react-refresh' +import eslintPluginUnicorn from 'eslint-plugin-unicorn' +import tseslint from 'typescript-eslint' +import globals from 'globals' + +export default tseslint.config( + { + ignores: [ + '**/build/**/*', + '**/dist/**/*', + '**/esm/**/*', + '**/public/**/*', + 'website/*', + 'packages/core/util/nanoid.js', + 'products/**/webpack.config.js', + 'plugin-development-tools/**', + 'products/jbrowse-cli/lib/**', + 'component_tests/**/*', + 'embedded_demos/**/*', + '**/output-version.js', + '**/.storybook/*', + '**/umd_plugin.js', + ], + }, + { + languageOptions: { + parserOptions: { + project: ['./tsconfig.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, + + settings: { + react: { + version: 'detect', + }, + }, + }, + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.stylisticTypeChecked, + ...tseslint.configs.strictTypeChecked, + eslintPluginReact.configs.flat.recommended, + { + plugins: { + 'react-hooks': eslintPluginReactHooks, + }, + rules: eslintPluginReactHooks.configs.recommended.rules, + }, + eslintPluginUnicorn.configs['flat/recommended'], + { + // in main config for TSX/JSX source files + plugins: { + 'react-refresh': eslintPluginReactRefresh, + }, + rules: {}, + }, + { + rules: { + 'no-empty': 'off', + 'no-console': [ + 'warn', + { + allow: ['error', 'warn'], + }, + ], + 'no-underscore-dangle': 'off', + curly: 'error', + semi: ['error', 'never'], + 'spaced-comment': [ + 'error', + 'always', + { + markers: ['/'], + }, + ], + + 'react-refresh/only-export-components': 'warn', + 'react/no-unescaped-entities': 'off', + 'react/prop-types': 'off', + + 'unicorn/prefer-structured-clone': 'off', + 'unicorn/no-new-array': 'off', + 'unicorn/no-empty-file': 'off', + 'unicorn/prefer-type-error': 'off', + 'unicorn/prefer-modern-math-apis': 'off', + 'unicorn/prefer-node-protocol': 'off', + 'unicorn/no-unreadable-array-destructuring': 'off', + 'unicorn/no-abusive-eslint-disable': 'off', + 'unicorn/no-array-callback-reference': 'off', + 'unicorn/number-literal-case': 'off', + 'unicorn/prefer-add-event-listener': 'off', + 'unicorn/prefer-top-level-await': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/no-await-expression-member': 'off', + 'unicorn/no-lonely-if': 'off', + 'unicorn/consistent-destructuring': 'off', + 'unicorn/prefer-module': 'off', + 'unicorn/prefer-optional-catch-binding': 'off', + 'unicorn/no-useless-undefined': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/filename-case': 'off', + 'unicorn/catch-error-name': 'off', + 'unicorn/prevent-abbreviations': 'off', + 'unicorn/prefer-code-point': 'off', + 'unicorn/numeric-separators-style': 'off', + 'unicorn/no-array-for-each': 'off', + 'unicorn/prefer-spread': 'off', + 'unicorn/explicit-length-check': 'off', + 'unicorn/prefer-regexp-test': 'off', + 'unicorn/relative-url-style': 'off', + 'unicorn/prefer-math-trunc': 'off', + 'unicorn/prefer-query-selector': 'off', + 'unicorn/no-negated-condition': 'off', + 'unicorn/switch-case-braces': 'off', + 'unicorn/prefer-switch': 'off', + 'unicorn/better-regex': 'off', + 'unicorn/no-for-loop': 'off', + 'unicorn/escape-case': 'off', + 'unicorn/prefer-number-properties': 'off', + 'unicorn/no-process-exit': 'off', + 'unicorn/prefer-at': 'off', + 'unicorn/prefer-string-replace-all': 'off', + 'unicorn/no-array-reduce': 'off', + + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-unnecessary-type-parameters': 'off', + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/no-base-to-string': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/require-await': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-extraneous-class': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-dynamic-delete': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + caughtErrors: 'none', + }, + ], + }, + }, + { + files: [ + 'babel.config.js', + 'jest.config.js', + 'webpack/**/*', + 'scripts/**/*', + 'products/jbrowse-cli/**/*', + 'products/jbrowse-img/**/*', + 'products/jbrowse-web/scripts/*', + 'products/jbrowse-desktop/scripts/*', + 'products/jbrowse-desktop/linux-sandbox-fix.js', + 'products/jbrowse-aws-lambda-functions/**/*.js', + 'plugins/data-management/scripts/*.js', + ], + languageOptions: { + globals: { + ...globals.node, + }, + }, + rules: { + '@typescript-eslint/no-require-imports': 'off', + 'no-console': 'off', + }, + }, + { + files: ['config/jest/*.js', 'integration.test.js'], + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + }, + rules: { + '@typescript-eslint/no-require-imports': 'off', + 'no-console': 'off', + }, + }, + { + files: ['**/workerPolyfill.js'], + languageOptions: { + globals: { + ...globals.worker, + }, + }, + }, +) diff --git a/package.json b/package.json index 6e61fae19a..0b2e777985 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "useDist": "lerna run useDist --scope \"@jbrowse/plugin*\" --scope @jbrowse/text-indexing", "useSrc": "lerna run useSrc --scope \"@jbrowse/plugin*\" --scope @jbrowse/text-indexing", "lerna-publish": "lerna publish", - "lint": "eslint --report-unused-disable-directives --max-warnings 0 --ext .js,.ts,.jsx,.tsx .", + "lint": "eslint --report-unused-disable-directives --max-warnings 0", "format": "prettier --write .", "check-format": "prettier --check .", "typecheck": "tsc --noEmit", @@ -102,17 +102,16 @@ "electron": "31.3.1", "electron-builder": "^24.9.0", "electron-mock-ipc": "^0.3.8", - "eslint": "^8.0.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-prettier": "^5.0.0", + "eslint": "^9.0.0", "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.3.0", + "eslint-plugin-react-hooks": "next", "eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-tsdoc": "^0.3.0", "eslint-plugin-unicorn": "^55.0.0", "express": "^4.18.2", "express-basic-auth": "^1.2.1", "find-yarn-workspace-root": "^2.0.0", + "globals": "^15.9.0", "html-webpack-plugin": "^5.5.0", "husky": "^9.0.10", "jest": "^29.3.1", @@ -146,6 +145,7 @@ "tss-react": "^4.0.0", "tsx": "^4.17.0", "typescript": "^5.1.3", + "typescript-eslint": "^8.0.1", "webpack": "^5.64.4", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.0", diff --git a/packages/__mocks__/@jbrowse/core/util/useMeasure.ts b/packages/__mocks__/@jbrowse/core/util/useMeasure.ts index f1ba967f07..bd8ddeefbd 100644 --- a/packages/__mocks__/@jbrowse/core/util/useMeasure.ts +++ b/packages/__mocks__/@jbrowse/core/util/useMeasure.ts @@ -1,3 +1,3 @@ export default function useMeasure() { - return [undefined, { width: 808 }] as const + return [{ current: undefined }, { width: 808 }] as const } diff --git a/packages/app-core/src/JBrowseModel/index.ts b/packages/app-core/src/JBrowseModel/index.ts index 6d3adae021..bb5bce0c41 100644 --- a/packages/app-core/src/JBrowseModel/index.ts +++ b/packages/app-core/src/JBrowseModel/index.ts @@ -42,7 +42,6 @@ export function JBrowseModelF({ * #getter */ get rpcManager(): RpcManager { - // eslint-disable-next-line @typescript-eslint/no-explicit-any return getParent(self).rpcManager }, })) @@ -120,7 +119,7 @@ export function JBrowseModelF({ */ addPlugin(pluginDefinition: PluginDefinition) { self.plugins.push(pluginDefinition) - // eslint-disable-next-line @typescript-eslint/no-explicit-any + const rootModel = getParent(self) rootModel.setPluginsUpdated(true) }, @@ -131,13 +130,17 @@ export function JBrowseModelF({ self.plugins = cast( self.plugins.filter( plugin => + // @ts-expect-error plugin.url !== pluginDefinition.url || + // @ts-expect-error plugin.umdUrl !== pluginDefinition.umdUrl || + // @ts-expect-error plugin.cjsUrl !== pluginDefinition.cjsUrl || + // @ts-expect-error plugin.esmUrl !== pluginDefinition.esmUrl, ), ) - // eslint-disable-next-line @typescript-eslint/no-explicit-any + getParent(self).setPluginsUpdated(true) }, @@ -146,7 +149,6 @@ export function JBrowseModelF({ */ setDefaultSessionConf(sessionConf: AnyConfigurationModel) { const newDefault = - // eslint-disable-next-line @typescript-eslint/no-explicit-any getParent(self).session.name === sessionConf.name ? getSnapshot(sessionConf) : toJS(sessionConf) diff --git a/packages/app-core/src/RootMenu/index.ts b/packages/app-core/src/RootMenu/index.ts index 862537f086..8071e80128 100644 --- a/packages/app-core/src/RootMenu/index.ts +++ b/packages/app-core/src/RootMenu/index.ts @@ -110,8 +110,8 @@ export function RootAppMenuMixin() { appendToSubMenu(menuPath: string[], menuItem: MenuItem) { let topMenu = self.menus.find(m => m.label === menuPath[0]) if (!topMenu) { - const idx = this.appendMenu(menuPath[0]) - topMenu = self.menus[idx - 1] + const idx = this.appendMenu(menuPath[0]!) + topMenu = self.menus[idx - 1]! } let { menuItems: subMenu } = topMenu const pathSoFar = [menuPath[0]] @@ -120,7 +120,7 @@ export function RootAppMenuMixin() { let sm = subMenu.find(mi => 'label' in mi && mi.label === menuName) if (!sm) { const idx = subMenu.push({ label: menuName, subMenu: [] }) - sm = subMenu[idx - 1] + sm = subMenu[idx - 1]! } if (!('subMenu' in sm)) { throw new Error( @@ -153,8 +153,8 @@ export function RootAppMenuMixin() { ) { let topMenu = self.menus.find(m => m.label === menuPath[0]) if (!topMenu) { - const idx = this.appendMenu(menuPath[0]) - topMenu = self.menus[idx - 1] + const idx = this.appendMenu(menuPath[0]!) + topMenu = self.menus[idx - 1]! } let { menuItems: subMenu } = topMenu const pathSoFar = [menuPath[0]] @@ -163,7 +163,7 @@ export function RootAppMenuMixin() { let sm = subMenu.find(mi => 'label' in mi && mi.label === menuName) if (!sm) { const idx = subMenu.push({ label: menuName, subMenu: [] }) - sm = subMenu[idx - 1] + sm = subMenu[idx - 1]! } if (!('subMenu' in sm)) { throw new Error( diff --git a/packages/app-core/src/ui/App/App.tsx b/packages/app-core/src/ui/App/App.tsx index 532e85a1fe..ccdace9c0a 100644 --- a/packages/app-core/src/ui/App/App.tsx +++ b/packages/app-core/src/ui/App/App.tsx @@ -91,7 +91,7 @@ const App = observer(function (props: Props) { return (
!!f).join(' ') }} + style={{ gridTemplateColumns: grid.filter(f => !!f).join(' ') }} > {drawerVisible && drawerPosition === 'left' ? ( diff --git a/packages/app-core/src/ui/App/AppFab.tsx b/packages/app-core/src/ui/App/AppFab.tsx index 48e8224ea3..82f7a2625f 100644 --- a/packages/app-core/src/ui/App/AppFab.tsx +++ b/packages/app-core/src/ui/App/AppFab.tsx @@ -36,7 +36,9 @@ const AppFab = observer(function ({ className={drawerPosition === 'right' ? classes.right : classes.left} color="primary" data-testid="drawer-maximize" - onClick={() => session.showWidgetDrawer()} + onClick={() => { + session.showWidgetDrawer() + }} > diff --git a/packages/app-core/src/ui/App/AppToolbar.tsx b/packages/app-core/src/ui/App/AppToolbar.tsx index d3393ca844..a1512abbfe 100644 --- a/packages/app-core/src/ui/App/AppToolbar.tsx +++ b/packages/app-core/src/ui/App/AppToolbar.tsx @@ -60,7 +60,7 @@ const AppToolbar = observer(function ({ { - if (savedSessionNames?.includes(newName)) { + if (savedSessionNames.includes(newName)) { session.notify( `Cannot rename session to "${newName}", a saved session with that name already exists`, 'warning', diff --git a/packages/app-core/src/ui/App/Drawer.tsx b/packages/app-core/src/ui/App/Drawer.tsx index 62be20afa9..6714230d0e 100644 --- a/packages/app-core/src/ui/App/Drawer.tsx +++ b/packages/app-core/src/ui/App/Drawer.tsx @@ -35,7 +35,7 @@ const Drawer = observer(function ({ useEffect(() => { function handleSelectView(e: Event) { - if (e.target instanceof Element && ref?.current?.contains(e.target)) { + if (e.target instanceof Element && ref.current?.contains(e.target)) { // @ts-ignore const visibleWidgetId = session.visibleWidget?.view?.id if (visibleWidgetId) { diff --git a/packages/app-core/src/ui/App/DrawerControls.tsx b/packages/app-core/src/ui/App/DrawerControls.tsx index aab4ed6a21..b4b98dd425 100644 --- a/packages/app-core/src/ui/App/DrawerControls.tsx +++ b/packages/app-core/src/ui/App/DrawerControls.tsx @@ -19,7 +19,9 @@ const DrawerControls = observer(function ({ <> setAnchorEl(event.currentTarget)} + onClick={event => { + setAnchorEl(event.currentTarget) + }} > @@ -41,7 +43,9 @@ const DrawerControls = observer(function ({ session.hideWidget(visibleWidget)} + onClick={() => { + session.hideWidget(visibleWidget) + }} > @@ -49,7 +53,9 @@ const DrawerControls = observer(function ({ setAnchorEl(null)} + onClose={() => { + setAnchorEl(null) + }} > {['left', 'right'].map(option => ( setToolbarHeight(ref?.getBoundingClientRect().height || 0)} + ref={ref => { + setToolbarHeight(ref?.getBoundingClientRect().height || 0) + }} > - onPopoutDrawer()}> + { + onPopoutDrawer() + }} + > diff --git a/packages/app-core/src/ui/App/DrawerWidget.tsx b/packages/app-core/src/ui/App/DrawerWidget.tsx index 2221d6d759..be94b4e20e 100644 --- a/packages/app-core/src/ui/App/DrawerWidget.tsx +++ b/packages/app-core/src/ui/App/DrawerWidget.tsx @@ -23,12 +23,11 @@ const DrawerWidget = observer(function ({ const DrawerComponent = visibleWidget ? (pluginManager.evaluateExtensionPoint( 'Core-replaceWidget', - pluginManager.getWidgetType(visibleWidget.type).ReactComponent, + pluginManager.getWidgetType(visibleWidget.type)!.ReactComponent, { session, model: visibleWidget, }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any ) as React.FC) : null @@ -41,7 +40,9 @@ const DrawerWidget = observer(function ({ return ( setPopoutDrawer(true)} + onPopoutDrawer={() => { + setPopoutDrawer(true) + }} session={session} setToolbarHeight={setToolbarHeight} /> @@ -55,7 +56,9 @@ const DrawerWidget = observer(function ({
Opened in dialog...
setPopoutDrawer(false)} + onClose={() => { + setPopoutDrawer(false) + }} /> ) : ( diff --git a/packages/app-core/src/ui/App/DrawerWidgetSelector.tsx b/packages/app-core/src/ui/App/DrawerWidgetSelector.tsx index 0cb58976d5..d39ad077b2 100644 --- a/packages/app-core/src/ui/App/DrawerWidgetSelector.tsx +++ b/packages/app-core/src/ui/App/DrawerWidgetSelector.tsx @@ -53,7 +53,7 @@ const DrawerWidgetSelector = observer(function ({ ) } - const widgetType = pluginManager.getWidgetType(widget.type) + const widgetType = pluginManager.getWidgetType(widget.type)! const { HeadingComponent, heading } = widgetType return HeadingComponent ? ( @@ -73,7 +73,7 @@ const DrawerWidgetSelector = observer(function ({ }} > {[...activeWidgets.values()].map(widget => { - const widgetType = pluginManager.getWidgetType(widget.type) + const widgetType = pluginManager.getWidgetType(widget.type)! const { HeadingComponent, heading } = widgetType return ( session.hideWidget(widget)} + onClick={() => { + session.hideWidget(widget) + }} > diff --git a/packages/app-core/src/ui/App/ModalWidget.tsx b/packages/app-core/src/ui/App/ModalWidget.tsx index e50c7e2f9c..f585835d4d 100644 --- a/packages/app-core/src/ui/App/ModalWidget.tsx +++ b/packages/app-core/src/ui/App/ModalWidget.tsx @@ -71,17 +71,14 @@ const ModalWidget = observer(function ({ return null } const { ReactComponent } = pluginManager.getWidgetType(visibleWidget.type) - const Component = visibleWidget - ? (pluginManager.evaluateExtensionPoint( - 'Core-replaceWidget', - ReactComponent, - { - session, - model: visibleWidget, - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ) as React.FC) - : null + const Component = pluginManager.evaluateExtensionPoint( + 'Core-replaceWidget', + ReactComponent, + { + session, + model: visibleWidget, + }, + ) as React.FC | undefined return ( { function handleSelectView(e: Event) { - if (e.target instanceof Element && ref?.current?.contains(e.target)) { + if (e.target instanceof Element && ref.current?.contains(e.target)) { session.setFocusedViewId(view.id) } } diff --git a/packages/app-core/src/ui/App/ViewContainerTitle.tsx b/packages/app-core/src/ui/App/ViewContainerTitle.tsx index 6e7febe482..8404a27457 100644 --- a/packages/app-core/src/ui/App/ViewContainerTitle.tsx +++ b/packages/app-core/src/ui/App/ViewContainerTitle.tsx @@ -41,7 +41,9 @@ const ViewContainerTitle = observer(function ({ view.minimized ? ' (minimized)' : '' }` } - setValue={val => view.setDisplayName(val)} + setValue={val => { + view.setDisplayName(val) + }} variant="body2" classes={{ input: classes.input, diff --git a/packages/app-core/src/ui/App/ViewHeader.tsx b/packages/app-core/src/ui/App/ViewHeader.tsx index 1702b6956c..7e3526bdef 100644 --- a/packages/app-core/src/ui/App/ViewHeader.tsx +++ b/packages/app-core/src/ui/App/ViewHeader.tsx @@ -73,7 +73,9 @@ const ViewHeader = observer(function ({ // scroll the view into view when first mounted. note: this effect will run // only once, because of the empty array second param useEffect(() => { - scrollRef.current?.scrollIntoView?.({ block: 'center' }) + if (typeof jest === 'undefined') { + scrollRef.current?.scrollIntoView({ block: 'center' }) + } }, []) return (
diff --git a/packages/app-core/src/ui/App/ViewLauncher.tsx b/packages/app-core/src/ui/App/ViewLauncher.tsx index 0f3d241fb7..8686f51360 100644 --- a/packages/app-core/src/ui/App/ViewLauncher.tsx +++ b/packages/app-core/src/ui/App/ViewLauncher.tsx @@ -29,18 +29,26 @@ const useStyles = makeStyles()(theme => ({ selectPaper: { padding: theme.spacing(4), }, + m2: { + margin: 2, + }, })) const ViewLauncher = observer(({ session }: { session: AppSession }) => { const { classes } = useStyles() const { pluginManager } = getEnv(session) const viewTypes = pluginManager.getElementTypeRecord('view').all() - const [value, setValue] = useState(viewTypes[0]?.name) + const [value, setValue] = useState(viewTypes[0]?.name || '') return ( Select a view to launch - - { + setValue(event.target.value) + }} + > {viewTypes.map(({ displayName, name }) => ( {displayName} @@ -48,7 +56,7 @@ const ViewLauncher = observer(({ session }: { session: AppSession }) => { ))} - +
@@ -82,30 +86,28 @@ const SequenceFeatureDetails = observer(function ({ ) : !sequence ? ( - ) : sequence ? ( - 'error' in sequence ? ( - <> - {sequence.error} - - - ) : ( - }> - - - ) + ) : 'error' in sequence ? ( + <> + {sequence.error} + + ) : ( - No sequence found + }> + + )}
)} diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.tsx index 436476e6e6..df667e5ab5 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.tsx @@ -39,21 +39,26 @@ const SequenceFeaturePanel = observer(function ({ const { classes } = useStyles() const [shown, setShown] = useState(false) - return model ? ( + return (
- + onClick={() => { getSession(model).queueDialog(handleClose => [ HelpDialog, { handleClose }, ]) - } + }} > @@ -67,7 +72,7 @@ const SequenceFeaturePanel = observer(function ({ ) : null}
- ) : null + ) }) export default SequenceFeaturePanel diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.tsx index 0d4f8014b3..0baecbb3e8 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.tsx @@ -14,7 +14,9 @@ export default function HelpDialog({ handleClose()} + onClose={() => { + handleClose() + }} title="Feature sequence panel help" > @@ -63,7 +65,13 @@ export default function HelpDialog({ - diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx index 1d1438bb21..69218aff07 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx @@ -47,7 +47,9 @@ const SequenceDialog = observer(function ({ handleClose()} + onClose={() => { + handleClose() + }} title="Sequence view" > @@ -69,36 +71,39 @@ const SequenceDialog = observer(function ({ ) : !sequence ? ( - ) : sequence ? ( - 'error' in sequence ? ( - <> - {sequence.error} - - - ) : ( - }> - - - ) + ) : 'error' in sequence ? ( + <> + {sequence.error} + + ) : ( - No sequence found + }> + + )} - diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.tsx index 7cbe112f54..891b75fb32 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.tsx @@ -91,13 +91,17 @@ const SequenceFeatureMenu = observer( label: 'No coordinates', type: 'radio', checked: showCoordinatesSetting === 'none', - onClick: () => model.setShowCoordinates('none'), + onClick: () => { + model.setShowCoordinates('none') + }, }, { label: 'Coordinates relative to feature start', type: 'radio', checked: showCoordinatesSetting === 'relative', - onClick: () => model.setShowCoordinates('relative'), + onClick: () => { + model.setShowCoordinates('relative') + }, }, ...(showGenomicCoordsOption ? [ @@ -106,7 +110,9 @@ const SequenceFeatureMenu = observer( 'Coordinates relative to genome (only available for continuous genome based sequence types)', type: 'radio' as const, checked: showCoordinatesSetting === 'genomic', - onClick: () => model.setShowCoordinates('genomic'), + onClick: () => { + model.setShowCoordinates('genomic') + }, }, ] : []), @@ -115,7 +121,9 @@ const SequenceFeatureMenu = observer( { label: 'Settings', icon: Settings, - onClick: () => setShowSettings(true), + onClick: () => { + setShowSettings(true) + }, }, ]} > @@ -125,7 +133,9 @@ const SequenceFeatureMenu = observer( {showSettings ? ( setShowSettings(false)} + handleClose={() => { + setShowSettings(false) + }} /> ) : null} diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.tsx index f08b391130..1b9403e24c 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.tsx @@ -25,7 +25,9 @@ const SequenceTypeSelector = observer(function ({ -
@@ -106,11 +94,11 @@ exports[`renders all the different types of built-in slots 1`] = `
@@ -226,32 +214,32 @@ exports[`renders all the different types of built-in slots 1`] = ` class="MuiList-root css-1mk9mw3-MuiList-root" >
  • -
  • -
  • key1 @@ -391,13 +351,13 @@ exports[`renders all the different types of built-in slots 1`] = ` class="MuiCardHeader-action css-sgoict-MuiCardHeader-action" >
    -
  • -
  • -

    stringArrayMapTest

    booleanTest

    @@ -868,25 +750,26 @@ exports[`renders all the different types of built-in slots 1`] = `
    + ,
    `; exports[`renders with defaults of the PileupTrack schema 1`] = `

    Configuration

    @@ -896,7 +779,7 @@ exports[`renders with defaults of the PileupTrack schema 1`] = ` >