Fix js warnings (#2693)

* react: using prop-types package to fix deprecated React.PropTypes property warning

https://facebook.github.io/react/warnings/dont-call-proptypes.html

* removing babel devDependency because has been deprecated in favor of babel-cli

this fixes a warning during `npm install`:
```
npm WARN deprecated babel@6.23.0:
In 6.x, the babel package has been deprecated in favor of babel-cli.
Check https://opencollective.com/babel to support the Babel maintainers
```

* js: setting ExploreActionButtons.queryEndpoint PropType as required

because it's required in the child component DisplayQueryButton

* js(tests): using object in expandedSlices prop type of SliceCell tests

* js(tests): adding required props to SqlEditor mockedProps

* js(tests): adding required prop editorHeight to TabbedSqlEditors mockedProps

* js: removing unused moments dependency
This commit is contained in:
Denny Biasiolli
2017-04-29 02:56:29 +02:00
committed by Maxime Beauchemin
parent 903612ac6c
commit dee36491c5
8 changed files with 28 additions and 23 deletions

View File

@@ -8,7 +8,7 @@ import DisplayQueryButton from './DisplayQueryButton';
const propTypes = { const propTypes = {
canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired, canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,
slice: PropTypes.object, slice: PropTypes.object,
queryEndpoint: PropTypes.string, queryEndpoint: PropTypes.string.isRequired,
queryResponse: PropTypes.object, queryResponse: PropTypes.object,
chartStatus: PropTypes.string, chartStatus: PropTypes.string,
}; };

View File

@@ -62,7 +62,6 @@
"lodash.throttle": "^4.1.1", "lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.26.0", "mapbox-gl": "^0.26.0",
"moment": "^2.14.1", "moment": "^2.14.1",
"moments": "0.0.2",
"mustache": "^2.2.1", "mustache": "^2.2.1",
"nvd3": "1.8.5", "nvd3": "1.8.5",
"prop-types": "^15.5.8", "prop-types": "^15.5.8",
@@ -97,7 +96,6 @@
"viewport-mercator-project": "^2.1.0" "viewport-mercator-project": "^2.1.0"
}, },
"devDependencies": { "devDependencies": {
"babel": "^6.3.26",
"babel-cli": "^6.14.0", "babel-cli": "^6.14.0",
"babel-core": "^6.10.4", "babel-core": "^6.10.4",
"babel-loader": "^6.2.4", "babel-loader": "^6.2.4",

View File

@@ -10,7 +10,7 @@ describe('SliceCell', () => {
const mockedProps = { const mockedProps = {
slice, slice,
removeSlice: () => {}, removeSlice: () => {},
expandedSlices: () => {}, expandedSlices: {},
}; };
it('is valid', () => { it('is valid', () => {
expect( expect(

View File

@@ -14,6 +14,7 @@ describe('ExploreActionButtons', () => {
json_endpoint: '', json_endpoint: '',
}, },
}, },
queryEndpoint: 'localhost',
}; };
it('renders', () => { it('renders', () => {

View File

@@ -15,6 +15,9 @@ describe('SqlEditor', () => {
latestQuery: queries[0], latestQuery: queries[0],
tables: [table], tables: [table],
queries, queries,
height: '',
editorQueries: [],
dataPreviewQueries: [],
}; };
it('is valid', () => { it('is valid', () => {
expect( expect(

View File

@@ -15,6 +15,7 @@ describe('TabbedSqlEditors', () => {
queries: {}, queries: {},
queryEditors: initialState.queryEditors, queryEditors: initialState.queryEditors,
tabHistory: initialState.tabHistory, tabHistory: initialState.tabHistory,
editorHeight: '',
}; };
it('is valid', () => { it('is valid', () => {
expect( expect(

View File

@@ -1,6 +1,7 @@
// JS // JS
import d3 from 'd3'; import d3 from 'd3';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Select from 'react-select'; import Select from 'react-select';
import { Button } from 'react-bootstrap'; import { Button } from 'react-bootstrap';
@@ -10,11 +11,11 @@ import { TIME_CHOICES } from './constants';
import './filter_box.css'; import './filter_box.css';
const propTypes = { const propTypes = {
origSelectedValues: React.PropTypes.object, origSelectedValues: PropTypes.object,
instantFiltering: React.PropTypes.bool, instantFiltering: PropTypes.bool,
filtersChoices: React.PropTypes.object, filtersChoices: PropTypes.object,
onChange: React.PropTypes.func, onChange: PropTypes.func,
showDateFilter: React.PropTypes.bool, showDateFilter: PropTypes.bool,
}; };
const defaultProps = { const defaultProps = {

View File

@@ -1,6 +1,7 @@
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import d3 from 'd3'; import d3 from 'd3';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import MapGL from 'react-map-gl'; import MapGL from 'react-map-gl';
import ScatterPlotOverlay from 'react-map-gl/dist/overlays/scatterplot.react'; import ScatterPlotOverlay from 'react-map-gl/dist/overlays/scatterplot.react';
@@ -256,20 +257,20 @@ class MapboxViz extends React.Component {
} }
} }
MapboxViz.propTypes = { MapboxViz.propTypes = {
aggregatorName: React.PropTypes.string, aggregatorName: PropTypes.string,
clusterer: React.PropTypes.object, clusterer: PropTypes.object,
globalOpacity: React.PropTypes.number, globalOpacity: PropTypes.number,
mapStyle: React.PropTypes.string, mapStyle: PropTypes.string,
mapboxApiKey: React.PropTypes.string, mapboxApiKey: PropTypes.string,
pointRadius: React.PropTypes.number, pointRadius: PropTypes.number,
pointRadiusUnit: React.PropTypes.string, pointRadiusUnit: PropTypes.string,
renderWhileDragging: React.PropTypes.bool, renderWhileDragging: PropTypes.bool,
rgb: React.PropTypes.array, rgb: PropTypes.array,
sliceHeight: React.PropTypes.number, sliceHeight: PropTypes.number,
sliceWidth: React.PropTypes.number, sliceWidth: PropTypes.number,
viewportLatitude: React.PropTypes.number, viewportLatitude: PropTypes.number,
viewportLongitude: React.PropTypes.number, viewportLongitude: PropTypes.number,
viewportZoom: React.PropTypes.number, viewportZoom: PropTypes.number,
}; };
function mapbox(slice, json) { function mapbox(slice, json) {