mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
build: migrate to nimbus (#8)
* build: migrate to nimbus * fix: eslint-disable statements * fix: conflict * fix: lint * fix: lints * fix: bump packages
This commit is contained in:
parent
b50ab75983
commit
b7ec4bf266
@ -1,30 +1,56 @@
|
||||
.babelrc
|
||||
.cache
|
||||
.cache-loader
|
||||
.DS_Store
|
||||
*.DS_Store
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# Cache
|
||||
.bundle/
|
||||
.happo/
|
||||
.idea/
|
||||
.next/
|
||||
.cache
|
||||
.eslintcache
|
||||
.eslintignore
|
||||
.eslintrc.js
|
||||
.idea
|
||||
.npm
|
||||
.prettierignore
|
||||
.vscode
|
||||
.yarnclean
|
||||
|
||||
*.log
|
||||
*.map
|
||||
*.min.js
|
||||
|
||||
babel.config.js
|
||||
# Directories
|
||||
build/
|
||||
coverage/
|
||||
dist/
|
||||
esm/
|
||||
jest.config.js
|
||||
lib/
|
||||
logs/
|
||||
public/
|
||||
node_modules/
|
||||
package-lock.json
|
||||
tmp/
|
||||
|
||||
# Custom
|
||||
*.map
|
||||
*.min.js
|
||||
test-changelog.md
|
||||
|
||||
# Configs (provided by Nimbus)
|
||||
.babelrc
|
||||
.eslintignore
|
||||
.eslintrc.js
|
||||
.flowconfig
|
||||
.prettierignore
|
||||
babel.config.js
|
||||
jest.config.js
|
||||
prettier.config.js
|
||||
tsconfig.eslint.json
|
||||
tsconfig.json
|
||||
tsconfig.options.json
|
||||
*.tsbuildinfo
|
||||
webpack.config.js
|
||||
|
||||
# Lock files, libs should not have lock files
|
||||
npm-shrinkwrap.json
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
old-yarn.lock
|
||||
.*.swp
|
||||
_gh-pages
|
@ -1,8 +1,7 @@
|
||||
# @superset-ui/plugins-deckgl 🔌💡
|
||||
|
||||
[![Codecov branch](https://img.shields.io/codecov/c/github/apache-superset/superset-ui-plugins-deckgl/master.svg?style=flat-square)](https://codecov.io/gh/apache-superset/superset-ui-plugins-deckgl/branch/master)
|
||||
[![Build Status](https://img.shields.io/travis/com/apache-superset/superset-ui-plugins-deckgl/master.svg?style=flat-square
|
||||
)](https://travis-ci.com/apache-superset/superset-ui-plugins-deckgl)
|
||||
[![Build Status](https://img.shields.io/travis/com/apache-superset/superset-ui-plugins-deckgl/master.svg?style=flat-square)](https://travis-ci.com/apache-superset/superset-ui-plugins-deckgl)
|
||||
[![David](https://img.shields.io/david/dev/apache-superset/superset-ui-plugins-deckgl.svg?style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins-deckgl?type=dev)
|
||||
[![Netlify Status](https://api.netlify.com/api/v1/badges/4d054ead-0e76-4e03-b684-797ca5924161/deploy-status)](https://app.netlify.com/sites/superset-ui-plugins-deckgl/deploys)
|
||||
|
||||
@ -15,13 +14,15 @@ Current master: https://superset-ui-plugins-deckgl.netlify.com
|
||||
## Packages
|
||||
|
||||
| Package | Version |
|
||||
|--|--|
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@superset-ui/legacy-preset-chart-deckgl](https://github.com/apache-superset/superset-ui-plugins-deckgl/tree/master/packages/superset-ui-legacy-preset-chart-deckgl) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-deckgl.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-deckgl.svg?style=flat-square) |
|
||||
|
||||
## Contribution and development guide
|
||||
|
||||
Please read the [contributing guidelines](https://github.com/apache-superset/superset-ui/blob/master/CONTRIBUTING.md) which include development environment setup
|
||||
and other things you should know about coding in this repo.
|
||||
Please read the
|
||||
[contributing guidelines](https://github.com/apache-superset/superset-ui/blob/master/CONTRIBUTING.md)
|
||||
which include development environment setup and other things you should know about coding in this
|
||||
repo.
|
||||
|
||||
### License
|
||||
|
||||
|
@ -4,25 +4,28 @@
|
||||
"description": "Superset UI Plugins - deck.gl",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "yarn build:cjs && yarn build:esm && yarn run type:dts && yarn build:assets",
|
||||
"build:cjs": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir lib/ --delete-dir-on-start --minify --workspaces=\"@superset-ui/!(plugins-demo)\"",
|
||||
"build:esm": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir esm/ --delete-dir-on-start --esm --minify --workspaces=\"@superset-ui/!(plugins-demo)\"",
|
||||
"build:assets": "node ./buildAssets.js",
|
||||
"build": "yarn babel && yarn type && yarn build:assets",
|
||||
"babel": "yarn babel:cjs && yarn babel:esm",
|
||||
"babel:cjs": "nimbus babel --clean --workspaces=\"@superset-ui/!(plugins-demo)\"",
|
||||
"babel:esm": "nimbus babel --clean --workspaces=\"@superset-ui/!(plugins-demo)\" --esm",
|
||||
"build:assets": "node ./scripts/buildAssets.js",
|
||||
"clean": "rm -rf ./packages/**/{lib,esm}",
|
||||
"commit": "superset-commit",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"type": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/((preset|plugin)-*)\" --noEmit",
|
||||
"type:dts": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/((preset|plugin)-*)\" --emitDeclarationOnly",
|
||||
"lint": "beemo create-config prettier && beemo eslint \"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx}\"",
|
||||
"lint:fix": "beemo create-config prettier && beemo eslint --fix \"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx}\"",
|
||||
"jest": "beemo jest --color --coverage --react",
|
||||
"format": "yarn prettier --write",
|
||||
"jest": "NODE_ENV=test nimbus jest --coverage --verbose",
|
||||
"lint": "nimbus eslint && nimbus prettier --check",
|
||||
"lint:fix": "nimbus eslint --fix",
|
||||
"prettier": "nimbus prettier",
|
||||
"test": "yarn type",
|
||||
"test:watch": "yarn lint:fix && yarn jest --watch",
|
||||
"type": "nimbus typescript --build --reference-workspaces",
|
||||
"prepare-release": "git checkout master && git pull --rebase origin master && lerna bootstrap && yarn install && yarn test",
|
||||
"prerelease": "yarn build",
|
||||
"pretest": "yarn lint",
|
||||
"release": "yarn prepare-release && lerna publish --exact && yarn postrelease",
|
||||
"postrelease": "lerna run deploy-demo",
|
||||
"prepare-release": "git checkout master && git pull --rebase origin master && lerna bootstrap && yarn run test",
|
||||
"prerelease": "yarn run build",
|
||||
"pretest": "yarn run lint",
|
||||
"prettier": "beemo prettier \"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx,json,md}\"",
|
||||
"release": "yarn run prepare-release && lerna publish && yarn run postrelease",
|
||||
"test": "yarn run type && yarn run jest",
|
||||
"test:watch": "yarn run lint:fix && beemo create-config jest --react && jest --watch"
|
||||
"storybook": "cd packages/superset-ui-plugins-demo && yarn storybook"
|
||||
},
|
||||
"repository": "https://github.com/apache-superset/superset-ui-plugins-deckgl.git",
|
||||
"keywords": [
|
||||
@ -33,65 +36,99 @@
|
||||
"analysis",
|
||||
"visualization",
|
||||
"react",
|
||||
"d3",
|
||||
"data-ui",
|
||||
"vx"
|
||||
"d3"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@superset-ui/build-config": "^0.1.0",
|
||||
"@superset-ui/chart": "^0.12.1",
|
||||
"@superset-ui/chart-composition": "^0.12.1",
|
||||
"@superset-ui/color": "^0.12.1",
|
||||
"@airbnb/config-babel": "^2.1.3",
|
||||
"@airbnb/config-eslint": "^2.1.3",
|
||||
"@airbnb/config-jest": "^2.1.3",
|
||||
"@airbnb/config-prettier": "^2.0.4",
|
||||
"@airbnb/config-typescript": "^2.1.2",
|
||||
"@airbnb/nimbus": "^2.1.3",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
"@superset-ui/commit-config": "^0.0.9",
|
||||
"@superset-ui/connection": "^0.12.0",
|
||||
"@superset-ui/core": "^0.12.0",
|
||||
"@superset-ui/dimension": "^0.12.0",
|
||||
"@superset-ui/number-format": "^0.12.1",
|
||||
"@superset-ui/query": "^0.12.2",
|
||||
"@superset-ui/time-format": "^0.12.1",
|
||||
"@superset-ui/translation": "^0.12.0",
|
||||
"@types/react": "^16.8.8",
|
||||
"core-js": "^3.0.1",
|
||||
"@superset-ui/superset-ui": "^0.12.5",
|
||||
"@types/enzyme": "^3.10.3",
|
||||
"@types/jest": "^25.1.1",
|
||||
"@types/jsdom": "^12.2.4",
|
||||
"@types/react": "^16.9.0",
|
||||
"@types/react-test-renderer": "^16.9.0",
|
||||
"csstype": "^2.6.3",
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-adapter-react-16": "^1.15.1",
|
||||
"enzyme-to-json": "^3.4.3",
|
||||
"fast-glob": "^3.0.1",
|
||||
"fs-extra": "^8.0.1",
|
||||
"husky": "^3.0.3",
|
||||
"lerna": "^3.2.1",
|
||||
"lint-staged": "^9.2.1",
|
||||
"luma.gl": "^7.3.0",
|
||||
"react": "^16.6.0",
|
||||
"react-dom": "^16.6.0",
|
||||
"yarn": "^1.9.4"
|
||||
"husky": "^4.2.1",
|
||||
"jest-mock-console": "^1.0.0",
|
||||
"lerna": "^3.15.0",
|
||||
"lint-staged": "^10.0.7",
|
||||
"luma.gl": "^7.3.2",
|
||||
"react-test-renderer": "^16.9.0",
|
||||
"react-dom": "^16.9.0",
|
||||
"react": "^16.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
},
|
||||
"beemo": {
|
||||
"module": "@superset-ui/build-config",
|
||||
"drivers": [
|
||||
"babel",
|
||||
"eslint",
|
||||
{
|
||||
"driver": "jest",
|
||||
"env": {
|
||||
"NODE_ENV": "test"
|
||||
}
|
||||
},
|
||||
"prettier",
|
||||
"typescript"
|
||||
],
|
||||
"typescript": {
|
||||
"compilerOptions": {
|
||||
"typeRoots": [
|
||||
"../../node_modules/vega-lite/typings"
|
||||
]
|
||||
}
|
||||
}
|
||||
"node": ">=10.10.0",
|
||||
"npm": ">=6.8.0",
|
||||
"yarn": ">=1.13.0"
|
||||
},
|
||||
"workspaces": [
|
||||
"./packages/*"
|
||||
],
|
||||
"nimbus": {
|
||||
"drivers": [
|
||||
"babel",
|
||||
"eslint",
|
||||
"jest",
|
||||
"prettier",
|
||||
"typescript"
|
||||
],
|
||||
"settings": {
|
||||
"library": true,
|
||||
"react": true,
|
||||
"next": true,
|
||||
"env": {
|
||||
"corejs": 3,
|
||||
"useBuiltIns": "usage"
|
||||
}
|
||||
},
|
||||
"babel": {
|
||||
"plugins": [["@babel/plugin-transform-runtime", { "corejs": 3 }]]
|
||||
},
|
||||
"jest": {
|
||||
"timers": "real",
|
||||
"setupFilesAfterEnv": [
|
||||
"@airbnb/config-jest/enzyme"
|
||||
],
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 0,
|
||||
"functions": 0,
|
||||
"lines": 0,
|
||||
"statements": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint": {
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.{js,jsx,ts,tsx}",
|
||||
"rules": {
|
||||
"react/jsx-no-literals": "off",
|
||||
"prefer-exponentiation-operator": "off",
|
||||
"@typescript-eslint/no-explicit-any": ["warn", { "fixToUnknown": false }]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"typescript": {
|
||||
"compilerOptions": {
|
||||
"emitDeclarationOnly": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
@ -100,7 +137,7 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx,json,md}": [
|
||||
"yarn run prettier --write",
|
||||
"yarn prettier --write",
|
||||
"git add"
|
||||
]
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable react/jsx-handler-names */
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
|
@ -1,17 +1,9 @@
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
@ -107,6 +99,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getStateFromProps(props, state) {
|
||||
const features = props.payload.data.features || [];
|
||||
const timestamps = features.map(f => f.__timestamp);
|
||||
@ -178,6 +171,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
|
||||
return [getLayer(fd, filteredPayload, onAddFilter, setTooltip)];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
addColor(data, fd) {
|
||||
const c = fd.color_picker || { r: 0, g: 0, b: 0, a: 1 };
|
||||
const colorFn = getScale(fd.color_scheme);
|
||||
@ -233,7 +227,6 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
|
||||
end={this.state.end}
|
||||
getStep={this.state.getStep}
|
||||
values={this.state.values}
|
||||
onValuesChange={this.onValuesChange}
|
||||
disabled={this.state.disabled}
|
||||
viewport={this.state.viewport}
|
||||
mapboxApiAccessToken={this.props.mapboxApiKey}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
@ -98,13 +98,13 @@ export default class DeckGLContainer extends React.Component {
|
||||
return (
|
||||
<div style={{ position: 'relative', width, height: adjustedHeight }}>
|
||||
<DeckGL
|
||||
initWebGLParameters
|
||||
controller
|
||||
width={width}
|
||||
height={adjustedHeight}
|
||||
layers={layers}
|
||||
viewState={viewState}
|
||||
onViewStateChange={this.onViewStateChange}
|
||||
initWebGLParameters
|
||||
controller
|
||||
>
|
||||
<StaticMap
|
||||
mapStyle={this.props.mapStyle}
|
||||
|
@ -1,13 +1,8 @@
|
||||
/* eslint-disable compat/compat */
|
||||
/* eslint-disable react/no-unsafe */
|
||||
/* eslint-disable promise/always-return */
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
@ -126,10 +121,10 @@ class DeckMulti extends React.PureComponent {
|
||||
<DeckGLContainer
|
||||
mapboxApiAccessToken={payload.data.mapboxApiKey}
|
||||
viewport={this.state.viewport || this.props.viewport}
|
||||
onViewportChange={this.onViewportChange}
|
||||
layers={layers}
|
||||
mapStyle={formData.mapbox_style}
|
||||
setControlValue={setControlValue}
|
||||
onViewportChange={this.onViewportChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -23,4 +23,3 @@
|
||||
.BootstrapSliderWrapper .slider-handle {
|
||||
background: #b3b3b3;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
|
@ -1,10 +1,9 @@
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
|
@ -1,11 +1,7 @@
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* 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
|
||||
@ -76,6 +72,7 @@ export function createDeckGLComponent(getLayer, getPoints) {
|
||||
this.setState({ viewport });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
computeLayer(props) {
|
||||
const { formData, payload, onAddFilter, setTooltip } = props;
|
||||
|
||||
@ -93,9 +90,9 @@ export function createDeckGLComponent(getLayer, getPoints) {
|
||||
layers={[layer]}
|
||||
mapStyle={formData.mapbox_style}
|
||||
setControlValue={setControlValue}
|
||||
onViewportChange={this.onViewportChange}
|
||||
width={width}
|
||||
height={height}
|
||||
onViewportChange={this.onViewportChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -108,16 +105,7 @@ export function createDeckGLComponent(getLayer, getPoints) {
|
||||
|
||||
export function createCategoricalDeckGLComponent(getLayer, getPoints) {
|
||||
function Component(props) {
|
||||
const {
|
||||
formData,
|
||||
payload,
|
||||
setControlValue,
|
||||
onAddFilter,
|
||||
setTooltip,
|
||||
viewport,
|
||||
width,
|
||||
height,
|
||||
} = props;
|
||||
const { formData, payload, setControlValue, setTooltip, viewport, width, height } = props;
|
||||
|
||||
return (
|
||||
<CategoricalDeckGLContainer
|
||||
@ -127,7 +115,6 @@ export function createCategoricalDeckGLComponent(getLayer, getPoints) {
|
||||
viewport={viewport}
|
||||
getLayer={getLayer}
|
||||
payload={payload}
|
||||
onAddFilter={onAddFilter}
|
||||
setTooltip={setTooltip}
|
||||
getPoints={getPoints}
|
||||
width={width}
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -1,7 +1,5 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/* eslint-disable react/forbid-prop-types */
|
||||
/* eslint-disable react/sort-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
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* 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
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* 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
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
/* 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
|
||||
|
@ -1,9 +1,6 @@
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* eslint-disable react/jsx-handler-names */
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
/* eslint-disable react/no-access-state-in-setstate */
|
||||
/* eslint-disable react/forbid-prop-types */
|
||||
/* 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
|
||||
@ -41,7 +38,7 @@ import sandboxedEval from '../../utils/sandbox';
|
||||
const DOUBLE_CLICK_TRESHOLD = 250; // milliseconds
|
||||
|
||||
function getPoints(features) {
|
||||
return features.map(d => d.polygon).flat();
|
||||
return features.flatMap(d => d.polygon);
|
||||
}
|
||||
|
||||
function getElevation(d, colorScaler) {
|
||||
@ -77,10 +74,9 @@ export function getLayer(formData, payload, onAddFilter, setTooltip, selected, o
|
||||
const sc = fd.stroke_color_picker;
|
||||
let data = [...payload.data.features];
|
||||
|
||||
// eslint-disable-next-line no-eq-null
|
||||
if (filters != null) {
|
||||
filters.forEach(f => {
|
||||
data = data.filter(f);
|
||||
data = data.filter(x => f(x));
|
||||
});
|
||||
}
|
||||
|
||||
@ -101,14 +97,14 @@ export function getLayer(formData, payload, onAddFilter, setTooltip, selected, o
|
||||
// when polygons are selected, reduce the opacity of non-selected polygons
|
||||
const colorScaler = d => {
|
||||
const baseColor = baseColorScaler(d);
|
||||
if (selected.length > 0 && selected.indexOf(d[fd.line_column]) === -1) {
|
||||
if (selected.length > 0 && !selected.includes(d[fd.line_column])) {
|
||||
baseColor[3] /= 2;
|
||||
}
|
||||
|
||||
return baseColor;
|
||||
};
|
||||
const tooltipContentGenerator =
|
||||
fd.line_column && fd.metric && ['geohash', 'zipcode'].indexOf(fd.line_type) >= 0
|
||||
fd.line_column && fd.metric && ['geohash', 'zipcode'].includes(fd.line_type)
|
||||
? setTooltipContent(fd)
|
||||
: undefined;
|
||||
|
||||
@ -265,12 +261,12 @@ class DeckGLPolygon extends React.Component {
|
||||
return (
|
||||
<div style={{ position: 'relative' }}>
|
||||
<AnimatableDeckGLContainer
|
||||
aggregation
|
||||
getLayers={this.getLayers}
|
||||
start={start}
|
||||
end={end}
|
||||
getStep={getStep}
|
||||
values={values}
|
||||
onValuesChange={this.onValuesChange}
|
||||
disabled={disabled}
|
||||
viewport={viewport}
|
||||
width={this.props.width}
|
||||
@ -278,7 +274,8 @@ class DeckGLPolygon extends React.Component {
|
||||
mapboxApiAccessToken={payload.data.mapboxApiKey}
|
||||
mapStyle={formData.mapbox_style}
|
||||
setControlValue={setControlValue}
|
||||
aggregation
|
||||
onValuesChange={this.onValuesChange}
|
||||
onViewportChange={this.onViewportChange}
|
||||
>
|
||||
{formData.metric !== null && (
|
||||
<Legend
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* 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
|
||||
|
@ -1,8 +1,5 @@
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* eslint-disable react/jsx-handler-names */
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/* 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
|
||||
@ -63,10 +60,9 @@ export function getLayer(formData, payload, onAddFilter, setTooltip, selected, o
|
||||
data = jsFnMutator(data);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-eq-null
|
||||
if (filters != null) {
|
||||
filters.forEach(f => {
|
||||
data = data.filter(f);
|
||||
data = data.filter(x => f(x));
|
||||
});
|
||||
}
|
||||
|
||||
@ -179,12 +175,12 @@ class DeckGLScreenGrid extends React.PureComponent {
|
||||
return (
|
||||
<div>
|
||||
<AnimatableDeckGLContainer
|
||||
aggregation
|
||||
getLayers={this.getLayers}
|
||||
start={this.state.start}
|
||||
end={this.state.end}
|
||||
getStep={this.state.getStep}
|
||||
values={this.state.values}
|
||||
onValuesChange={this.onValuesChange}
|
||||
disabled={this.state.disabled}
|
||||
viewport={this.state.viewport}
|
||||
width={this.props.width}
|
||||
@ -192,7 +188,8 @@ class DeckGLScreenGrid extends React.PureComponent {
|
||||
mapboxApiAccessToken={payload.data.mapboxApiKey}
|
||||
mapStyle={formData.mapbox_style}
|
||||
setControlValue={setControlValue}
|
||||
aggregation
|
||||
onValuesChange={this.onValuesChange}
|
||||
onViewportChange={this.onViewportChange}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -61,7 +60,10 @@ export function getBounds(points) {
|
||||
const latBounds = latExt[0] === latExt[1] ? getLatBoundsForSingleCoordinate(latExt) : latExt;
|
||||
const lngBounds = lngExt[0] === lngExt[1] ? getLngBoundsForSingleCoordinate(lngExt) : lngExt;
|
||||
|
||||
return [[lngBounds[0], latBounds[0]], [lngBounds[1], latBounds[1]]];
|
||||
return [
|
||||
[lngBounds[0], latBounds[0]],
|
||||
[lngBounds[1], latBounds[1]],
|
||||
];
|
||||
}
|
||||
|
||||
export function fitViewport(viewport, points, padding = 10) {
|
||||
@ -77,9 +79,9 @@ export function fitViewport(viewport, points, padding = 10) {
|
||||
width: viewport.width,
|
||||
}),
|
||||
};
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
/* eslint no-console: 0 */
|
||||
console.error('Could not auto zoom', e);
|
||||
console.error('Could not auto zoom', error);
|
||||
|
||||
return viewport;
|
||||
}
|
||||
@ -153,5 +155,5 @@ export function getAggFunc(type = 'sum', accessor = null) {
|
||||
return arr => d3func(arr);
|
||||
}
|
||||
|
||||
return arr => d3func(arr.map(accessor));
|
||||
return arr => d3func(arr.map(x => accessor(x)));
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/* eslint-disable no-negated-condition */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
@ -44,7 +43,7 @@ export function getBreakPoints(
|
||||
const precision = delta === 0 ? 0 : Math.max(0, Math.ceil(Math.log10(1 / delta)));
|
||||
const extraBucket = maxValue > maxValue.toFixed(precision) ? 1 : 0;
|
||||
|
||||
return Array(numBuckets + 1 + extraBucket)
|
||||
return new Array(numBuckets + 1 + extraBucket)
|
||||
.fill()
|
||||
.map((_, i) => (minValue + i * delta).toFixed(precision));
|
||||
}
|
||||
@ -111,7 +110,7 @@ export function getBreakPointColorScaler(
|
||||
if (maskPoint(v)) {
|
||||
c[3] = 0;
|
||||
} else {
|
||||
c[3] = (opacity / 100.0) * 255;
|
||||
c[3] = (opacity / 100) * 255;
|
||||
}
|
||||
|
||||
return c;
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -6,7 +6,7 @@ const MAX_URL_LENGTH = 8000;
|
||||
export function getURIDirectory(formData, endpointType = 'base') {
|
||||
// Building the directory part of the URI
|
||||
let directory = '/superset/explore/';
|
||||
if (['json', 'csv', 'query', 'results', 'samples'].indexOf(endpointType) >= 0) {
|
||||
if (['json', 'csv', 'query', 'results', 'samples'].includes(endpointType)) {
|
||||
directory = '/superset/explore_json/';
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-restricted-properties */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -33,15 +31,20 @@ const METER_TO_MILE = 1609.34;
|
||||
export function unitToRadius(unit, num) {
|
||||
if (unit === 'square_m') {
|
||||
return Math.sqrt(num / Math.PI);
|
||||
} else if (unit === 'radius_m') {
|
||||
}
|
||||
if (unit === 'radius_m') {
|
||||
return num;
|
||||
} else if (unit === 'radius_km') {
|
||||
}
|
||||
if (unit === 'radius_km') {
|
||||
return num * 1000;
|
||||
} else if (unit === 'radius_miles') {
|
||||
}
|
||||
if (unit === 'radius_miles') {
|
||||
return num * METER_TO_MILE;
|
||||
} else if (unit === 'square_km') {
|
||||
}
|
||||
if (unit === 'square_km') {
|
||||
return Math.sqrt(num / Math.PI) * 1000;
|
||||
} else if (unit === 'square_miles') {
|
||||
}
|
||||
if (unit === 'square_miles') {
|
||||
return Math.sqrt(num / Math.PI) * METER_TO_MILE;
|
||||
}
|
||||
|
||||
@ -55,7 +58,7 @@ export function kmToPixels(kilometers, latitude, zoomLevel) {
|
||||
// Algorithm from: https://wiki.openstreetmap.org/wiki/Zoom_levels
|
||||
const latitudeRad = latitude * (Math.PI / 180);
|
||||
// Seems like the zoomLevel is off by one
|
||||
const kmPerPixel = (EARTH_CIRCUMFERENCE_KM * Math.cos(latitudeRad)) / Math.pow(2, zoomLevel + 9);
|
||||
const kmPerPixel = (EARTH_CIRCUMFERENCE_KM * Math.cos(latitudeRad)) / 2 ** (zoomLevel + 9);
|
||||
|
||||
return roundDecimal(kilometers / kmPerPixel, 2);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ export function safeStringify(object) {
|
||||
try {
|
||||
// Quick deep copy to duplicate if this is a repeat rather than a circle.
|
||||
return JSON.parse(JSON.stringify(value));
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
// Discard key if value cannot be duplicated.
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -1,8 +1,4 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable babel/no-invalid-this */
|
||||
/* eslint-disable no-eq-null */
|
||||
/* eslint-disable no-negated-condition */
|
||||
/* eslint-disable func-names */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -52,7 +48,8 @@ export function truncate(timestamp, step) {
|
||||
const difference = part - explodedLowerBound[i];
|
||||
|
||||
return part - ((part - truncatePartTo[i]) % difference);
|
||||
} else if (i < firstDiffIndex || firstDiffIndex === -1) {
|
||||
}
|
||||
if (i < firstDiffIndex || firstDiffIndex === -1) {
|
||||
return part;
|
||||
}
|
||||
|
||||
@ -85,7 +82,7 @@ export function getPlaySliderParams(timestamps, timeGrain) {
|
||||
let step;
|
||||
let reference;
|
||||
|
||||
if (timeGrain.indexOf('/') !== -1) {
|
||||
if (timeGrain.includes('/')) {
|
||||
// Here, time grain is a time interval instead of a simple duration, either
|
||||
// `reference/duration` or `duration/reference`. We need to parse the
|
||||
// duration and make sure that start and end are in the right places. For
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-magic-numbers */
|
||||
/* eslint-disable no-restricted-properties */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -25,7 +23,7 @@ export function roundDecimal(number, precision) {
|
||||
let roundedNumber;
|
||||
if (precision) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
roundedNumber = Math.round(number * (precision = Math.pow(10, precision))) / precision;
|
||||
roundedNumber = Math.round(number * (precision = 10 ** precision)) / precision;
|
||||
} else {
|
||||
roundedNumber = Math.round(number);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
"mapbox-gl": "^0.53.0",
|
||||
"prop-types": "^15.6.0",
|
||||
"react-palm": "^3.1.2",
|
||||
"redux": "^4.0.5",
|
||||
"shortid": "^2.2.15",
|
||||
"styled-components": "^4.4.0",
|
||||
"viewport-mercator-project": "^6.1.1"
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
/* eslint-disable max-classes-per-file */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable prefer-destructuring */
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
/* eslint-disable react/jsx-handler-names */
|
||||
/* eslint-disable react/no-deprecated */
|
||||
/* eslint-disable no-negated-condition */
|
||||
/* eslint-disable react/prop-types */
|
||||
/* eslint-disable react/require-default-props */
|
||||
/* eslint-disable sort-keys */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -69,7 +69,7 @@ class Kepler extends React.PureComponent {
|
||||
const { keplerGl } = this.props;
|
||||
|
||||
return KeplerGlSchema.getConfigToSave(keplerGl[this.state.keplerId]);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -114,8 +114,8 @@ class Kepler extends React.PureComponent {
|
||||
<div>
|
||||
<KeplerGl
|
||||
id={this.state.keplerId}
|
||||
onSaveMap={this.setMapConfig}
|
||||
theme="light"
|
||||
onSaveMap={this.setMapConfig}
|
||||
{...this.props}
|
||||
/>
|
||||
</div>
|
||||
@ -128,12 +128,8 @@ Kepler.propTypes = propTypes;
|
||||
|
||||
const mapStateToProps = state => ({ keplerGl: state.keplerGl });
|
||||
const dispatchToProps = dispatch => ({ dispatch });
|
||||
const KeplerConnected = connect(
|
||||
mapStateToProps,
|
||||
dispatchToProps,
|
||||
)(Kepler);
|
||||
const KeplerConnected = connect(mapStateToProps, dispatchToProps)(Kepler);
|
||||
|
||||
// eslint-disable-next-line react/no-multi-comp
|
||||
export default class SubApp extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -1,9 +1,3 @@
|
||||
/* eslint-disable babel/new-cap */
|
||||
/* eslint-disable babel/no-invalid-this */
|
||||
/* eslint-disable compat/compat */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* 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
|
||||
@ -68,6 +62,7 @@ const rateLimitedUpdateConfigControl = RateLimit(updateConfigControl, 1000);
|
||||
export default function getKeplerStore(setControlValue) {
|
||||
// Using react-palm middleware to intercept changes and
|
||||
// save the state into the config control as text
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const stateChangeMiddleware = store => next => action => {
|
||||
const returnValue = next(action);
|
||||
rateLimitedUpdateConfigControl(store, setControlValue);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
Loading…
Reference in New Issue
Block a user