From 87e2eaa6c101889063becb45875162358b6e903a Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 13 Dec 2022 20:53:31 -0700 Subject: [PATCH] Remove some prop-types usage --- packages/__mocks__/@testing-library/react.js | 2 +- packages/core/ui/PrerenderedCanvas.tsx | 24 ++---------- plugins/alignments/package.json | 1 - plugins/arc/package.json | 2 +- plugins/authentication/package.json | 4 +- plugins/config/package.json | 1 - plugins/data-management/package.json | 1 - plugins/dotplot-view/package.json | 3 +- plugins/gccontent/package.json | 1 - plugins/gff3/package.json | 3 -- plugins/grid-bookmark/package.json | 1 - plugins/gtf/package.json | 1 - plugins/hic/package.json | 1 - plugins/jobs-management/package.json | 1 - plugins/linear-comparative-view/package.json | 2 +- .../components/LinearComparativeDisplay.tsx | 22 ++++------- plugins/linear-genome-view/package.json | 3 +- .../src/LinearGenomeView/components/Ruler.tsx | 39 ++++++------------- plugins/menus/package.json | 1 - plugins/sequence/package.json | 1 - .../components/DivSequenceRendering.test.js | 2 - plugins/spreadsheet-view/package.json | 1 - plugins/sv-inspector/package.json | 1 - plugins/svg/package.json | 1 - plugins/text-indexing/package.json | 1 - plugins/trackhub-registry/package.json | 2 - plugins/trix/package.json | 1 - plugins/variants/package.json | 1 - plugins/wiggle/package.json | 1 - yarn.lock | 2 +- 30 files changed, 30 insertions(+), 97 deletions(-) diff --git a/packages/__mocks__/@testing-library/react.js b/packages/__mocks__/@testing-library/react.js index c4cdfb6b36..8774907983 100644 --- a/packages/__mocks__/@testing-library/react.js +++ b/packages/__mocks__/@testing-library/react.js @@ -1,5 +1,5 @@ import { createTheme, ThemeProvider } from '@mui/material/styles' -// eslint-disable-next-line import/no-extraneous-dependencies + import React from 'react' const react = jest.requireActual('@testing-library/react') diff --git a/packages/core/ui/PrerenderedCanvas.tsx b/packages/core/ui/PrerenderedCanvas.tsx index 3eac3940e1..514a23063a 100644 --- a/packages/core/ui/PrerenderedCanvas.tsx +++ b/packages/core/ui/PrerenderedCanvas.tsx @@ -1,22 +1,21 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import ReactPropTypes from 'prop-types' import React, { useState, useRef, useEffect } from 'react' import { drawImageOntoCanvasContext } from '../util/offscreenCanvasPonyfill' function PrerenderedCanvas(props: { width: number height: number - highResolutionScaling: number + highResolutionScaling?: number style: any - imageData: any + imageData?: any showSoftClip?: boolean blockKey?: string }) { const { width, height, - highResolutionScaling, - style, + highResolutionScaling = 1, + style = {}, imageData, blockKey, showSoftClip, @@ -57,19 +56,4 @@ function PrerenderedCanvas(props: { ) } -PrerenderedCanvas.propTypes = { - height: ReactPropTypes.number.isRequired, - width: ReactPropTypes.number.isRequired, - highResolutionScaling: ReactPropTypes.number, - style: ReactPropTypes.objectOf(ReactPropTypes.any), - imageData: ReactPropTypes.any, - // config: ReactPropTypes.objectOf(ReactPropTypes.any), -} -PrerenderedCanvas.defaultProps = { - imageData: undefined, - highResolutionScaling: 1, - style: {}, - // config: {}, -} - export default PrerenderedCanvas diff --git a/plugins/alignments/package.json b/plugins/alignments/package.json index 9d7434508c..dfff5f1965 100644 --- a/plugins/alignments/package.json +++ b/plugins/alignments/package.json @@ -55,7 +55,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0", "tss-react": "^4.0.0" diff --git a/plugins/arc/package.json b/plugins/arc/package.json index 4c9fa7a7be..d6271572bc 100644 --- a/plugins/arc/package.json +++ b/plugins/arc/package.json @@ -47,8 +47,8 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", + "react-dom": ">=16.8.0", "rxjs": "^6.0.0" }, "private": true, diff --git a/plugins/authentication/package.json b/plugins/authentication/package.json index 142811cddc..98a067c437 100644 --- a/plugins/authentication/package.json +++ b/plugins/authentication/package.json @@ -37,18 +37,16 @@ "clean": "rimraf dist esm *.tsbuildinfo" }, "dependencies": { + "generic-filehandle": "^3.0.0", "jwt-decode": "^3.1.2" }, "peerDependencies": { "@jbrowse/core": "^2.0.0", "@mui/material": "^5.0.0", "crypto-js": "^3.0.0", - "electron": ">=22.0.0", - "generic-filehandle": "^3.0.0", "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "rxjs": "^6.0.0" diff --git a/plugins/config/package.json b/plugins/config/package.json index fa5d1c6671..629761c27b 100644 --- a/plugins/config/package.json +++ b/plugins/config/package.json @@ -46,7 +46,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "rxjs": "^6.0.0", diff --git a/plugins/data-management/package.json b/plugins/data-management/package.json index e459f0c9ec..f60e9d4efc 100644 --- a/plugins/data-management/package.json +++ b/plugins/data-management/package.json @@ -51,7 +51,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "tss-react": "^4.0.0" }, diff --git a/plugins/dotplot-view/package.json b/plugins/dotplot-view/package.json index a082c56a08..abb41edf5c 100644 --- a/plugins/dotplot-view/package.json +++ b/plugins/dotplot-view/package.json @@ -44,12 +44,11 @@ }, "peerDependencies": { "@jbrowse/core": "^2.0.0", - "@jbrowse/plugin-alignments": "^4.12.2", + "@jbrowse/plugin-alignments": "^2.0.0", "@mui/material": "^5.0.0", "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "rxjs": "^6.0.0", diff --git a/plugins/gccontent/package.json b/plugins/gccontent/package.json index f17a70501a..6afe485dd5 100644 --- a/plugins/gccontent/package.json +++ b/plugins/gccontent/package.json @@ -45,7 +45,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0" }, diff --git a/plugins/gff3/package.json b/plugins/gff3/package.json index a95d587266..615f56d30f 100644 --- a/plugins/gff3/package.json +++ b/plugins/gff3/package.json @@ -47,10 +47,7 @@ "@jbrowse/plugin-linear-genome-view": "^2.0.0", "@mui/material": "^5.0.0", "mobx": "^6.0.0", - "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", - "react": ">=16.8.0", "rxjs": "^6.0.0" }, "publishConfig": { diff --git a/plugins/grid-bookmark/package.json b/plugins/grid-bookmark/package.json index 76d1fcf67d..37c5a46f5d 100644 --- a/plugins/grid-bookmark/package.json +++ b/plugins/grid-bookmark/package.json @@ -49,7 +49,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "tss-react": "^4.0.0" }, diff --git a/plugins/gtf/package.json b/plugins/gtf/package.json index f82da0df3d..23d4b91864 100644 --- a/plugins/gtf/package.json +++ b/plugins/gtf/package.json @@ -48,7 +48,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0" }, diff --git a/plugins/hic/package.json b/plugins/hic/package.json index da6e2d7d3e..4165129b91 100644 --- a/plugins/hic/package.json +++ b/plugins/hic/package.json @@ -47,7 +47,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0" }, diff --git a/plugins/jobs-management/package.json b/plugins/jobs-management/package.json index 73fa56e600..886d9822f5 100644 --- a/plugins/jobs-management/package.json +++ b/plugins/jobs-management/package.json @@ -46,7 +46,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "tss-react": "^4.0.0" }, diff --git a/plugins/linear-comparative-view/package.json b/plugins/linear-comparative-view/package.json index 7170cc6667..d5ce94e787 100644 --- a/plugins/linear-comparative-view/package.json +++ b/plugins/linear-comparative-view/package.json @@ -38,6 +38,7 @@ }, "dependencies": { "@mui/icons-material": "^5.0.1", + "@popperjs/core": "^2.0.0", "clone": "^2.1.2", "copy-to-clipboard": "^3.3.1", "react-popper": "^2.0.0" @@ -50,7 +51,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "rxjs": "^6.0.0", diff --git a/plugins/linear-comparative-view/src/LinearComparativeDisplay/components/LinearComparativeDisplay.tsx b/plugins/linear-comparative-view/src/LinearComparativeDisplay/components/LinearComparativeDisplay.tsx index 9325ebb69a..21148a93d4 100644 --- a/plugins/linear-comparative-view/src/LinearComparativeDisplay/components/LinearComparativeDisplay.tsx +++ b/plugins/linear-comparative-view/src/LinearComparativeDisplay/components/LinearComparativeDisplay.tsx @@ -1,12 +1,13 @@ -import { observer, PropTypes as MobxPropTypes } from 'mobx-react' -import PropTypes from 'prop-types' import React from 'react' -import { LinearComparativeDisplay as LCD } from '../stateModelFactory' +import { observer } from 'mobx-react' -const LinearComparativeDisplay: React.FC<{ - model: LCD +// locals +import { LinearComparativeDisplay } from '../stateModelFactory' + +function Display(props: { + model: LinearComparativeDisplay children?: React.ReactNode -}> = props => { +}) { const { model, children } = props return (
@@ -16,12 +17,5 @@ const LinearComparativeDisplay: React.FC<{
) } -LinearComparativeDisplay.propTypes = { - model: MobxPropTypes.objectOrObservableObject.isRequired, - children: PropTypes.element, -} -LinearComparativeDisplay.defaultProps = { - children: null, -} -export default observer(LinearComparativeDisplay) +export default observer(Display) diff --git a/plugins/linear-genome-view/package.json b/plugins/linear-genome-view/package.json index ff6acd1237..b2d343ea5d 100644 --- a/plugins/linear-genome-view/package.json +++ b/plugins/linear-genome-view/package.json @@ -47,6 +47,7 @@ "file-saver": "^2.0.0", "material-ui-popup-state": "^3.0.0", "normalize-wheel": "^1.0.1", + "react-error-boundary": "^3.0.0", "react-popper": "^2.0.0" }, "peerDependencies": { @@ -55,10 +56,8 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", - "react-error-boundary": "^3.0.0", "tss-react": "^4.0.0" }, "publishConfig": { diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/Ruler.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/Ruler.tsx index 9949119f2c..e46e3d5327 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/Ruler.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/Ruler.tsx @@ -1,39 +1,37 @@ +import React from 'react' import { makeStyles } from 'tss-react/mui' import { observer } from 'mobx-react' -import ReactPropTypes from 'prop-types' -import React from 'react' -import { makeTicks } from '../util' import { getTickDisplayStr } from '@jbrowse/core/util' -const useStyles = makeStyles()((/* theme */) => ({ +// locals +import { makeTicks } from '../util' + +const useStyles = makeStyles()({ majorTickLabel: { fontSize: '11px', - // fill: theme.palette.text.primary, }, majorTick: { stroke: '#555', - // stroke: theme.palette.text.secondary, }, minorTick: { stroke: '#999', - // stroke: theme.palette.text.hint, }, -})) +}) function Ruler({ start, end, bpPerPx, - reversed, - major, - minor, + reversed = false, + major = true, + minor = true, }: { start: number end: number bpPerPx: number reversed?: boolean - major: boolean - minor: boolean + major?: boolean + minor?: boolean }) { const { classes } = useStyles() const ticks = makeTicks(start, end, bpPerPx, major, minor) @@ -77,19 +75,4 @@ function Ruler({ ) } -Ruler.propTypes = { - start: ReactPropTypes.number.isRequired, - end: ReactPropTypes.number.isRequired, - bpPerPx: ReactPropTypes.number.isRequired, - reversed: ReactPropTypes.bool, - major: ReactPropTypes.bool, - minor: ReactPropTypes.bool, -} - -Ruler.defaultProps = { - reversed: false, - major: true, - minor: true, -} - export default observer(Ruler) diff --git a/plugins/menus/package.json b/plugins/menus/package.json index e47795fffe..60ea57ab22 100644 --- a/plugins/menus/package.json +++ b/plugins/menus/package.json @@ -47,7 +47,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "tss-react": "^4.0.0" diff --git a/plugins/sequence/package.json b/plugins/sequence/package.json index e2ca69c1e4..8e8d10f88b 100644 --- a/plugins/sequence/package.json +++ b/plugins/sequence/package.json @@ -49,7 +49,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0" }, diff --git a/plugins/sequence/src/DivSequenceRenderer/components/DivSequenceRendering.test.js b/plugins/sequence/src/DivSequenceRenderer/components/DivSequenceRendering.test.js index d8017873a8..5d48a71d84 100644 --- a/plugins/sequence/src/DivSequenceRenderer/components/DivSequenceRendering.test.js +++ b/plugins/sequence/src/DivSequenceRenderer/components/DivSequenceRendering.test.js @@ -1,5 +1,4 @@ import React from 'react' -import ReactPropTypes from 'prop-types' import { render } from '@testing-library/react' import { createJBrowseTheme } from '@jbrowse/core/ui' import PrecomputedLayout from '@jbrowse/core/util/layouts/PrecomputedLayout' @@ -37,7 +36,6 @@ class ErrorCatcher extends React.Component { return children } } -ErrorCatcher.propTypes = { children: ReactPropTypes.node.isRequired } describe('', () => { // This just keeps our testing logs clean by not displaying `console.error`s diff --git a/plugins/spreadsheet-view/package.json b/plugins/spreadsheet-view/package.json index 5e41cafcd6..69c8d840ea 100644 --- a/plugins/spreadsheet-view/package.json +++ b/plugins/spreadsheet-view/package.json @@ -50,7 +50,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "rxjs": "^6.0.0", diff --git a/plugins/sv-inspector/package.json b/plugins/sv-inspector/package.json index df07e7e5ac..dac3d64439 100644 --- a/plugins/sv-inspector/package.json +++ b/plugins/sv-inspector/package.json @@ -48,7 +48,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "tss-react": "^4.0.0" diff --git a/plugins/svg/package.json b/plugins/svg/package.json index 75585e0bce..a5221e0bb5 100644 --- a/plugins/svg/package.json +++ b/plugins/svg/package.json @@ -41,7 +41,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0" }, "publishConfig": { diff --git a/plugins/text-indexing/package.json b/plugins/text-indexing/package.json index 54cf0a60d4..00f6bc571d 100644 --- a/plugins/text-indexing/package.json +++ b/plugins/text-indexing/package.json @@ -44,7 +44,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0" }, "private": true, diff --git a/plugins/trackhub-registry/package.json b/plugins/trackhub-registry/package.json index d1b9e9d2c6..f4b25e7d36 100644 --- a/plugins/trackhub-registry/package.json +++ b/plugins/trackhub-registry/package.json @@ -43,11 +43,9 @@ "peerDependencies": { "@jbrowse/core": "^2.0.0", "@mui/material": "^5.0.0", - "dompurify": "^2.0.11", "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "tss-react": "^4.0.0" }, diff --git a/plugins/trix/package.json b/plugins/trix/package.json index 8ec32d9089..a3cab43f40 100644 --- a/plugins/trix/package.json +++ b/plugins/trix/package.json @@ -42,7 +42,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0" }, "dependencies": { diff --git a/plugins/variants/package.json b/plugins/variants/package.json index 788c2885a0..513852b816 100644 --- a/plugins/variants/package.json +++ b/plugins/variants/package.json @@ -54,7 +54,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0", "tss-react": "^4.0.0" diff --git a/plugins/wiggle/package.json b/plugins/wiggle/package.json index f8e0d786b8..aa0c448c21 100644 --- a/plugins/wiggle/package.json +++ b/plugins/wiggle/package.json @@ -59,7 +59,6 @@ "mobx": "^6.0.0", "mobx-react": "^7.0.0", "mobx-state-tree": "^5.0.0", - "prop-types": "^15.0.0", "react": ">=16.8.0", "rxjs": "^6.0.0", "tss-react": "^4.0.0" diff --git a/yarn.lock b/yarn.lock index 8632ae12a7..fb8e5de956 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3607,7 +3607,7 @@ schema-utils "^3.0.0" source-map "^0.7.3" -"@popperjs/core@^2.11.0", "@popperjs/core@^2.11.6": +"@popperjs/core@^2.0.0", "@popperjs/core@^2.11.0", "@popperjs/core@^2.11.6": version "2.11.6" resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45" integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==