Skip to content

Commit

Permalink
Remove some prop-types usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 14, 2022
1 parent 2d1a483 commit 87e2eaa
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 97 deletions.
2 changes: 1 addition & 1 deletion packages/__mocks__/@testing-library/react.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
24 changes: 4 additions & 20 deletions packages/core/ui/PrerenderedCanvas.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion plugins/alignments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion plugins/arc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions plugins/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion plugins/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion plugins/data-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 1 addition & 2 deletions plugins/dotplot-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion plugins/gccontent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 0 additions & 3 deletions plugins/gff3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion plugins/grid-bookmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion plugins/gtf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion plugins/hic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion plugins/jobs-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/linear-comparative-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<div>
Expand All @@ -16,12 +17,5 @@ const LinearComparativeDisplay: React.FC<{
</div>
)
}
LinearComparativeDisplay.propTypes = {
model: MobxPropTypes.objectOrObservableObject.isRequired,
children: PropTypes.element,
}

LinearComparativeDisplay.defaultProps = {
children: null,
}
export default observer(LinearComparativeDisplay)
export default observer(Display)
3 changes: 1 addition & 2 deletions plugins/linear-genome-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
1 change: 0 additions & 1 deletion plugins/menus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion plugins/sequence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -37,7 +36,6 @@ class ErrorCatcher extends React.Component {
return children
}
}
ErrorCatcher.propTypes = { children: ReactPropTypes.node.isRequired }

describe('<DivSequenceRendering />', () => {
// This just keeps our testing logs clean by not displaying `console.error`s
Expand Down
1 change: 0 additions & 1 deletion plugins/spreadsheet-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion plugins/sv-inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion plugins/svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion plugins/text-indexing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions plugins/trackhub-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion plugins/trix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 87e2eaa

Please sign in to comment.