diff --git a/.flowconfig b/.flowconfig index 80ac4a6a..8782ac64 100644 --- a/.flowconfig +++ b/.flowconfig @@ -14,6 +14,7 @@ .*node_modules/jshint.* .*node_modules/jstransformify.* .*node_modules/uglify.* +.*node_modules/module-deps.* .*node_modules/data-canvas.* .*node_modules/babel.* .*node_modules/d3.* @@ -31,3 +32,6 @@ [libs] lib node_modules/data-canvas/flowtype + +[options] +suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore diff --git a/package.json b/package.json index 5e3935f3..007979c1 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "eslint-plugin-promise": "^4.0.0", "eslint-plugin-react": "7.22.0", "exorcist": "^0.4.0", - "flow-bin": "^0.144.0", + "flow-bin": "^0.120.1", "http-server": "^0.12.3", "install": "^0.13.0", "istanbul": "^0.4.5", diff --git a/src/main/VisualizationWrapper.js b/src/main/VisualizationWrapper.js index 63038341..1ae9d6e3 100644 --- a/src/main/VisualizationWrapper.js +++ b/src/main/VisualizationWrapper.js @@ -85,7 +85,7 @@ class VisualizationWrapper extends React.Component { window.removeEventListener('resize', this.onResizeListener); } - getScale(): (num: number)=>number { + getScale(): any { if (!this.props.range) return x => x; return d3utils.getTrackScale(this.props.range, this.state.width); } diff --git a/src/main/data/BigBed.js b/src/main/data/BigBed.js index 3a174c83..33c0d16e 100644 --- a/src/main/data/BigBed.js +++ b/src/main/data/BigBed.js @@ -162,7 +162,7 @@ class ImmediateBigBed { contigMap: {[key:string]: number}; chrIdToContig: string[]; - constructor(remoteFile, header, cirTree, contigMap: {[key:string]: number}) { + constructor(remoteFile: RemoteFile, header: Object, cirTree: Object, contigMap: {[key:string]: number}) { this.remoteFile = remoteFile; this.header = header; this.cirTree = cirTree; diff --git a/src/main/data/formats/bamTypes.js b/src/main/data/formats/bamTypes.js index c064e2d0..dda255c4 100644 --- a/src/main/data/formats/bamTypes.js +++ b/src/main/data/formats/bamTypes.js @@ -56,6 +56,7 @@ var ThickAlignment = _.extend(_.clone(ThinAlignment), { auxiliary: ['array', { tag: ['string', 2], val_type: 'char', + // $FlowIgnore: TODO remove flow suppression value: ['if', ctx => ctx.val_type == 'B', { val_type: 'char', num_values: 'int32', diff --git a/src/main/data/gene.js b/src/main/data/gene.js index 5f3b08ae..ada9c9f1 100644 --- a/src/main/data/gene.js +++ b/src/main/data/gene.js @@ -75,7 +75,7 @@ class Gene { codingRegion = new Interval(parseInt(thickStart.values[0].stringValue), parseInt(thickEnd.values[0].stringValue)); } else { - codingRegion = new Interval(position.start(), position.end()); + codingRegion = new Interval(position.start(), position.stop()); } return new Gene({ diff --git a/src/main/viz/CoverageTrack.js b/src/main/viz/CoverageTrack.js index ff778206..9a4dc460 100644 --- a/src/main/viz/CoverageTrack.js +++ b/src/main/viz/CoverageTrack.js @@ -9,7 +9,6 @@ import type {DataSource} from '../sources/DataSource'; import Feature from '../data/feature'; import type {DataCanvasRenderingContext2D} from 'data-canvas'; import type {BinSummary} from './CoverageCache'; -import type {Scale} from './d3utils'; import type {State} from '../types'; import type {VizProps} from '../VisualizationWrapper'; @@ -199,7 +198,7 @@ class CoverageTrack extends React.Component; } - getScale(): Scale { + getScale(): any { return d3utils.getTrackScale(this.props.range, this.props.width); } @@ -248,7 +247,7 @@ class CoverageTrack extends React.Componentnumber) { + renderTicks(ctx: DataCanvasRenderingContext2D, yScale: any) { var axisMax = yScale.domain()[0]; [0, Math.round(axisMax / 2), axisMax].forEach(tick => { // Draw a line indicating the tick diff --git a/src/main/viz/GeneTrack.js b/src/main/viz/GeneTrack.js index 1d56c73b..a213d1fb 100644 --- a/src/main/viz/GeneTrack.js +++ b/src/main/viz/GeneTrack.js @@ -8,7 +8,6 @@ import type {Strand} from '../Alignment'; import Gene from '../data/gene'; import type {DataSource} from '../sources/DataSource'; import type {VizProps} from '../VisualizationWrapper'; -import type {Scale} from './d3utils'; import type {State} from '../types'; import GenericFeature from '../data/genericFeature'; @@ -113,7 +112,7 @@ class GeneTrack extends React.Component>, State> { this.updateVisualization(); } - getScale(): Scale { + getScale(): any { return d3utils.getTrackScale(this.props.range, this.props.width); } diff --git a/src/main/viz/GenotypeTrack.js b/src/main/viz/GenotypeTrack.js index 9f9009fb..a491a347 100644 --- a/src/main/viz/GenotypeTrack.js +++ b/src/main/viz/GenotypeTrack.js @@ -8,7 +8,6 @@ import type {VcfDataSource} from '../sources/VcfDataSource'; import type {VariantContext} from '../data/variant'; import type {DataCanvasRenderingContext2D} from 'data-canvas'; import type {VizProps} from '../VisualizationWrapper'; -import type {Scale} from './d3utils'; import React from 'react'; import _ from 'underscore'; @@ -184,7 +183,7 @@ class GenotypeTrack extends React.Component, State> { this.updateVisualization(); } - getScale(): Scale { + getScale(): any { return d3utils.getTrackScale(this.props.range, this.props.width - LABEL_WIDTH); } diff --git a/src/main/viz/PileupTrack.js b/src/main/viz/PileupTrack.js index 9688c14b..f267b91e 100644 --- a/src/main/viz/PileupTrack.js +++ b/src/main/viz/PileupTrack.js @@ -11,7 +11,6 @@ import type {VisualAlignment, InsertStats} from './PileupCache'; import type {VisualGroup} from './AbstractCache'; import type {DataCanvasRenderingContext2D} from 'data-canvas'; import type {VizProps} from '../VisualizationWrapper'; -import type {Scale} from './d3utils'; import type {State, NetworkStatus} from '../types'; import React from 'react'; @@ -310,7 +309,7 @@ class PileupTrack extends React.Component>, State this.updateVisualization(); } - getScale(): Scale { + getScale(): any { return d3utils.getTrackScale(this.props.range, this.props.width); } diff --git a/src/test/MappedRemoteFile.js b/src/test/MappedRemoteFile.js index 980292e5..606bed7e 100644 --- a/src/test/MappedRemoteFile.js +++ b/src/test/MappedRemoteFile.js @@ -61,7 +61,7 @@ class MappedRemoteFile extends RemoteFile { return buf; }); } else { - return Q.reject(`Request for ${originalRequest} is not mapped in ${this.url}`); + return Q.reject(`Request for ${originalRequest.toString()} is not mapped in ${this.url}`); } } diff --git a/src/test/components-test.js b/src/test/components-test.js index 6db0e301..d81c6529 100644 --- a/src/test/components-test.js +++ b/src/test/components-test.js @@ -83,8 +83,8 @@ describe('pileup', function() { }; // TODO: consider moving this into the data-canvas library - function hasCanvasAndObjects(div, selector) { - return div.querySelector(selector + ' canvas') && drawnObjects(div, selector).length > 0; + function hasCanvasAndObjects(div, selector): boolean { + return div.querySelector(selector + ' canvas') !== null && drawnObjects(div, selector).length > 0; } var ready = ((): boolean => diff --git a/src/test/sources/CytoBandDataSource-test.js b/src/test/sources/CytoBandDataSource-test.js index 6285d44e..01f9ac72 100644 --- a/src/test/sources/CytoBandDataSource-test.js +++ b/src/test/sources/CytoBandDataSource-test.js @@ -30,7 +30,7 @@ describe('CytoBandDataSource', function() { expect(chr.bands[0].value).to.equal('gvar'); done(); }); - source.rangeChanged(range); + source.rangeChanged({contig: range.contig, start: range.start(), stop: range.stop()}); }); it('should allow a mix of chr and non-chr', function(done) {