Skip to content

Commit

Permalink
refactor: Added consistent-type-imports eslint rule and ran --fix (#2230
Browse files Browse the repository at this point in the history
)

- Added `@typescript-eslint/consistent-type-imports` linting rule
- Added package script `lint:packages`
- Ran `npm run lint:packages -- --fix`

> Note: despite the crazy large number of files, most of these were
changed automatically by eslint --fix, so should be able to skim
provided all automated tests pass.

resolves #2229

BREAKING CHANGE: eslint rule will require type only imports where
possible
  • Loading branch information
bmingles authored Sep 20, 2024
1 parent 96e3d43 commit 2744f97
Show file tree
Hide file tree
Showing 564 changed files with 1,917 additions and 1,672 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"build:profile": "lerna run build --stream --profile",
"build:necessary": "lerna run build --scope=@deephaven/icons",
"analyze": "lerna run analyze",
"lint:packages": "eslint \"packages/*/src/**/*.{ts,tsx,js,jsx}\"",
"preview": "lerna run --scope=@deephaven/{code-studio,embed-widget} preview --stream",
"preview:app": "lerna run --scope=@deephaven/code-studio preview --stream",
"prestart": "npm run build:necessary",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-utils/src/components/AppBootstrap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import { act, render, screen } from '@testing-library/react';
import { AUTH_HANDLER_TYPE_ANONYMOUS } from '@deephaven/auth-plugins';
import { ApiContext } from '@deephaven/jsapi-bootstrap';
import { PluginModuleMap, PluginsContext } from '@deephaven/plugin';
import { type PluginModuleMap, PluginsContext } from '@deephaven/plugin';
import { BROADCAST_LOGIN_MESSAGE } from '@deephaven/jsapi-utils';
import type {
CoreClient,
Expand Down
9 changes: 5 additions & 4 deletions packages/app-utils/src/components/AppDashboards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import React, { useCallback } from 'react';
import classNames from 'classnames';
import {
DashboardUtils,
DehydratedDashboardPanelProps,
type DehydratedDashboardPanelProps,
LazyDashboard,
} from '@deephaven/dashboard';
import { useObjectFetcher } from '@deephaven/jsapi-bootstrap';
import LayoutManager, {
ItemConfig,
Settings as LayoutSettings,
import {
type ItemConfig,
type Settings as LayoutSettings,
} from '@deephaven/golden-layout';
import type LayoutManager from '@deephaven/golden-layout';
import { LoadingOverlay } from '@deephaven/components';

interface AppDashboardsProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-utils/src/components/AuthBootstrap.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext, useEffect, useMemo, useState } from 'react';
import {
AuthConfigMap,
type AuthConfigMap,
AuthPluginAnonymous,
AuthPluginParent,
AuthPluginPsk,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-utils/src/components/ConnectionBootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@deephaven/components';
import {
ObjectFetcherContext,
ObjectFetchManager,
type ObjectFetchManager,
ObjectFetchManagerContext,
sanitizeVariableDescriptor,
useApi,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-utils/src/plugins/PluginUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LegacyPlugin, Plugin, PluginType } from '@deephaven/plugin';
import { type LegacyPlugin, type Plugin, PluginType } from '@deephaven/plugin';
import { getPluginModuleValue } from './PluginUtils';

describe('getPluginModuleValue', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/app-utils/src/plugins/PluginUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import {
type AuthPlugin,
type AuthPluginComponent,
isAuthPlugin,
LegacyAuthPlugin,
LegacyPlugin,
Plugin,
type LegacyAuthPlugin,
type LegacyPlugin,
type Plugin,
PluginType,
isLegacyAuthPlugin,
isLegacyPlugin,
PluginModule,
type PluginModule,
isPlugin,
} from '@deephaven/plugin';
import loadRemoteModule from './loadRemoteModule';
Expand Down
4 changes: 2 additions & 2 deletions packages/app-utils/src/storage/LayoutStorage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ItemConfig } from '@deephaven/golden-layout';
import { FilterSet, Link } from '@deephaven/dashboard-core-plugins';
import { PluginDataMap } from '@deephaven/redux';
import { type FilterSet, type Link } from '@deephaven/dashboard-core-plugins';
import { type PluginDataMap } from '@deephaven/redux';

/**
* Have a different version to support legacy layout exports
Expand Down
14 changes: 7 additions & 7 deletions packages/app-utils/src/storage/LocalWorkspaceStorage.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Log from '@deephaven/log';
import {
WorkspaceStorage,
WorkspaceStorageLoadOptions,
CustomizableWorkspaceData,
CustomizableWorkspace,
WorkspaceSettings,
ServerConfigValues,
type WorkspaceStorage,
type WorkspaceStorageLoadOptions,
type CustomizableWorkspaceData,
type CustomizableWorkspace,
type WorkspaceSettings,
type ServerConfigValues,
} from '@deephaven/redux';
import {
DateTimeColumnFormatter,
DecimalColumnFormatter,
IntegerColumnFormatter,
} from '@deephaven/jsapi-utils';
import UserLayoutUtils from './UserLayoutUtils';
import LayoutStorage from './LayoutStorage';
import type LayoutStorage from './LayoutStorage';

const log = Log.module('LocalWorkspaceStorage');

Expand Down
11 changes: 6 additions & 5 deletions packages/app-utils/src/storage/UserLayoutUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { FilterSet, Link } from '@deephaven/dashboard-core-plugins';
import { type FilterSet, type Link } from '@deephaven/dashboard-core-plugins';
import type { ItemConfig } from '@deephaven/golden-layout';
import LayoutStorage, {
ExportedLayout,
ExportedLayoutV1,
ExportedLayoutV2,
import {
type ExportedLayout,
type ExportedLayoutV1,
type ExportedLayoutV2,
} from './LayoutStorage';
import type LayoutStorage from './LayoutStorage';
import UserLayoutUtils, {
DEFAULT_LAYOUT_CONFIG,
DEFAULT_LAYOUT_CONFIG_NO_CONSOLE,
Expand Down
9 changes: 5 additions & 4 deletions packages/app-utils/src/storage/UserLayoutUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {
LogPanel,
} from '@deephaven/dashboard-core-plugins';
import Log from '@deephaven/log';
import { CustomizableWorkspaceData } from '@deephaven/redux';
import LayoutStorage, {
ExportedLayout,
ExportedLayoutV2,
import { type CustomizableWorkspaceData } from '@deephaven/redux';
import {
type ExportedLayout,
type ExportedLayoutV2,
isLayoutV1,
isLayoutV2,
} from './LayoutStorage';
import type LayoutStorage from './LayoutStorage';

const log = Log.module('UserLayoutUtils');

Expand Down
8 changes: 4 additions & 4 deletions packages/app-utils/src/storage/grpc/GrpcFileStorage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import throttle from 'lodash.throttle';
import {
FileNotFoundError,
FileStorage,
File,
FileStorageItem,
FileStorageTable,
type FileStorage,
type File,
type FileStorageItem,
type FileStorageTable,
FileUtils,
isFileType,
} from '@deephaven/file-explorer';
Expand Down
18 changes: 9 additions & 9 deletions packages/app-utils/src/storage/grpc/GrpcFileStorageTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

import Log from '@deephaven/log';
import {
StorageTableViewport,
StorageListenerRemover,
ViewportUpdateCallback,
ViewportData,
IndexRange,
StorageSnapshot,
type StorageTableViewport,
type StorageListenerRemover,
type ViewportUpdateCallback,
type ViewportData,
type IndexRange,
type StorageSnapshot,
} from '@deephaven/storage';
import {
CancelablePromise,
type CancelablePromise,
CanceledPromiseError,
PromiseUtils,
} from '@deephaven/utils';
import {
FileStorageItem,
FileStorageTable,
type FileStorageItem,
type FileStorageTable,
FileUtils,
} from '@deephaven/file-explorer';
import type { dh } from '@deephaven/jsapi-types';
Expand Down
3 changes: 2 additions & 1 deletion packages/app-utils/src/storage/grpc/GrpcLayoutStorage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { dh } from '@deephaven/jsapi-types';
import LayoutStorage, { ExportedLayout } from '../LayoutStorage';
import { type ExportedLayout } from '../LayoutStorage';
import type LayoutStorage from '../LayoutStorage';

export class GrpcLayoutStorage implements LayoutStorage {
readonly storageService: dh.storage.StorageService;
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type React from 'react';

/**
* Map from auth config keys to their values
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPluginAnonymous.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dh } from '@deephaven/jsapi-shim';
import type { CoreClient } from '@deephaven/jsapi-types';
import AuthPluginAnonymous from './AuthPluginAnonymous';
import { AUTH_HANDLER_TYPE_ANONYMOUS as AUTH_TYPE } from './AuthHandlerTypes';
import { AuthConfigMap } from './AuthPlugin';
import { type AuthConfigMap } from './AuthPlugin';

const mockChildText = 'Mock Auth Anonymous Child';
const mockChild = <div>{mockChildText}</div>;
Expand Down
4 changes: 2 additions & 2 deletions packages/auth-plugins/src/AuthPluginAnonymous.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useCallback } from 'react';
import { useApi } from '@deephaven/jsapi-bootstrap';
import { AUTH_HANDLER_TYPE_ANONYMOUS } from './AuthHandlerTypes';
import { AuthPlugin, AuthPluginProps } from './AuthPlugin';
import { type AuthPlugin, type AuthPluginProps } from './AuthPlugin';
import AuthPluginBase from './AuthPluginBase';
import {
UserPermissionsOverride,
type UserPermissionsOverride,
UserPermissionsOverrideContext,
} from './UserContexts';

Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPluginParent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dh } from '@deephaven/jsapi-shim';
import type { CoreClient, LoginOptions } from '@deephaven/jsapi-types';
import { TestUtils } from '@deephaven/test-utils';
import AuthPluginParent from './AuthPluginParent';
import { AuthConfigMap } from './AuthPlugin';
import { type AuthConfigMap } from './AuthPlugin';

let mockParentResponse: Promise<LoginOptions>;
jest.mock('@deephaven/jsapi-utils', () => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/auth-plugins/src/AuthPluginParent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
requestParentResponse,
} from '@deephaven/jsapi-utils';
import Log from '@deephaven/log';
import { AuthPlugin, AuthPluginProps } from './AuthPlugin';
import { type AuthPlugin, type AuthPluginProps } from './AuthPlugin';
import AuthPluginBase from './AuthPluginBase';
import {
UserPermissionsOverride,
type UserPermissionsOverride,
UserPermissionsOverrideContext,
} from './UserContexts';

Expand Down
4 changes: 2 additions & 2 deletions packages/auth-plugins/src/AuthPluginPsk.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { type ReactNode } from 'react';
import Cookies from 'js-cookie';
import { act, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
Expand All @@ -8,7 +8,7 @@ import { dh } from '@deephaven/jsapi-shim';
import type { CoreClient } from '@deephaven/jsapi-types';
import AuthPluginPsk from './AuthPluginPsk';
import { AUTH_HANDLER_TYPE_PSK as AUTH_TYPE } from './AuthHandlerTypes';
import { AuthConfigMap } from './AuthPlugin';
import { type AuthConfigMap } from './AuthPlugin';

let mockOnBroadcastLogin = jest.fn();
let mockOnBroadcastLogout = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPluginPsk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useBroadcastLoginListener } from '@deephaven/jsapi-components';
import Log from '@deephaven/log';
import { getErrorMessage } from '@deephaven/utils';
import Cookies from 'js-cookie';
import { AuthPlugin, AuthPluginProps } from './AuthPlugin';
import { type AuthPlugin, type AuthPluginProps } from './AuthPlugin';
import LoginForm from './LoginForm';
import Login from './Login';
import AuthenticationError from './AuthenticationError';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LoadingSpinner } from '@deephaven/components';
import classNames from 'classnames';
import React, { FormEventHandler } from 'react';
import React, { type FormEventHandler } from 'react';
import './LoginForm.scss';

export interface LoginFormProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/UserContexts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext } from 'react';
import { User, UserPermissions } from '@deephaven/redux';
import { type User, type UserPermissions } from '@deephaven/redux';

export type UserOverride = Partial<Omit<User, 'permissions'>>;

Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/UserUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User, UserPermissions } from '@deephaven/redux';
import { type User, type UserPermissions } from '@deephaven/redux';
import Log from '@deephaven/log';

const log = Log.module('UserUtils');
Expand Down
32 changes: 16 additions & 16 deletions packages/chart/src/Chart.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import React, { Component, ReactElement, RefObject } from 'react';
import React, { Component, type ReactElement, type RefObject } from 'react';
import deepEqual from 'fast-deep-equal';
import memoize from 'memoize-one';
import {
vsLoading,
dhGraphLineDown,
dhWarningFilled,
IconDefinition,
type IconDefinition,
} from '@deephaven/icons';
import {
Formatter,
FormatterUtils,
DateUtils,
DateTimeColumnFormatterOptions,
DecimalColumnFormatterOptions,
IntegerColumnFormatterOptions,
FormattingRule,
ColumnFormatSettings,
DateTimeFormatSettings,
type DateTimeColumnFormatterOptions,
type DecimalColumnFormatterOptions,
type IntegerColumnFormatterOptions,
type FormattingRule,
type ColumnFormatSettings,
type DateTimeFormatSettings,
} from '@deephaven/jsapi-utils';
import Log from '@deephaven/log';
import {
Config as PlotlyConfig,
Layout,
Icon,
Data,
PlotData,
ModeBarButtonAny,
type Config as PlotlyConfig,
type Layout,
type Icon,
type Data,
type PlotData,
type ModeBarButtonAny,
} from 'plotly.js';
import type { PlotParams } from 'react-plotly.js';
import { mergeRefs } from '@deephaven/react-hooks';
Expand All @@ -34,8 +34,8 @@ import createPlotlyComponent from './plotly/createPlotlyComponent';
import Plotly from './plotly/Plotly';
import ChartModel from './ChartModel';
import ChartErrorOverlay from './ChartErrorOverlay';
import { ChartTheme } from './ChartTheme';
import ChartUtils, { ChartModelSettings } from './ChartUtils';
import { type ChartTheme } from './ChartTheme';
import ChartUtils, { type ChartModelSettings } from './ChartUtils';
import './Chart.scss';
import DownsamplingError from './DownsamplingError';
import useChartTheme from './useChartTheme';
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/ChartErrorOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement } from 'react';
import { type ReactElement } from 'react';
import { CopyButton, Button } from '@deephaven/components';
import './ChartErrorOverlay.scss';

Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/ChartModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/* eslint no-unused-vars: "off" */

import type { dh as DhType } from '@deephaven/jsapi-types';
import { Formatter } from '@deephaven/jsapi-utils';
import { type Formatter } from '@deephaven/jsapi-utils';
import type { Layout, Data } from 'plotly.js';
import { FilterColumnMap, FilterMap } from './ChartUtils';
import { type FilterColumnMap, type FilterMap } from './ChartUtils';

export type ChartEvent = CustomEvent;

Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/ChartModelFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { dh as DhType } from '@deephaven/jsapi-types';
import ChartUtils, { ChartModelSettings } from './ChartUtils';
import ChartUtils, { type ChartModelSettings } from './ChartUtils';
import FigureChartModel from './FigureChartModel';
import ChartModel from './ChartModel';
import type ChartModel from './ChartModel';

class ChartModelFactory {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/ChartThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, ReactNode, useMemo } from 'react';
import { createContext, type ReactNode, useMemo } from 'react';
import { useTheme } from '@deephaven/components';
import defaultChartTheme, { ChartTheme } from './ChartTheme';
import defaultChartTheme, { type ChartTheme } from './ChartTheme';

export type ChartThemeContextValue = ChartTheme;

Expand Down
Loading

0 comments on commit 2744f97

Please sign in to comment.