Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Shan He <heshan0131@gmail.com>
  • Loading branch information
heshan0131 committed Dec 30, 2021
1 parent d413885 commit eddfb05
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 125 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"analyze:bundle": "webpack --config ./webpack/bundle.js --progress --env.prod",
"check-licence": "uber-licence --dry",
"add-licence": "uber-licence",
"prepublish": "ber-licence && yarn build && yarn build:umd && yarn build:types",
"prepublish": "uber-licence && yarn build && yarn build:umd && yarn build:types",
"docs": "babel-node ./scripts/documentation.js",
"typedoc": "typedoc --theme markdown --out typedoc --inputFiles ./src/reducers --inputFiles ./src/actions --excludeExternals --excludeNotExported --excludePrivate",
"example-version": "babel-node ./scripts/edit-version.js",
Expand Down Expand Up @@ -286,6 +286,7 @@
"Giuseppe Macri <gmacri@uber.com>"
],
"volta": {
"node": "12.19.0"
"node": "12.19.0",
"yarn": "1.22.17"
}
}
2 changes: 1 addition & 1 deletion src/components/common/icons/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const Checkmark: React.ElementType;
export const Clipboard: React.ElementType;
export const Clock: React.ElementType;
export const Close: React.ElementType;
export const Copy: React.ElementType;
export const Crosshairs: React.ElementType;
export const Cube3d: React.ElementType;
export const CursorClick: React.ElementType;
Expand Down Expand Up @@ -73,4 +74,3 @@ export const Warning: React.ElementType;
export const DrawPolygon: React.ElementType;
export const Polygon: React.ElementType;
export const Rectangle: React.ElementType;
export const Globe: React.ElementType;
1 change: 1 addition & 0 deletions src/components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export * from './common/tippy-tooltip'
export * as Icons from './common/icons';
export * from './common/file-uploader/file-drop';
export * from './common/file-uploader/upload-button';
export {default as Portaled} from './common/portaled';

export const PanelHeaderAction: (...props: any[]) => JSX.Element;
export const TippyTooltip: (...props: any[]) => JSX.Element;
Expand Down
3 changes: 2 additions & 1 deletion src/components/modal-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export default function ModalContainerFactory(

_onExportImage = () => {
if (!this.props.uiState.exportImage.processing) {
exportImage(this.props, `${this.props.appName}.png`);
// @ts-ignore TODO: fix exportImage method
exportImage(this.props.uiState.exportImage, `${this.props.appName}.png`);
this.props.uiStateActions.cleanupExportImage();
this._closeModal();
}
Expand Down
101 changes: 0 additions & 101 deletions src/components/side-panel/globe-mananger.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/localization/locales.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export declare const LOCALES: {
pt: string;
es: string;
ca: string;
ja: string;
cn: string;
ru: string;
};

export declare const LOCALE_CODES: {[key: string]: string};
7 changes: 4 additions & 3 deletions src/processors/data-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ export function processRowObject(rawData) {
return null;
} else if (!rawData.length) {
// data is empty
return {
fields: [], rows: []
}
return {
fields: [],
rows: []
};
}

const keys = Object.keys(rawData[0]);
Expand Down
4 changes: 2 additions & 2 deletions src/reducers/vis-state-updaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import {pick_, merge_, swap_} from './composer-helpers';
import {processFileContent} from 'actions/vis-state-actions';

import KeplerGLSchema from 'schemas';
import {isRGBColor} from 'utils/color-utils';
import {isRgbColor} from 'utils/color-utils';

// type imports
/** @typedef {import('./vis-state-updaters').Field} Field */
Expand Down Expand Up @@ -1141,7 +1141,7 @@ export const updateTableColorUpdater = (state, action) => {
const {dataId, newColor} = action;
const {datasets} = state;

if (isRGBColor(newColor)) {
if (isRgbColor(newColor)) {
const existing = datasets[dataId];
existing.updateTableColor(newColor);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/color-utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const createLinearGradient: (string: direction, colors: number[]) => stri
export const reverseColorRange: (reversed: boolean, colorRange: ColorRange) => object;
export const rgbToHex: (colors: [number, number, number]) => string;


export const getColorGroupByName: (ColorRange) => ColorRange;
export function isRgbColor(color: unknown): color is RGBColor;
8 changes: 4 additions & 4 deletions src/utils/color-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ export function createLinearGradient(direction, colors) {
}

/**
* Checking if color is RGB
* @param {*} color
* @returns boolean
* Whether color is rgb
* @type {typeof import('./color-utils').isRgbColor}
* @returns
*/
export function isRGBColor(color) {
export function isRgbColor(color) {
if (
color &&
Array.isArray(color) &&
Expand Down
16 changes: 9 additions & 7 deletions src/utils/export-utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import {ExportImage} from 'reducers/ui-state-updaters';

export const downloadFile: (fileBlob: Blob, fileName: string) => void;
export const exportJson: (state: any, options: object) => void;
export const exportHtml: (state: any, options: object) => void;
export const exportData: (state: any, options: object) => void;
export const exportMap: (state: any, options?: object) => void;
export const exportImage: (props: {
mapW: number;
mapH: number;
ratio: string;
resolution: string;
}) => void;
export const exportImage: (uiStateExportImage: ExportImage, fileName?: string) => void;
export const convertToPng: (sourceElem: HTMLElement, options: object) => Promise;
export const getScaleFromImageSize: (imageW: number, imageH: number, mapW: number, mapH: number) => number;
export const getScaleFromImageSize: (
imageW: number,
imageH: number,
mapW: number,
mapH: number
) => number;
export const dataURItoBlob: (dataURI: string) => Blob;
9 changes: 7 additions & 2 deletions src/utils/export-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ export function downloadFile(fileBlob, fileName) {
}
}

export function exportImage(state, filename = DEFAULT_IMAGE_NAME) {
const {imageDataUri} = state.uiState.exportImage;
/**
* Whether color is rgb
* @type {typeof import('./export-utils').exportImage}
* @returns
*/
export function exportImage(uiStateExportImage, filename = DEFAULT_IMAGE_NAME) {
const {imageDataUri} = uiStateExportImage;
if (imageDataUri) {
const file = dataURItoBlob(imageDataUri);
downloadFile(file, filename);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/table-utils/kepler-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export function sortDatasetByColumn(dataset, column, mode) {
return dataset;
}

const sortBy = SORT_ORDER[mode] || SORT_ORDER.ASCENDING;
const sortBy = SORT_ORDER[mode || ''] || SORT_ORDER.ASCENDING;

if (sortBy === SORT_ORDER.UNSORT) {
dataset.sortColumn = {};
Expand Down

0 comments on commit eddfb05

Please sign in to comment.