Skip to content

Commit

Permalink
fix: lints (mostly disabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 30, 2021
1 parent b1074fc commit 096454e
Show file tree
Hide file tree
Showing 31 changed files with 427 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@
"access": "public"
},
"dependencies": {
"@data-ui/xy-chart": "^0.0.80",
"d3": "^3.5.17",
"d3-tip": "^0.9.1",
"dompurify": "^1.0.3",
"fast-safe-stringify": "^2.0.6",
"lodash": "^4.17.11",
"mathjs": "^3.20.2",
"bootstrap-slider": "^10.0.0",
"d3-array": "^1.2.4",
"d3-color": "^1.2.0",
"d3-scale": "^2.1.2",
"deck.gl": "^5.3.5",
"lodash": "^4.17.15",
"mapbox-gl": "^0.53.0",
"moment": "^2.20.1",
"nvd3": "1.8.6",
"prop-types": "^15.6.2",
"urijs": "^1.18.10"
"mousetrap": "^1.6.1",
"prop-types": "^15.6.0",
"react-bootstrap-slider": "2.1.5",
"react-map-gl": "^4.0.10",
"underscore": "^1.8.3",
"urijs": "^1.18.10",
"viewport-mercator-project": "^6.1.1"
},
"peerDependencies": {
"@superset-ui/chart": "^0.12.0",
"@superset-ui/color": "^0.12.0",
"@superset-ui/connection": "^0.12.3",
"@superset-ui/core": "^0.12.0",
"@superset-ui/dimension": "^0.12.0",
"@superset-ui/number-format": "^0.12.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable react/jsx-handler-names */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable react/forbid-prop-types */
/* eslint-disable sort-keys */
/* eslint-disable react/require-default-props */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -20,7 +25,7 @@ import React from 'react';
import PropTypes from 'prop-types';

import DeckGLContainer from './DeckGLContainer';
import PlaySlider from '../PlaySlider';
import PlaySlider from './components/PlaySlider';

const PLAYSLIDER_HEIGHT = 20; // px

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/* eslint-disable react/require-default-props */
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/forbid-prop-types */
/* eslint-disable react/no-access-state-in-setstate */
/* eslint-disable compat/compat */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable react/jsx-handler-names */
/* eslint-disable react/no-unsafe */
/* eslint-disable react/sort-comp */
/* eslint-disable camelcase */
/* eslint-disable no-prototype-builtins */
/* eslint-disable sort-keys */
/* eslint-disable no-eq-null */
/* eslint-disable no-magic-numbers */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -22,7 +36,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { CategoricalColorNamespace } from '@superset-ui/color';
import AnimatableDeckGLContainer from './AnimatableDeckGLContainer';
import Legend from './Legend';
import Legend from './components/Legend';
import { hexToRGB } from './utils/colors';
import { getPlaySliderParams } from './utils/time';
import sandboxedEval from './utils/sandbox';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable react/jsx-handler-names */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable sort-keys */
/* eslint-disable react/forbid-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/* eslint-disable compat/compat */
/* eslint-disable react/no-unsafe */
/* eslint-disable promise/always-return */
/* eslint-disable react/jsx-handler-names */
/* eslint-disable react/no-access-state-in-setstate */
/* eslint-disable react/sort-comp */
/* eslint-disable camelcase */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable sort-keys */
/* eslint-disable react/forbid-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -22,7 +32,7 @@ import PropTypes from 'prop-types';
import { SupersetClient } from '@superset-ui/connection';

import DeckGLContainer from '../DeckGLContainer';
import { getExploreLongUrl } from '../../../explore/exploreUtils';
import { getExploreLongUrl } from '../utils/explore';
import layerGenerators from '../layers';

const propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
.BootstrapSliderWrapper .slider-selection {
background: #efefef;
}

.BootstrapSliderWrapper .slider-handle {
background: #b3b3b3;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import ReactBootstrapSlider from 'react-bootstrap-slider';
import 'bootstrap-slider/dist/css/bootstrap-slider.min.css';
import './BootstrapSliderWrapper.css';

export default function BootstrapSliderWrapper(props) {
return (
<span className="BootstrapSliderWrapper">
<ReactBootstrapSlider {...props} />
</span>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable react/destructuring-assignment */
/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable sort-keys */
/* eslint-disable react/forbid-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -47,8 +51,8 @@ export default class Legend extends React.PureComponent {
}

const numValue = parseFloat(value);
return formatNumber(this.props.format, numValue);

return formatNumber(this.props.format, numValue);
}

formatCategoryLabel(k) {
Expand All @@ -58,6 +62,7 @@ export default class Legend extends React.PureComponent {

if (k.includes(categoryDelimiter)) {
const values = k.split(categoryDelimiter);

return this.format(values[0]) + categoryDelimiter + this.format(values[1]);
}

Expand All @@ -70,8 +75,9 @@ export default class Legend extends React.PureComponent {
}

const categories = Object.entries(this.props.categories).map(([k, v]) => {
const style = { color: 'rgba(' + v.color.join(', ') + ')' };
const style = { color: `rgba(${v.color.join(', ')})` };
const icon = v.enabled ? '\u25FC' : '\u25FB';

return (
<li key={k}>
<a
Expand All @@ -94,8 +100,8 @@ export default class Legend extends React.PureComponent {
};

return (
<div className={'legend'} style={style}>
<ul className={'categories'}>{categories}</ul>
<div className="legend" style={style}>
<ul className="categories">{categories}</ul>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/* eslint-disable react/jsx-handler-names */
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable no-negated-condition */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable no-eq-null */
/* eslint-disable sort-keys */
/* eslint-disable react/forbid-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -20,7 +28,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Mousetrap from 'mousetrap';
import { t } from '@superset-ui/translation';
import BootrapSliderWrapper from '../components/BootstrapSliderWrapper';
import BootrapSliderWrapper from './BootstrapSliderWrapper';
import './PlaySlider.css';

const propTypes = {
Expand Down Expand Up @@ -66,24 +74,30 @@ export default class PlaySlider extends React.PureComponent {
this.getPlayClass = this.getPlayClass.bind(this);
this.formatter = this.formatter.bind(this);
}

componentDidMount() {
Mousetrap.bind(['space'], this.play);
}

componentWillUnmount() {
Mousetrap.unbind(['space']);
}

onChange(event) {
this.props.onChange(event.target.value);
if (this.state.intervalId != null) {
this.pause();
}
}

getPlayClass() {
if (this.state.intervalId == null) {
return 'fa fa-play fa-lg slider-button';
}

return 'fa fa-pause fa-lg slider-button';
}

play() {
if (this.props.disabled) {
return;
Expand All @@ -95,10 +109,12 @@ export default class PlaySlider extends React.PureComponent {
this.setState({ intervalId: id });
}
}

pause() {
clearInterval(this.state.intervalId);
this.setState({ intervalId: null });
}

stepForward() {
const { start, end, step, values, disabled } = this.props;

Expand All @@ -108,10 +124,11 @@ export default class PlaySlider extends React.PureComponent {

const currentValues = Array.isArray(values) ? values : [values, values + step];
const nextValues = currentValues.map(value => value + this.increment);
const carriageReturn = (nextValues[1] > end) ? (nextValues[0] - start) : 0;
const carriageReturn = nextValues[1] > end ? nextValues[0] - start : 0;

this.props.onChange(nextValues.map(value => value - carriageReturn));
}

stepBackward() {
const { start, end, step, values, disabled } = this.props;

Expand All @@ -121,10 +138,11 @@ export default class PlaySlider extends React.PureComponent {

const currentValues = Array.isArray(values) ? values : [values, values + step];
const nextValues = currentValues.map(value => value - this.increment);
const carriageReturn = (nextValues[0] < start) ? (end - nextValues[1]) : 0;
const carriageReturn = nextValues[0] < start ? end - nextValues[1] : 0;

this.props.onChange(nextValues.map(value => value + carriageReturn));
}

formatter(values) {
if (this.props.disabled) {
return t('Data has no time steps');
Expand All @@ -136,10 +154,13 @@ export default class PlaySlider extends React.PureComponent {
} else if (values[0] === values[1]) {
parts = [values[0]];
}
return parts.map(value => (new Date(value)).toUTCString()).join(' : ');

return parts.map(value => new Date(value).toUTCString()).join(' : ');
}

render() {
const { start, end, step, orientation, reversed, disabled, range, values } = this.props;

return (
<div className="play-slider">
<div className="play-slider-controls padded">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/* eslint-disable react/jsx-handler-names */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable react/sort-comp */
/* eslint-disable camelcase */
/* eslint-disable react/no-unsafe */
/* eslint-disable sort-keys */
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/forbid-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-magic-numbers */

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable no-magic-numbers */
/* eslint-disable react/forbid-prop-types */
/* eslint-disable react/no-array-index-key */
/* eslint-disable sort-keys */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-magic-numbers */
/* eslint-disable sort-keys */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -21,7 +23,7 @@ import React from 'react';
import { t } from '@superset-ui/translation';

import { commonLayerProps, getAggFunc } from '../common';
import sandboxedEval from '../../../../modules/sandbox';
import sandboxedEval from '../../utils/sandbox';
import { createDeckGLComponent } from '../../factory';
import TooltipRow from '../../TooltipRow';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-magic-numbers */
/* eslint-disable sort-keys */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -21,7 +23,7 @@ import React from 'react';
import { t } from '@superset-ui/translation';

import { commonLayerProps, getAggFunc } from '../common';
import sandboxedEval from '../../../../modules/sandbox';
import sandboxedEval from '../../utils/sandbox';
import { createDeckGLComponent } from '../../factory';
import TooltipRow from '../../TooltipRow';

Expand Down
Loading

0 comments on commit 096454e

Please sign in to comment.