Skip to content

Commit

Permalink
Bump prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jul 17, 2023
1 parent 1650c90 commit a8409c4
Show file tree
Hide file tree
Showing 31 changed files with 744 additions and 516 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
"testing-library/prefer-screen-queries": 0,

"unicorn/no-new-array": 0,
"unicorn/no-empty-file": 0,
"unicorn/prefer-type-error": 0,
"unicorn/prefer-modern-math-apis": 0,
"unicorn/prefer-node-protocol": 0,
"unicorn/no-unreadable-array-destructuring": 0,
"unicorn/no-abusive-eslint-disable": 0,
Expand Down
2 changes: 1 addition & 1 deletion component_tests/cgv/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion component_tests/lgv/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion component_tests/react-app/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"@types/shortid": "^0.0.29",
"@types/string-template": "^1.0.2",
"@types/tmp": "^0.2.1",
"@typescript-eslint/parser": "^5.45.1",
"@typescript-eslint/parser": "^6.0.0",
"babel-loader": "^9.1.0",
"body-parser": "^1.20.2",
"canvas": "^2.9.1",
Expand All @@ -103,18 +103,18 @@
"cross-spawn": "^7.0.1",
"crypto-js": "^3.0.0",
"dependency-graph": "^0.11.0",
"electron": "25.2.0",
"electron": "25.3.0",
"electron-builder": "^24.4.0",
"electron-mock-ipc": "^0.3.8",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-monorepo": "^0.3.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-tsdoc": "^0.2.4",
"eslint-plugin-unicorn": "^47.0.0",
"eslint-plugin-unicorn": "^48.0.0",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
"file-loader": "^6.2.0",
Expand All @@ -133,7 +133,7 @@
"nock": "^13.2.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"prettier": "^3.0.0",
"prop-types": "^15.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0",
Expand Down
281 changes: 140 additions & 141 deletions packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,153 +20,152 @@ interface SeqPanelProps {
mode: string
intronBp?: number
}
const SeqPanel = React.forwardRef<HTMLDivElement, SeqPanelProps>(function (
props,
ref,
) {
const { feature, mode, intronBp = 10 } = props
let {
sequence: { seq, upstream = '', downstream = '' },
} = props
const { subfeatures = [] } = feature
const SeqPanel = React.forwardRef<HTMLDivElement, SeqPanelProps>(
function (props, ref) {
const { feature, mode, intronBp = 10 } = props
let {
sequence: { seq, upstream = '', downstream = '' },
} = props
const { subfeatures = [] } = feature

const children = subfeatures
.sort((a, b) => a.start - b.start)
.map(sub => ({
...sub,
start: sub.start - feature.start,
end: sub.end - feature.start,
}))
const children = subfeatures
.sort((a, b) => a.start - b.start)
.map(sub => ({
...sub,
start: sub.start - feature.start,
end: sub.end - feature.start,
}))

// we filter duplicate entries in cds and exon lists duplicate entries may be
// rare but was seen in Gencode v36 track NCList, likely a bug on GFF3 or
// probably worth ignoring here (produces broken protein translations if
// included)
//
// position 1:224,800,006..225,203,064 gene ENSG00000185842.15 first
// transcript ENST00000445597.6
//
// http://localhost:3000/?config=test_data%2Fconfig.json&session=share-FUl7G1isvF&password=HXh5Y
// we filter duplicate entries in cds and exon lists duplicate entries may be
// rare but was seen in Gencode v36 track NCList, likely a bug on GFF3 or
// probably worth ignoring here (produces broken protein translations if
// included)
//
// position 1:224,800,006..225,203,064 gene ENSG00000185842.15 first
// transcript ENST00000445597.6
//
// http://localhost:3000/?config=test_data%2Fconfig.json&session=share-FUl7G1isvF&password=HXh5Y

let cds = dedupe(children.filter(sub => sub.type === 'CDS'))
let utr = dedupe(children.filter(sub => sub.type.match(/utr/i)))
let exons = dedupe(children.filter(sub => sub.type === 'exon'))
let cds = dedupe(children.filter(sub => sub.type === 'CDS'))
let utr = dedupe(children.filter(sub => sub.type.match(/utr/i)))
let exons = dedupe(children.filter(sub => sub.type === 'exon'))

if (!utr.length && cds.length && exons.length) {
utr = calculateUTRs(cds, exons)
}
if (!utr.length && cds.length && !exons.length) {
utr = calculateUTRs2(cds, {
start: 0,
end: feature.end - feature.start,
type: 'gene',
})
}
if (!utr.length && cds.length && exons.length) {
utr = calculateUTRs(cds, exons)
}
if (!utr.length && cds.length && !exons.length) {
utr = calculateUTRs2(cds, {
start: 0,
end: feature.end - feature.start,
type: 'gene',
})
}

if (feature.strand === -1) {
// doing this in a single assignment is needed because downstream and
// upstream are swapped so this avoids a temp variable
;[seq, upstream, downstream] = [
revcom(seq),
revcom(downstream),
revcom(upstream),
]
cds = revlist(cds, seq.length)
exons = revlist(exons, seq.length)
utr = revlist(utr, seq.length)
}
const codonTable = generateCodonTable(defaultCodonTable)
if (feature.strand === -1) {
// doing this in a single assignment is needed because downstream and
// upstream are swapped so this avoids a temp variable
;[seq, upstream, downstream] = [
revcom(seq),
revcom(downstream),
revcom(upstream),
]
cds = revlist(cds, seq.length)
exons = revlist(exons, seq.length)
utr = revlist(utr, seq.length)
}
const codonTable = generateCodonTable(defaultCodonTable)

return (
<div ref={ref} data-testid="sequence_panel">
<div
style={{
/* raw styles instead of className so that html copy works */
fontFamily: 'monospace',
wordWrap: 'break-word',
overflow: 'auto',
color: 'black',
fontSize: 12,
maxWidth: 600,
maxHeight: 300,
}}
>
<span style={{ background: 'white' }}>
{`>${
feature.name ||
feature.id ||
`${feature.refName}:${feature.start + 1}-${feature.end}`
}-${mode}\n`}
</span>
<br />
{mode === 'genomic' ? (
<GenomicSequence sequence={seq} />
) : mode === 'genomic_sequence_updownstream' ? (
<GenomicSequence
sequence={seq}
upstream={upstream}
downstream={downstream}
/>
) : mode === 'cds' ? (
<CDSSequence cds={cds} sequence={seq} />
) : mode === 'cdna' ? (
<CDNASequence
exons={exons}
cds={cds}
utr={utr}
sequence={seq}
intronBp={intronBp}
/>
) : mode === 'protein' ? (
<ProteinSequence cds={cds} codonTable={codonTable} sequence={seq} />
) : mode === 'gene' ? (
<CDNASequence
exons={exons}
cds={cds}
utr={utr}
sequence={seq}
includeIntrons
intronBp={intronBp}
/>
) : mode === 'gene_collapsed_intron' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
includeIntrons
collapseIntron
intronBp={intronBp}
/>
) : mode === 'gene_updownstream' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
upstream={upstream}
downstream={downstream}
includeIntrons
intronBp={intronBp}
/>
) : mode === 'gene_updownstream_collapsed_intron' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
upstream={upstream}
downstream={downstream}
includeIntrons
collapseIntron
intronBp={intronBp}
/>
) : (
<div>Unknown type</div>
)}
return (
<div ref={ref} data-testid="sequence_panel">
<div
style={{
/* raw styles instead of className so that html copy works */
fontFamily: 'monospace',
wordWrap: 'break-word',
overflow: 'auto',
color: 'black',
fontSize: 12,
maxWidth: 600,
maxHeight: 300,
}}
>
<span style={{ background: 'white' }}>
{`>${
feature.name ||
feature.id ||
`${feature.refName}:${feature.start + 1}-${feature.end}`
}-${mode}\n`}
</span>
<br />
{mode === 'genomic' ? (
<GenomicSequence sequence={seq} />
) : mode === 'genomic_sequence_updownstream' ? (
<GenomicSequence
sequence={seq}
upstream={upstream}
downstream={downstream}
/>
) : mode === 'cds' ? (
<CDSSequence cds={cds} sequence={seq} />
) : mode === 'cdna' ? (
<CDNASequence
exons={exons}
cds={cds}
utr={utr}
sequence={seq}
intronBp={intronBp}
/>
) : mode === 'protein' ? (
<ProteinSequence cds={cds} codonTable={codonTable} sequence={seq} />
) : mode === 'gene' ? (
<CDNASequence
exons={exons}
cds={cds}
utr={utr}
sequence={seq}
includeIntrons
intronBp={intronBp}
/>
) : mode === 'gene_collapsed_intron' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
includeIntrons
collapseIntron
intronBp={intronBp}
/>
) : mode === 'gene_updownstream' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
upstream={upstream}
downstream={downstream}
includeIntrons
intronBp={intronBp}
/>
) : mode === 'gene_updownstream_collapsed_intron' ? (
<CDNASequence
exons={exons}
cds={cds}
sequence={seq}
utr={utr}
upstream={upstream}
downstream={downstream}
includeIntrons
collapseIntron
intronBp={intronBp}
/>
) : (
<div>Unknown type</div>
)}
</div>
</div>
</div>
)
})
)
},
)

export default SeqPanel
4 changes: 2 additions & 2 deletions packages/core/PluginManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class TypeRecord<ElementClass extends PluggableElementBase> {

constructor(
public typeName: string,
public baseClass: // eslint-disable-next-line @typescript-eslint/no-explicit-any
| { new (...args: any[]): ElementClass }
public baseClass:
| { new (...args: unknown[]): ElementClass }
// covers abstract class case
| (Function & {
prototype: ElementClass
Expand Down
Loading

0 comments on commit a8409c4

Please sign in to comment.