Skip to content

Commit

Permalink
upgrade deps, upgrade flow and fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrochowicz committed Jul 2, 2018
1 parent 6bb2d43 commit 42e0462
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

[lints]
all=warn
untyped-import=off
unsafe-getters-setters=off
unclear-type=off

[options]
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"classnames": "^2.2.6",
"filepicker-js": "^2.4.18",
"filesize": "^3.6.1",
"flow-bin": "^0.74.0",
"flow-bin": "^0.75.0",
"history": "^4.7.2",
"lz-string": "^1.4.4",
"mobx": "4.3.1",
Expand All @@ -31,7 +31,7 @@
"react-select": "^2.0.0-beta.1",
"vega": "^3.3.0",
"vega-lite": "^2.5.2",
"vega-tooltip": "^0.11.0"
"vega-tooltip": "^0.12.0"
},
"scripts": {
"start": "react-scripts start",
Expand All @@ -43,12 +43,12 @@
"precommit": "pretty-quick --staged"
},
"devDependencies": {
"cypress": "^3.0.1",
"fetch-mock": "^6.4.4",
"cypress": "^3.0.2",
"fetch-mock": "^6.5.0",
"http-server": "^0.11.1",
"husky": "^0.14.3",
"mobx-react-devtools": "5.0.1",
"prettier": "^1.13.5",
"prettier": "^1.13.7",
"pretty-quick": "^1.6.0",
"react-test-renderer": "^16.4.1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/CopyField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CopyField extends Component<{ getValue: () => string }> {
render() {
const { value } = this

const copiedTooltip = this.copied && (
const copiedTooltip = this.copied != null && (
<Tooltip placement="bottom" className="in" id="tooltip-bottom">
{this.copied}
</Tooltip>
Expand All @@ -58,7 +58,7 @@ class CopyField extends Component<{ getValue: () => string }> {
</Button>
</CopyToClipboard>
</InputGroup.Button>
{!!this.copied && (
{this.copied != null && (
<Overlay
placement="top"
show
Expand Down
3 changes: 2 additions & 1 deletion src/components/DatasetSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class DatasetSelector extends Component<Props> {
{this.datasets ? (
<Fragment>
<option value="">
Choose a {this.props.limitToProjects ? 'project' : 'dataset'}
Choose a{' '}
{this.props.limitToProjects === true ? 'project' : 'dataset'}
</option>
{this.datasets.map(d => {
const text = toID(d)
Expand Down
1 change: 1 addition & 0 deletions src/components/Encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ class Encoding extends Component<EncodingProps> {
.map(s => s._id)}
labels={encodings.filter(e => e !== encoding).map(e => {
return `${e.channel} - ${
/* flowlint-next-line sketchy-null:off */
e.field ? e.field.label || e.field.name : 'n/a'
}`
})}
Expand Down
1 change: 1 addition & 0 deletions src/components/FieldSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class FieldSelect extends Component<Props> {
render() {
const { fields, value, disabled } = this.props
const options = fields.map(f => {
/* flowlint-next-line sketchy-null:off */
return { value: f.name, label: f.label || f.name, field: f }
})
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/GlobalOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GlobalOptions extends Component<Props> {
<FormControl
type="number"
placeholder="Auto"
value={store.config.width || ''}
value={store.config.width != null ? store.config.width : ''}
onChange={e => {
const val = getVal(e.target.value)
if (!isNaN(val)) {
Expand All @@ -44,7 +44,7 @@ class GlobalOptions extends Component<Props> {
<FormControl
type="number"
placeholder="Auto"
value={store.config.height || ''}
value={store.config.height != null ? store.config.height : ''}
onChange={e => {
const val = getVal(e.target.value)
if (!isNaN(val)) {
Expand Down
7 changes: 5 additions & 2 deletions src/components/LoadingAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export default class LoadingAnimation extends Component<{
const { hideOverlay, label } = this.props
return (
<div
className={cx(classes.container, hideOverlay && classes.hideOverlay)}
className={cx(
classes.container,
hideOverlay === true && classes.hideOverlay
)}
>
<div className={classes.center}>
<div className={classes.loader}>Loading...</div>
{label && <small>{label}</small>}
{label != null && <small>{label}</small>}
</div>
</div>
)
Expand Down
1 change: 0 additions & 1 deletion src/components/VegaLiteEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Props = {
}

export default class VegaLiteEmbed extends Component<Props> {
// $FlowIssue: createRef api
nodeRef = React.createRef()

shouldComponentUpdate() {
Expand Down
18 changes: 13 additions & 5 deletions src/util/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const ChartConfig = types
)
},
get generatedSpec() {
if (self.manualSpec) {
if (self.manualSpec != null && self.manualSpec !== '') {
try {
const obj = JSON.parse(self.manualSpec)
return obj
Expand Down Expand Up @@ -244,11 +244,19 @@ export const ChartConfig = types

return {
$schema: 'https://vega.github.io/schema/vega-lite/v2.json',
title: self.title || undefined,
width: self.hasFacetField ? undefined : self.width || undefined,
height: self.hasFacetField ? undefined : self.height || undefined,
title: self.title != null ? self.title : undefined,
width: self.hasFacetField
? undefined
: self.width != null
? self.width
: undefined,
height: self.hasFacetField
? undefined
: self.height != null
? self.height
: undefined,
autosize:
!self.hasFacetField && (self.width || self.height)
!self.hasFacetField && (self.width != null || self.height != null)
? {
type: 'fit',
contains: 'padding'
Expand Down
9 changes: 5 additions & 4 deletions src/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ export function encodeFieldName(name: string) {
return name.replace(/([.[\]])/g, '\\$1')
}

type PossibleFieldType = {| name: string, rdfType?: string |}
// sometimes a `field` doesn't contain an `rdfType`. we'll fallback to `string` in that case
export function fixupJsonFields(
fields: Array<{ name: string, rdfType?: string }>
) {
return fields.map(f => ({
export function fixupJsonFields(fields: Array<PossibleFieldType>) {
const mapped: Array<PossibleFieldType> = fields.map(f => ({
rdfType: 'http://www.w3.org/2001/XMLSchema#string',
...f
}))

return mapped
}
2 changes: 1 addition & 1 deletion src/views/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class App extends Component<AppP> {

runInAction(() => {
store.setFields([
...fields.map(f => ({
...(fields: any).map(f => ({
name: f.name,
rdfType: f.rdfType
})),
Expand Down
6 changes: 3 additions & 3 deletions src/views/AuthGate.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function redirectToOauth() {

async function fetchToken(code: string): Promise<{ access_token: string }> {
const challenge = getAndClearChallenge()
if (!challenge) {
if (challenge == null) {
throw new Error('no challenge in storage')
}
const params = createParams({
Expand Down Expand Up @@ -101,7 +101,7 @@ class AuthGate extends Component<{

if (parsedParams.has('code')) {
this.fetchToken()
} else if (token) {
} else if (token != null) {
this.verifyToken()
} else {
redirectToOauth()
Expand Down Expand Up @@ -133,7 +133,7 @@ class AuthGate extends Component<{
const token = localStorage.getItem('token')

try {
if (!token) {
if (token == null || token === '') {
throw new Error('no token')
}
await verifyToken(token)
Expand Down
65 changes: 41 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,9 @@
version "4.14.87"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.87.tgz#55f92183b048c2c64402afe472f8333f4e319a6b"

"@types/[email protected].1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550"
"@types/[email protected].3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"

"@types/[email protected]":
version "2.2.44"
Expand Down Expand Up @@ -2425,9 +2425,9 @@ cache-base@^1.0.1:
union-value "^1.0.0"
unset-value "^1.0.0"

cachedir@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-1.2.0.tgz#e9a0a25bb21a2b7a0f766f07c41eb7a311919b97"
cachedir@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-1.3.0.tgz#5e01928bf2d95b5edd94b0942188246740e0dbc4"
dependencies:
os-homedir "^1.0.1"

Expand Down Expand Up @@ -3030,7 +3030,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

[email protected]:
[email protected], cross-spawn@^6.0.0:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
Expand Down Expand Up @@ -3223,9 +3223,9 @@ cyclist@~0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"

cypress@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.0.1.tgz#6a8938ce8a551e4ae1bd5fb2ceab038d4ad39c4d"
cypress@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.0.2.tgz#90caef84c91bd52b9cdf123aa76213249a289694"
dependencies:
"@cypress/listr-verbose-renderer" "0.4.1"
"@cypress/xvfb" "1.2.3"
Expand All @@ -3235,17 +3235,18 @@ cypress@^3.0.1:
"@types/chai-jquery" "1.1.35"
"@types/jquery" "3.2.16"
"@types/lodash" "4.14.87"
"@types/minimatch" "3.0.1"
"@types/minimatch" "3.0.3"
"@types/mocha" "2.2.44"
"@types/sinon" "4.0.0"
"@types/sinon-chai" "2.7.29"
bluebird "3.5.0"
cachedir "1.2.0"
cachedir "1.3.0"
chalk "2.4.1"
check-more-types "2.24.0"
commander "2.11.0"
common-tags "1.4.0"
debug "3.1.0"
execa "0.10.0"
executable "4.1.1"
extract-zip "1.6.6"
fs-extra "4.0.1"
Expand All @@ -3260,7 +3261,7 @@ cypress@^3.0.1:
minimist "1.2.0"
progress "1.1.8"
ramda "0.24.1"
request "2.81.0"
request "2.87.0"
request-progress "0.3.1"
supports-color "5.1.0"
tmp "0.0.31"
Expand Down Expand Up @@ -4062,6 +4063,18 @@ exec-sh@^0.2.0:
dependencies:
merge "^1.1.3"

[email protected]:
version "0.10.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
dependencies:
cross-spawn "^6.0.0"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
Expand Down Expand Up @@ -4304,9 +4317,9 @@ fd-slicer@~1.0.1:
dependencies:
pend "~1.2.0"

fetch-mock@^6.4.4:
version "6.4.4"
resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-6.4.4.tgz#c8cf5f21b11ee499ac5a073dafcb36edaa7ec366"
fetch-mock@^6.5.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-6.5.0.tgz#3841b90d5a315e213be61c07f1125be8c52f4f9c"
dependencies:
babel-polyfill "^6.26.0"
glob-to-regexp "^0.4.0"
Expand Down Expand Up @@ -4447,9 +4460,9 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

flow-bin@^0.74.0:
version "0.74.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.74.0.tgz#8017bb00efb37cbe8d81fbb7f464038bde06adc9"
flow-bin@^0.75.0:
version "0.75.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.75.0.tgz#b96d1ee99d3b446a3226be66b4013224ce9df260"

flush-write-stream@^1.0.0:
version "1.0.3"
Expand Down Expand Up @@ -7747,10 +7760,14 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier@^1.12.1, prettier@^1.13.5:
prettier@^1.12.1:
version "1.13.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.5.tgz#7ae2076998c8edce79d63834e9b7b09fead6bfd0"

prettier@^1.13.7:
version "1.13.7"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281"

pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
Expand Down Expand Up @@ -8515,7 +8532,7 @@ [email protected]:
tunnel-agent "^0.6.0"
uuid "^3.0.0"

request@^2.83.0:
request@2.87.0, request@^2.83.0:
version "2.87.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"
dependencies:
Expand Down Expand Up @@ -10046,9 +10063,9 @@ vega-statistics@^1.2:
dependencies:
d3-array "1"

vega-tooltip@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.11.0.tgz#b7212911615b73c2359d41d53db25f45862a8623"
vega-tooltip@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.12.0.tgz#014b21b08ea5fe14eb59c9b6643614c77a3b3e47"
dependencies:
vega-util "^1.7.0"

Expand Down

0 comments on commit 42e0462

Please sign in to comment.