From ef68ee5727510deee1f29e4d87ebf77c31903390 Mon Sep 17 00:00:00 2001 From: Peter Hicks Date: Thu, 15 Dec 2022 09:24:36 -0800 Subject: [PATCH] Web/update lint (#2322) * Updates for eslint-fix run. * Adding lint to ci check Co-authored-by: phix Co-authored-by: Willy Lulciuc --- .circleci/config.yml | 1 + .../components/core/date-picker/MqDatePicker.tsx | 10 +++++----- web/src/components/jobs/Runs.tsx | 1 - web/src/components/search/SearchPlaceholder.tsx | 4 +--- web/src/helpers/index.ts | 8 ++++---- web/src/helpers/time.ts | 6 +++--- web/src/store/actionCreators/index.ts | 13 +++++++++++-- web/src/store/reducers/events.ts | 6 +----- web/src/store/reducers/index.ts | 2 +- web/src/store/requests/events.ts | 4 ++-- web/src/store/sagas/index.ts | 13 ++++++++++--- web/src/types/api.ts | 8 ++++---- web/src/types/index.ts | 2 +- 13 files changed, 44 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8fcb3e11d8..8b5bf0727f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,6 +83,7 @@ jobs: - v1-web-{{ .Branch }} - run: npm install - run: npm run test + - run: npm run eslint-fix - run: npm run build - save_cache: paths: diff --git a/web/src/components/core/date-picker/MqDatePicker.tsx b/web/src/components/core/date-picker/MqDatePicker.tsx index c314026721..14f9eb3737 100644 --- a/web/src/components/core/date-picker/MqDatePicker.tsx +++ b/web/src/components/core/date-picker/MqDatePicker.tsx @@ -1,11 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 -import React from 'react' +import { DateTimePicker } from '@material-ui/pickers' import { Theme } from '@material-ui/core' +import { alpha } from '@material-ui/core/styles' +import React from 'react' import createStyles from '@material-ui/core/styles/createStyles' import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles' -import { DateTimePicker } from '@material-ui/pickers' -import { alpha } from '@material-ui/core/styles' const styles = (theme: Theme) => createStyles({ @@ -57,7 +57,7 @@ type DatePickerProps = WithStyles & OwnProps class MqDatePicker extends React.Component { render() { - const { classes, value, onChange, label = '', format = "MMM DD yyyy hh:mm a" } = this.props + const { classes, value, onChange, label = '', format = 'MMM DD yyyy hh:mm a' } = this.props return ( { } } -export default withStyles(styles)(MqDatePicker) \ No newline at end of file +export default withStyles(styles)(MqDatePicker) diff --git a/web/src/components/jobs/Runs.tsx b/web/src/components/jobs/Runs.tsx index d36ca210c2..3fd6ff22f7 100644 --- a/web/src/components/jobs/Runs.tsx +++ b/web/src/components/jobs/Runs.tsx @@ -27,7 +27,6 @@ import RunInfo from './RunInfo' import RunStatus from './RunStatus' import transitions from '@material-ui/core/styles/transitions' - const styles = (theme: Theme) => { return createStyles({ status: { diff --git a/web/src/components/search/SearchPlaceholder.tsx b/web/src/components/search/SearchPlaceholder.tsx index c8f0602f78..c0649ff7b0 100644 --- a/web/src/components/search/SearchPlaceholder.tsx +++ b/web/src/components/search/SearchPlaceholder.tsx @@ -21,9 +21,7 @@ const styles = (theme: Theme) => const importI18next = () => { const i18next = require('i18next') - return ( - i18next - ) + return i18next } const SearchPlaceholder: React.FC> = ({ classes }) => { diff --git a/web/src/helpers/index.ts b/web/src/helpers/index.ts index f311cf8435..307a166f2b 100644 --- a/web/src/helpers/index.ts +++ b/web/src/helpers/index.ts @@ -22,9 +22,9 @@ export const formatUpdatedAt = (updatedAt: string) => { } export const fileSize = (data: string) => { - const size = encodeURI(data).split(/%..|./).length - 1; + const size = encodeURI(data).split(/%..|./).length - 1 return { - kiloBytes: size / 1024, - megaBytes: (size / 1024) / 1024 + kiloBytes: size / 1024, + megaBytes: size / 1024 / 1024 } -} \ No newline at end of file +} diff --git a/web/src/helpers/time.ts b/web/src/helpers/time.ts index 637542695a..fceeac4bf0 100644 --- a/web/src/helpers/time.ts +++ b/web/src/helpers/time.ts @@ -28,9 +28,9 @@ export function stopWatchDuration(durationMs: number) { } export function formatDatePicker(val: string) { - return moment(val).format("YYYY-MM-DDTHH:mm:ss") + return moment(val).format('YYYY-MM-DDTHH:mm:ss') } export function formatDateAPIQuery(val: string) { - return moment(val).format("YYYY-MM-DDTHH:mm:ss[.000Z]") -} \ No newline at end of file + return moment(val).format('YYYY-MM-DDTHH:mm:ss[.000Z]') +} diff --git a/web/src/store/actionCreators/index.ts b/web/src/store/actionCreators/index.ts index f888f19c42..c993054de5 100644 --- a/web/src/store/actionCreators/index.ts +++ b/web/src/store/actionCreators/index.ts @@ -2,7 +2,16 @@ import * as actionTypes from './actionTypes' -import { Event, Dataset, DatasetVersion, Job, LineageGraph, Namespace, Run, Search } from '../../types/api' +import { + Dataset, + DatasetVersion, + Event, + Job, + LineageGraph, + Namespace, + Run, + Search +} from '../../types/api' import { JobOrDataset } from '../../components/lineage/types' export const fetchEvents = (after: string, before: string, limit: number) => ({ @@ -14,7 +23,7 @@ export const fetchEvents = (after: string, before: string, limit: number) => ({ } }) -export const fetchEventsSuccess = (events: Event[]) => ({ +export const fetchEventsSuccess = (events: Event[]) => ({ type: actionTypes.FETCH_EVENTS_SUCCESS, payload: { events diff --git a/web/src/store/reducers/events.ts b/web/src/store/reducers/events.ts index 13425856e2..7fd47c998c 100644 --- a/web/src/store/reducers/events.ts +++ b/web/src/store/reducers/events.ts @@ -1,11 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 import { Event } from '../../types/api' -import { - FETCH_EVENTS, - FETCH_EVENTS_SUCCESS, - RESET_EVENTS -} from '../actionCreators/actionTypes' +import { FETCH_EVENTS, FETCH_EVENTS_SUCCESS, RESET_EVENTS } from '../actionCreators/actionTypes' import { fetchEventsSuccess } from '../actionCreators' export type IEventsState = { isLoading: boolean; result: Event[]; init: boolean } diff --git a/web/src/store/reducers/index.ts b/web/src/store/reducers/index.ts index 32220728c8..b8be4e015b 100644 --- a/web/src/store/reducers/index.ts +++ b/web/src/store/reducers/index.ts @@ -5,8 +5,8 @@ import { Reducer, combineReducers } from 'redux' import { connectRouter } from 'connected-react-router' import datasetVersions, { IDatasetVersionsState } from './datasetVersions' import datasets, { IDatasetsState } from './datasets' -import events, { IEventsState } from './events' import display, { IDisplayState } from './display' +import events, { IEventsState } from './events' import jobs, { IJobsState } from './jobs' import lineage, { ILineageState } from './lineage' import namespaces, { INamespacesState } from './namespaces' diff --git a/web/src/store/requests/events.ts b/web/src/store/requests/events.ts index 4315aef6d7..dcaca7a9b4 100644 --- a/web/src/store/requests/events.ts +++ b/web/src/store/requests/events.ts @@ -7,6 +7,6 @@ import { genericFetchWrapper } from './index' export const getEvents = async (after = '', before = '', limit = 100, sortDirection = 'desc') => { const url = `${API_URL}/events/lineage?limit=${limit}&before=${before}&after=${after}&sortDirection=${sortDirection}` return genericFetchWrapper(url, { method: 'GET' }, 'fetchEvents').then((r: Events) => { - return r.events.map((d) => ({ ...d })) + return r.events.map(d => ({ ...d })) }) -} \ No newline at end of file +} diff --git a/web/src/store/sagas/index.ts b/web/src/store/sagas/index.ts index 0ed2578c4a..20bc3ced57 100644 --- a/web/src/store/sagas/index.ts +++ b/web/src/store/sagas/index.ts @@ -4,11 +4,11 @@ import * as Effects from 'redux-saga/effects' import { FETCH_DATASETS, FETCH_DATASET_VERSIONS, + FETCH_EVENTS, FETCH_JOBS, FETCH_LINEAGE, FETCH_RUNS, - FETCH_SEARCH, - FETCH_EVENTS + FETCH_SEARCH } from '../actionCreators/actionTypes' import { Namespaces } from '../../types/api' import { all, put, take } from 'redux-saga/effects' @@ -26,7 +26,14 @@ import { fetchRunsSuccess, fetchSearchSuccess } from '../actionCreators' -import { getDatasetVersions, getDatasets, getEvents, getJobs, getNamespaces, getRuns } from '../requests' +import { + getDatasetVersions, + getDatasets, + getEvents, + getJobs, + getNamespaces, + getRuns +} from '../requests' import { getLineage } from '../requests/lineage' import { getSearch } from '../requests/search' diff --git a/web/src/types/api.ts b/web/src/types/api.ts index 1c95b14e2f..7ef3267414 100644 --- a/web/src/types/api.ts +++ b/web/src/types/api.ts @@ -42,13 +42,13 @@ export interface Event { facets: object } inputs: { - name: string, - namespace: string, + name: string + namespace: string facets: object }[] outputs: { - name: string, - namespace: string, + name: string + namespace: string facets: object }[] } diff --git a/web/src/types/index.ts b/web/src/types/index.ts index 31ddea72b6..2e42864914 100644 --- a/web/src/types/index.ts +++ b/web/src/types/index.ts @@ -10,4 +10,4 @@ export interface IJob extends Job { latestRuns?: Run[] } -export type IFilterByDisplay = 'namespace' | 'sourceName' \ No newline at end of file +export type IFilterByDisplay = 'namespace' | 'sourceName'