Skip to content

Commit

Permalink
Restore eslint rule for @typescript-eslint/no-unused-vars (#2078)
Browse files Browse the repository at this point in the history
* Remove unused vars

* Allow unused with "_" prefix

* Disable eslint plugin in webpack build

Co-authored-by: Garrett Stevens <[email protected]>
  • Loading branch information
cmdcolin and garrettjstevens authored Jun 30, 2021
1 parent fd1bed1 commit ce7dc89
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 51 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-redeclare": "off",
Expand Down
6 changes: 1 addition & 5 deletions packages/core/TextSearch/BaseResults.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import BaseResult, {
LocStringResult,
RefSequenceResult,
BaseResultArgs,
} from './BaseResults'
import BaseResult, { LocStringResult, RefSequenceResult } from './BaseResults'

test('create BaseResult', () => {
const baseResult = new BaseResult({
Expand Down
1 change: 0 additions & 1 deletion packages/core/TextSearch/TextSearchManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import PluginManager from '../PluginManager'
import QuickLRU from '../util/QuickLRU'
import { SearchType, BaseTextSearchAdapter } from '../data_adapters/BaseAdapter'
import { readConfObject } from '../configuration'
import TextSearchAdapterType from '../pluggableElementTypes/TextSearchAdapterType'

export interface BaseArgs {
searchType: SearchType
Expand Down
3 changes: 1 addition & 2 deletions packages/core/assemblyManager/assembly.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jsonStableStringify from 'json-stable-stringify'
import { cast, getParent, IAnyType, types, Instance } from 'mobx-state-tree'
import { getParent, IAnyType, types, Instance } from 'mobx-state-tree'
import AbortablePromiseCache from 'abortable-promise-cache'
import { readConfObject } from '../configuration'
import {
Expand All @@ -8,7 +8,6 @@ import {
} from '../data_adapters/BaseAdapter'
import PluginManager from '../PluginManager'
import { Region } from '../util/types'
import { Region as MSTRegion } from '../util/types/mst'
import { makeAbortableReaction, when } from '../util'
import QuickLRU from '../util/QuickLRU'

Expand Down
1 change: 0 additions & 1 deletion packages/core/rpc/RpcManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import WebWorkerRpcDriver from './WebWorkerRpcDriver'
import MainThreadRpcDriver from './MainThreadRpcDriver'
import ElectronRpcDriver from './ElectronRpcDriver'
import { AnyConfigurationModel } from '../configuration/configurationSchema'
import { PluginDefinition } from '../PluginLoader'

type DriverClass = WebWorkerRpcDriver | MainThreadRpcDriver | ElectronRpcDriver
type BackendConfigurations = {
Expand Down
4 changes: 0 additions & 4 deletions packages/core/ui/FileSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import { ToggleButtonGroup, ToggleButton } from '@material-ui/lab'
import { observer } from 'mobx-react'
import { isElectron } from '../util'
import {
PreLocalPathLocation,
PreUriLocation,
PreBlobLocation,
PreFileLocation,
LocalPathLocation,
UriLocation,
FileLocation,
Expand Down
1 change: 0 additions & 1 deletion packages/core/util/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
isStateTreeNode,
Instance,
SnapshotOut,
SnapshotIn,
IAnyStateTreeNode,
} from 'mobx-state-tree'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import PluginManager from '@jbrowse/core/PluginManager'
import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'
import { getParentRenderProps } from '@jbrowse/core/util/tracks'
import { getSession, getContainingView } from '@jbrowse/core/util'
import { getContainingView } from '@jbrowse/core/util'
import Tooltip from '../components/Tooltip'
import { getUniqueModificationValues } from '../../shared'
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import List from '@material-ui/core/List'
import Typography from '@material-ui/core/Typography'

import type PluginManager from '@jbrowse/core/PluginManager'
import type { BasePlugin } from '@jbrowse/core/util/types'

import { PluginStoreModel } from '../model'
import InstalledPlugin from './InstalledPlugin'

Expand Down
4 changes: 2 additions & 2 deletions plugins/dotplot-view/src/PAFAdapter/PAFAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export default class PAFAdapter extends BaseFeatureDataAdapter {
if (line.length) {
const [
chr1,
queryRefSeqLen,
,
start1,
end1,
strand,
chr2,
targetRefSeqLen,
,
start2,
end2,
numMatches,
Expand Down
2 changes: 1 addition & 1 deletion plugins/legacy-jbrowse/src/JBrowse1Connection/jb1ToJb2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
UNKNOWN,
UNSUPPORTED,
} from '@jbrowse/core/util/tracks'
import { JBLocation, Track, RefSeqs, RefSeq } from './types'
import { Track, RefSeqs, RefSeq } from './types'

interface Jb2Track {
trackId: string
Expand Down
4 changes: 2 additions & 2 deletions plugins/linear-comparative-view/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ function WindowSizeDlg(props: {
const supplementaryAlignments = SA.split(';')
.filter(aln => !!aln)
.map((aln, index) => {
const [saRef, saStart, saStrand, saCigar] = aln.split(',')
const [saRef, saStart, , saCigar] = aln.split(',')
const saLengthOnRef = getLengthOnRef(saCigar)
const saLength = getLength(saCigar)
const saLengthSansClipping = getLengthSansClipping(saCigar)
const saStrandNormalized = saStrand === '-' ? -1 : 1
// const saStrandNormalized = saStrand === '-' ? -1 : 1
const saClipPos = getClip(saCigar, 1)
const saRealStart = +saStart - 1
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React, { useState, useEffect } from 'react'
import { observer } from 'mobx-react'
import { getSnapshot, getEnv } from 'mobx-state-tree'
import { getEnv } from 'mobx-state-tree'
import { getSession } from '@jbrowse/core/util'
import { Region } from '@jbrowse/core/util/types'
import BaseResult, {
RefSequenceResult,
LocStringResult,
} from '@jbrowse/core/TextSearch/BaseResults'
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
// material ui
import { makeStyles } from '@material-ui/core/styles'
import Button from '@material-ui/core/Button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,9 @@ function ScaleBar({ model, fontSize }: { model: LGV; fontSize: number }) {
function SVGRuler({
model,
fontSize,
rulerHeight,
width,
}: {
model: LGV
rulerHeight: number
fontSize: number
width: number
}) {
Expand Down Expand Up @@ -226,12 +224,7 @@ const SVGHeader = ({ model }: { model: LGV }) => {
<ScaleBar model={model} fontSize={fontSize} />
</g>
<g transform={`translate(0 ${rulerHeight})`}>
<SVGRuler
model={model}
fontSize={fontSize}
rulerHeight={rulerHeight}
width={width}
/>
<SVGRuler model={model} fontSize={fontSize} width={width} />
</g>
</g>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function RefNameAutocomplete({
}) {
const classes = useStyles()
const session = getSession(model)
const { pluginManager } = getEnv(session)
const [open, setOpen] = useState(false)
const [, setError] = useState<Error>()
const [currentSearch, setCurrentSearch] = useState('')
Expand Down Expand Up @@ -133,8 +132,6 @@ function RefNameAutocomplete({

options =
options.length > 100 ? options.slice(0, 100).concat(limitOption) : options
// assembly and regions have loaded
const loaded = regions.length !== 0 && assemblyName
useEffect(() => {
let active = true

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React from 'react'
import {
getSnapshot,
getEnv,
resolveIdentifier,
getRoot,
} from 'mobx-state-tree'
import { getEnv, resolveIdentifier, getRoot } from 'mobx-state-tree'
import { getSession } from '@jbrowse/core/util'
import {
Button,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ConfigurationSchema } from '@jbrowse/core/configuration'
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
import { Region } from '@jbrowse/core/util/types/mst'
import {
createBaseTrackConfig,
createBaseTrackModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function recordStats(event, context, done) {

exports.handler = (event, context, callback) => {
// console.log('Received event:', JSON.stringify(event, null, 2));
const done = (err, res) =>
const done = err =>
callback(null, {
statusCode: err ? '400' : '200',
body: err
Expand Down
1 change: 1 addition & 0 deletions products/jbrowse-desktop/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DISABLE_ESLINT_PLUGIN=true
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export default function sessionModelFactory(pluginManager: PluginManager) {
export type SessionStateModel = ReturnType<typeof sessionModelFactory>
export type SessionModel = Instance<SessionStateModel>

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function z(x: Instance<SessionStateModel>): AbstractSessionModel {
// this function's sole purpose is to get typescript to check
// that the session model implements all of AbstractSessionModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export function createJBrowseTheme(theme?: ThemeOptions) {
}

export function ThemeProvider({
theme,
_theme,
children,
}: {
theme: Theme
_theme: Theme
children: ReactNode
}) {
console.warn(
Expand Down
1 change: 1 addition & 0 deletions products/jbrowse-web/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DISABLE_ESLINT_PLUGIN=true
1 change: 0 additions & 1 deletion products/jbrowse-web/src/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
import { types, addDisposer, Instance, SnapshotOut } from 'mobx-state-tree'
import { autorun } from 'mobx'
import { PluginConstructor } from '@jbrowse/core/Plugin'
import { FatalErrorDialog } from '@jbrowse/core/ui'
import 'fontsource-roboto'
import 'requestidlecallback-polyfill'
Expand Down
2 changes: 1 addition & 1 deletion products/jbrowse-web/src/rootModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function RootModel(
addDisposer(
self,
autorun(() => {
for (const [_, val] of self.savedSessionsVolatile.entries()) {
for (const [, val] of self.savedSessionsVolatile.entries()) {
try {
const key = self.localStorageId(val.name)
localStorage.setItem(key, JSON.stringify({ session: val }))
Expand Down
1 change: 1 addition & 0 deletions products/jbrowse-web/src/sessionModelFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('JBrowseWebSessionModel', () => {
{ name: 'testSession' },
{ pluginManager },
)

const { id, ...rest } = getSnapshot(session)
expect(rest).toMatchSnapshot()
})
Expand Down
1 change: 1 addition & 0 deletions products/jbrowse-web/src/sessionModelFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ export default function sessionModelFactory(
export type SessionStateModel = ReturnType<typeof sessionModelFactory>
export type SessionModel = Instance<SessionStateModel>

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function z(x: Instance<SessionStateModel>): AbstractSessionModel {
// this function's sole purpose is to get typescript to check
// that the session model implements all of AbstractSessionModel
Expand Down

0 comments on commit ce7dc89

Please sign in to comment.