diff --git a/packages/app-utils/src/components/AppBootstrap.test.tsx b/packages/app-utils/src/components/AppBootstrap.test.tsx index 184cad03da..9e8c917b0b 100644 --- a/packages/app-utils/src/components/AppBootstrap.test.tsx +++ b/packages/app-utils/src/components/AppBootstrap.test.tsx @@ -40,9 +40,9 @@ function expectMockChild() { function renderComponent(client: CoreClient) { const api = TestUtils.createMockProxy({ - CoreClient: (jest + CoreClient: jest .fn() - .mockImplementation(() => client) as unknown) as CoreClient, + .mockImplementation(() => client) as unknown as CoreClient, }); return render( diff --git a/packages/app-utils/src/plugins/PluginUtils.tsx b/packages/app-utils/src/plugins/PluginUtils.tsx index 56869d4061..5a38cd46f9 100644 --- a/packages/app-utils/src/plugins/PluginUtils.tsx +++ b/packages/app-utils/src/plugins/PluginUtils.tsx @@ -152,14 +152,15 @@ export function getAuthPluginComponent( const authHandlers = getAuthHandlers(authConfigValues); // Filter out all the plugins that are auth plugins, and then map them to [pluginName, AuthPlugin] pairs // Uses some pretty disgusting casting, because TypeScript wants to treat it as an (string | AuthPlugin)[] array instead - const authPlugins = ([ - ...pluginMap.entries(), - ].filter(([, plugin]: [string, { AuthPlugin?: AuthPlugin }]) => - isAuthPlugin(plugin.AuthPlugin) - ) as [string, { AuthPlugin: AuthPlugin }][]).map(([name, plugin]) => [ - name, - plugin.AuthPlugin, - ]) as [string, AuthPlugin][]; + const authPlugins = ( + [...pluginMap.entries()].filter( + ([, plugin]: [string, { AuthPlugin?: AuthPlugin }]) => + isAuthPlugin(plugin.AuthPlugin) + ) as [string, { AuthPlugin: AuthPlugin }][] + ).map(([name, plugin]) => [name, plugin.AuthPlugin]) as [ + string, + AuthPlugin, + ][]; // Add all the core plugins in priority authPlugins.push(...(corePlugins ?? [])); diff --git a/packages/auth-plugins/src/AuthPluginParent.test.tsx b/packages/auth-plugins/src/AuthPluginParent.test.tsx index 4e32e92fa7..f4c18b5068 100644 --- a/packages/auth-plugins/src/AuthPluginParent.test.tsx +++ b/packages/auth-plugins/src/AuthPluginParent.test.tsx @@ -71,9 +71,11 @@ describe('availability tests', () => { }); it('is available when window parent is set', () => { - const parentSpy = jest.spyOn(window, 'parent', 'get').mockReturnValue( - TestUtils.createMockProxy({ postMessage: jest.fn() }) - ); + const parentSpy = jest + .spyOn(window, 'parent', 'get') + .mockReturnValue( + TestUtils.createMockProxy({ postMessage: jest.fn() }) + ); window.history.pushState( {}, 'Test Title', diff --git a/packages/auth-plugins/src/UserContexts.ts b/packages/auth-plugins/src/UserContexts.ts index 23bffa8370..9276c5ca72 100644 --- a/packages/auth-plugins/src/UserContexts.ts +++ b/packages/auth-plugins/src/UserContexts.ts @@ -7,8 +7,7 @@ export type UserPermissionsOverride = Partial; export const UserOverrideContext = createContext({}); -export const UserPermissionsOverrideContext = createContext( - {} -); +export const UserPermissionsOverrideContext = + createContext({}); export const UserContext = createContext(null); diff --git a/packages/chart/src/Chart.tsx b/packages/chart/src/Chart.tsx index 9b354b8dfc..c05a48ccaf 100644 --- a/packages/chart/src/Chart.tsx +++ b/packages/chart/src/Chart.tsx @@ -466,7 +466,7 @@ export class Chart extends Component { handleRestyle([changes, seriesIndexes]: readonly [ Record, - number[] + number[], ]): void { log.debug('handleRestyle', changes, seriesIndexes); if (Object.keys(changes).includes('visible')) { @@ -522,9 +522,8 @@ export class Chart extends Component { updateFormatterSettings(settings: FormatterSettings): void { const columnFormats = FormatterUtils.getColumnFormats(settings); - const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions( - settings - ); + const dateTimeFormatterOptions = + FormatterUtils.getDateTimeFormatterOptions(settings); const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings; if ( @@ -565,7 +564,7 @@ export class Chart extends Component { // Call relayout to resize avoiding the debouncing plotly does // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552 PlotlyProp.relayout( - ((this.plot.current as unknown) as { el: HTMLElement }).el, + (this.plot.current as unknown as { el: HTMLElement }).el, { autosize: true, } diff --git a/packages/chart/src/ChartUtils.test.ts b/packages/chart/src/ChartUtils.test.ts index a6a1cd7b37..20071cd7a5 100644 --- a/packages/chart/src/ChartUtils.test.ts +++ b/packages/chart/src/ChartUtils.test.ts @@ -331,12 +331,12 @@ describe('handles subplots and columns/rows correctly', () => { chartTestUtils.makeChart({ axes, row: 1 }), ]; const figure = chartTestUtils.makeFigure({ charts, rows: 2 }); - expect( - chartUtils.getChartBounds(figure, charts[0], width, height) - ).toEqual({ bottom: 0.5 + halfYMargin, top: 1, left: 0, right: 1 }); - expect( - chartUtils.getChartBounds(figure, charts[1], width, height) - ).toEqual({ bottom: 0, top: 0.5 - halfYMargin, left: 0, right: 1 }); + expect(chartUtils.getChartBounds(figure, charts[0], width, height)).toEqual( + { bottom: 0.5 + halfYMargin, top: 1, left: 0, right: 1 } + ); + expect(chartUtils.getChartBounds(figure, charts[1], width, height)).toEqual( + { bottom: 0, top: 0.5 - halfYMargin, left: 0, right: 1 } + ); }); it('handles column location correctly', () => { @@ -346,12 +346,12 @@ describe('handles subplots and columns/rows correctly', () => { chartTestUtils.makeChart({ axes, column: 1 }), ]; const figure = chartTestUtils.makeFigure({ charts, cols: 2 }); - expect( - chartUtils.getChartBounds(figure, charts[0], width, height) - ).toEqual({ bottom: 0, top: 1, left: 0, right: 0.5 - halfXMargin }); - expect( - chartUtils.getChartBounds(figure, charts[1], width, height) - ).toEqual({ bottom: 0, top: 1, left: 0.5 + halfXMargin, right: 1 }); + expect(chartUtils.getChartBounds(figure, charts[0], width, height)).toEqual( + { bottom: 0, top: 1, left: 0, right: 0.5 - halfXMargin } + ); + expect(chartUtils.getChartBounds(figure, charts[1], width, height)).toEqual( + { bottom: 0, top: 1, left: 0.5 + halfXMargin, right: 1 } + ); }); it('handles colspan', () => { @@ -378,9 +378,9 @@ describe('handles subplots and columns/rows correctly', () => { right: 1, } ); - expect( - chartUtils.getChartBounds(figure, charts[2], width, height) - ).toEqual({ bottom: 0, top: 0.5 - halfYMargin, left: 0, right: 1 }); + expect(chartUtils.getChartBounds(figure, charts[2], width, height)).toEqual( + { bottom: 0, top: 0.5 - halfYMargin, left: 0, right: 1 } + ); }); it('handles rowspan', () => { @@ -407,9 +407,9 @@ describe('handles subplots and columns/rows correctly', () => { right: 0.5 - halfXMargin, } ); - expect( - chartUtils.getChartBounds(figure, charts[2], width, height) - ).toEqual({ bottom: 0, top: 1, left: 0.5 + halfXMargin, right: 1 }); + expect(chartUtils.getChartBounds(figure, charts[2], width, height)).toEqual( + { bottom: 0, top: 1, left: 0.5 + halfXMargin, right: 1 } + ); }); }); diff --git a/packages/chart/src/ChartUtils.ts b/packages/chart/src/ChartUtils.ts index 71a8185d4e..a101a3d670 100644 --- a/packages/chart/src/ChartUtils.ts +++ b/packages/chart/src/ChartUtils.ts @@ -597,9 +597,8 @@ class ChartUtils { holidays, timeZone: calendarTimeZone, } = businessCalendar; - const typeFormatter = formatter?.getColumnTypeFormatter( - BUSINESS_COLUMN_TYPE - ); + const typeFormatter = + formatter?.getColumnTypeFormatter(BUSINESS_COLUMN_TYPE); let formatterTimeZone; if (isDateTimeColumnFormatter(typeFormatter)) { formatterTimeZone = typeFormatter.dhTimeZone; @@ -638,7 +637,8 @@ class ChartUtils { ); } - (axisFormat as RangebreakAxisFormat).rangebreaks = rangebreaks; + (axisFormat as RangebreakAxisFormat).rangebreaks = + rangebreaks; } if (axisFormats.size === chart.axes.length) { diff --git a/packages/code-studio/src/main/AppInit.tsx b/packages/code-studio/src/main/AppInit.tsx index 7bd4507261..db5585b7ef 100644 --- a/packages/code-studio/src/main/AppInit.tsx +++ b/packages/code-studio/src/main/AppInit.tsx @@ -65,7 +65,7 @@ interface AppInitProps { workspace: Workspace; workspaceStorage: WorkspaceStorage; - setActiveTool: (type: typeof ToolType[keyof typeof ToolType]) => void; + setActiveTool: (type: (typeof ToolType)[keyof typeof ToolType]) => void; setApi: (api: DhType) => void; setCommandHistoryStorage: (storage: PouchCommandHistoryStorage) => void; setDashboardData: ( diff --git a/packages/code-studio/src/main/AppMainContainer.scss b/packages/code-studio/src/main/AppMainContainer.scss index 976271e1ff..00182442e7 100644 --- a/packages/code-studio/src/main/AppMainContainer.scss +++ b/packages/code-studio/src/main/AppMainContainer.scss @@ -249,11 +249,15 @@ $nav-space: 4px; // give a gap around some buttons for focus area that are in na } .grid-cursor-linker { - cursor: url('../assets/svg/cursor-linker.svg') 8 8, crosshair; + cursor: + url('../assets/svg/cursor-linker.svg') 8 8, + crosshair; } .grid-cursor-linker-not-allowed { - cursor: url('../assets/svg/cursor-linker-not-allowed.svg') 8 8, not-allowed; + cursor: + url('../assets/svg/cursor-linker-not-allowed.svg') 8 8, + not-allowed; } .linker-overlay path.link-select { @@ -261,7 +265,9 @@ $nav-space: 4px; // give a gap around some buttons for focus area that are in na } .linker-overlay.danger-delete path.link-select { - cursor: url('../assets/svg/cursor-unlinker.svg') 8 8, pointer; + cursor: + url('../assets/svg/cursor-unlinker.svg') 8 8, + pointer; } .app-main-top-nav-menus { diff --git a/packages/code-studio/src/main/AppMainContainer.test.tsx b/packages/code-studio/src/main/AppMainContainer.test.tsx index c74971fa55..fb4fc06d97 100644 --- a/packages/code-studio/src/main/AppMainContainer.test.tsx +++ b/packages/code-studio/src/main/AppMainContainer.test.tsx @@ -87,7 +87,7 @@ function renderAppMainContainer({ serverConfigValues={serverConfigValues} dashboardOpenedPanelMaps={dashboardOpenedPanelMaps} connection={connection} - session={(session as unknown) as IdeSession} + session={session as unknown as IdeSession} sessionConfig={sessionConfig} match={match} plugins={plugins} @@ -133,7 +133,7 @@ it('listens for widgets properly', async () => { const user = userEvent.setup(); const TABLE_A = { name: 'a', type: 'Table' }; const TABLE_B = { name: 'b', type: 'Table' }; - let callback: (obj: VariableChanges) => void = (null as unknown) as ( + let callback: (obj: VariableChanges) => void = null as unknown as ( obj: VariableChanges ) => void; diff --git a/packages/code-studio/src/main/AppMainContainer.tsx b/packages/code-studio/src/main/AppMainContainer.tsx index 12d7f6c0e2..fbb83188da 100644 --- a/packages/code-studio/src/main/AppMainContainer.tsx +++ b/packages/code-studio/src/main/AppMainContainer.tsx @@ -571,11 +571,8 @@ export class AppMainContainer extends Component< const { updateDashboardData, updateWorkspaceData } = this.props; const fileText = await file.text(); const exportedLayout = JSON.parse(fileText); - const { - filterSets, - layoutConfig, - links, - } = UserLayoutUtils.normalizeLayout(exportedLayout); + const { filterSets, layoutConfig, links } = + UserLayoutUtils.normalizeLayout(exportedLayout); updateWorkspaceData({ layoutConfig }); updateDashboardData(DEFAULT_DASHBOARD_ID, { @@ -592,14 +589,11 @@ export class AppMainContainer extends Component< */ async resetLayout(): Promise { const { layoutStorage, session } = this.props; - const { - filterSets, - layoutConfig, - links, - } = await UserLayoutUtils.getDefaultLayout( - layoutStorage, - session !== undefined - ); + const { filterSets, layoutConfig, links } = + await UserLayoutUtils.getDefaultLayout( + layoutStorage, + session !== undefined + ); const { updateDashboardData, updateWorkspaceData } = this.props; updateWorkspaceData({ layoutConfig }); @@ -648,9 +642,11 @@ export class AppMainContainer extends Component< pluginModule != null && (pluginModule as { TablePlugin: ReactElement }).TablePlugin != null ) { - return (pluginModule as { - TablePlugin: TablePlugin; - }).TablePlugin; + return ( + pluginModule as { + TablePlugin: TablePlugin; + } + ).TablePlugin; } const errorMessage = `Unable to find table plugin ${pluginName}.`; @@ -778,23 +774,17 @@ export class AppMainContainer extends Component< } getDashboardPlugins = memoize((plugins: DeephavenPluginModuleMap) => - ([...plugins.entries()].filter( - ([, plugin]: [string, { DashboardPlugin?: typeof React.Component }]) => - plugin.DashboardPlugin != null - ) as [ - string, - { DashboardPlugin: typeof React.Component } - ][]).map(([name, { DashboardPlugin }]) => ) + ( + [...plugins.entries()].filter( + ([, plugin]: [string, { DashboardPlugin?: typeof React.Component }]) => + plugin.DashboardPlugin != null + ) as [string, { DashboardPlugin: typeof React.Component }][] + ).map(([name, { DashboardPlugin }]) => ) ); render(): ReactElement { - const { - activeTool, - plugins, - user, - workspace, - serverConfigValues, - } = this.props; + const { activeTool, plugins, user, workspace, serverConfigValues } = + this.props; const { data: workspaceData } = workspace; const { layoutConfig } = workspaceData; const { permissions } = user; diff --git a/packages/code-studio/src/main/UserLayoutUtils.test.ts b/packages/code-studio/src/main/UserLayoutUtils.test.ts index 07d8349c1c..1168e0e01a 100644 --- a/packages/code-studio/src/main/UserLayoutUtils.test.ts +++ b/packages/code-studio/src/main/UserLayoutUtils.test.ts @@ -34,13 +34,13 @@ const layoutConfig: ItemConfigType[] = [ type: 'TestComponentType', }, ]; -const layoutV3 = ({ +const layoutV3 = { links, filterSets, layoutConfig, another: 'another test property', version: 3, -} as unknown) as ExportedLayout; +} as unknown as ExportedLayout; const layoutV2: ExportedLayoutV2 = { links, filterSets, diff --git a/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx b/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx index 3c3ec0e447..5083a56207 100644 --- a/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx +++ b/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx @@ -345,9 +345,11 @@ export class ColumnSpecificSectionContent extends PureComponent< ); } - getRuleError( - rule: FormatterItem - ): { hasColumnNameError: boolean; hasFormatError: boolean; message: string } { + getRuleError(rule: FormatterItem): { + hasColumnNameError: boolean; + hasFormatError: boolean; + message: string; + } { const { dh } = this.props; const error = { hasColumnNameError: false, diff --git a/packages/code-studio/src/settings/FormattingSectionContent.tsx b/packages/code-studio/src/settings/FormattingSectionContent.tsx index 36bb15e624..0d77271126 100644 --- a/packages/code-studio/src/settings/FormattingSectionContent.tsx +++ b/packages/code-studio/src/settings/FormattingSectionContent.tsx @@ -115,27 +115,22 @@ export class FormattingSectionContent extends PureComponent< FormattingSectionContent.inputDebounceTime ); - this.handleDefaultDateTimeFormatChange = this.handleDefaultDateTimeFormatChange.bind( - this - ); - this.handleDefaultDecimalFormatChange = this.handleDefaultDecimalFormatChange.bind( - this - ); - this.handleDefaultIntegerFormatChange = this.handleDefaultIntegerFormatChange.bind( - this - ); + this.handleDefaultDateTimeFormatChange = + this.handleDefaultDateTimeFormatChange.bind(this); + this.handleDefaultDecimalFormatChange = + this.handleDefaultDecimalFormatChange.bind(this); + this.handleDefaultIntegerFormatChange = + this.handleDefaultIntegerFormatChange.bind(this); this.handleShowTimeZoneChange = this.handleShowTimeZoneChange.bind(this); - this.handleShowTSeparatorChange = this.handleShowTSeparatorChange.bind( - this - ); + this.handleShowTSeparatorChange = + this.handleShowTSeparatorChange.bind(this); this.handleTimeZoneChange = this.handleTimeZoneChange.bind(this); this.handleResetDateTimeFormat = this.handleResetDateTimeFormat.bind(this); this.handleResetDecimalFormat = this.handleResetDecimalFormat.bind(this); this.handleResetIntegerFormat = this.handleResetIntegerFormat.bind(this); this.handleResetTimeZone = this.handleResetTimeZone.bind(this); - this.handleTruncateNumbersWithPoundChange = this.handleTruncateNumbersWithPoundChange.bind( - this - ); + this.handleTruncateNumbersWithPoundChange = + this.handleTruncateNumbersWithPoundChange.bind(this); const { formatter, @@ -414,10 +409,12 @@ export class FormattingSectionContent extends PureComponent< } = this.state; const { - defaultFormatString: defaultDecimalFormatString = DecimalColumnFormatter.DEFAULT_FORMAT_STRING, + defaultFormatString: + defaultDecimalFormatString = DecimalColumnFormatter.DEFAULT_FORMAT_STRING, } = defaultDecimalFormatOptions ?? {}; const { - defaultFormatString: defaultIntegerFormatString = IntegerColumnFormatter.DEFAULT_FORMAT_STRING, + defaultFormatString: + defaultIntegerFormatString = IntegerColumnFormatter.DEFAULT_FORMAT_STRING, } = defaultIntegerFormatOptions ?? {}; const isTimeZoneDefault = timeZone === defaults.timeZone; diff --git a/packages/code-studio/src/settings/ShortcutsSectionContent.tsx b/packages/code-studio/src/settings/ShortcutsSectionContent.tsx index 70b594bc93..da1eaac73b 100644 --- a/packages/code-studio/src/settings/ShortcutsSectionContent.tsx +++ b/packages/code-studio/src/settings/ShortcutsSectionContent.tsx @@ -116,9 +116,10 @@ function ShortcutCategory({ setShortcuts(s => [...s]); } - const displayTexts = useMemo(() => shortcuts.map(s => s.getDisplayText()), [ - shortcuts, - ]); + const displayTexts = useMemo( + () => shortcuts.map(s => s.getDisplayText()), + [shortcuts] + ); return (
diff --git a/packages/code-studio/src/storage/LocalWorkspaceStorage.ts b/packages/code-studio/src/storage/LocalWorkspaceStorage.ts index a15b769397..c8a0d8a195 100644 --- a/packages/code-studio/src/storage/LocalWorkspaceStorage.ts +++ b/packages/code-studio/src/storage/LocalWorkspaceStorage.ts @@ -25,14 +25,11 @@ export class LocalWorkspaceStorage implements WorkspaceStorage { layoutStorage: LayoutStorage, options?: WorkspaceStorageLoadOptions ): Promise { - const { - filterSets, - links, - layoutConfig, - } = await UserLayoutUtils.getDefaultLayout( - layoutStorage, - options?.isConsoleAvailable - ); + const { filterSets, links, layoutConfig } = + await UserLayoutUtils.getDefaultLayout( + layoutStorage, + options?.isConsoleAvailable + ); return { settings: { diff --git a/packages/code-studio/src/styleguide/Buttons.tsx b/packages/code-studio/src/styleguide/Buttons.tsx index 250820ef1b..11d341a229 100644 --- a/packages/code-studio/src/styleguide/Buttons.tsx +++ b/packages/code-studio/src/styleguide/Buttons.tsx @@ -22,13 +22,9 @@ class Buttons extends Component, ButtonsState> { } static renderButtons(type: string): ReactElement { - const brands = [ - 'primary', - 'secondary', - 'success', - 'info', - 'danger', - ].map((brand: string) => Buttons.renderButtonBrand(type, brand)); + const brands = ['primary', 'secondary', 'success', 'info', 'danger'].map( + (brand: string) => Buttons.renderButtonBrand(type, brand) + ); return (
diff --git a/packages/code-studio/src/styleguide/MockIrisGridTreeModel.ts b/packages/code-studio/src/styleguide/MockIrisGridTreeModel.ts index 89f16c0379..828d20741b 100644 --- a/packages/code-studio/src/styleguide/MockIrisGridTreeModel.ts +++ b/packages/code-studio/src/styleguide/MockIrisGridTreeModel.ts @@ -40,7 +40,8 @@ const EMPTY_ARRAY: never[] = []; */ class MockIrisGridTreeModel extends IrisGridModel - implements ExpandableGridModel, EditableGridModel { + implements ExpandableGridModel, EditableGridModel +{ protected model: MockTreeGridModel; protected editedData: string[][]; diff --git a/packages/code-studio/src/styleguide/StyleGuideInit.tsx b/packages/code-studio/src/styleguide/StyleGuideInit.tsx index bceb90b490..b93def403b 100644 --- a/packages/code-studio/src/styleguide/StyleGuideInit.tsx +++ b/packages/code-studio/src/styleguide/StyleGuideInit.tsx @@ -24,7 +24,7 @@ function StyleGuideInit(props: { useEffect(() => { LocalWorkspaceStorage.makeDefaultWorkspace({ getLayouts: async () => [] as string[], - getLayout: async () => ({} as ExportedLayout), + getLayout: async () => ({}) as ExportedLayout, }).then(setWorkspace); }, [setWorkspace]); diff --git a/packages/code-studio/src/styleguide/grid-examples/DataBarExample.tsx b/packages/code-studio/src/styleguide/grid-examples/DataBarExample.tsx index 9718b2399d..ba87b2df44 100644 --- a/packages/code-studio/src/styleguide/grid-examples/DataBarExample.tsx +++ b/packages/code-studio/src/styleguide/grid-examples/DataBarExample.tsx @@ -68,32 +68,12 @@ function DataBarExample() { data.push(columnData.slice()); // Decimals data.push([ - 100, - 10.5, - 11.234, - -20.5, - -50, - -2.5, - -15.1234, - 94.254, - 25, - 44.4444, - -50.5, + 100, 10.5, 11.234, -20.5, -50, -2.5, -15.1234, 94.254, 25, 44.4444, -50.5, ]); // Big values data.push([ - 1000000, - 10, - 200, - -20000, - -2000000, - -25, - -900000, - 800000, - 100000, - 450000, - 1, + 1000000, 10, 200, -20000, -2000000, -25, -900000, 800000, 100000, 450000, 1, ]); // RTL gradient with multiple colors diff --git a/packages/code-studio/src/styleguide/index.html b/packages/code-studio/src/styleguide/index.html index 9d90ebccf5..8bdf0e8011 100644 --- a/packages/code-studio/src/styleguide/index.html +++ b/packages/code-studio/src/styleguide/index.html @@ -1,4 +1,4 @@ - + diff --git a/packages/components/src/Checkbox.tsx b/packages/components/src/Checkbox.tsx index f2f2c1ab48..791c0ba61c 100644 --- a/packages/components/src/Checkbox.tsx +++ b/packages/components/src/Checkbox.tsx @@ -49,19 +49,20 @@ const Checkbox = React.forwardRef( [ref, checked] ); - const handleOnChange: React.ChangeEventHandler = useCallback( - event => { - if (ref.current) { - // ref.current can be null in tests, doesn't impact behaviour - ref.current.indeterminate = checked === null; - } - - if (onChange) { - onChange(event); - } - }, - [ref, checked, onChange] - ); + const handleOnChange: React.ChangeEventHandler = + useCallback( + event => { + if (ref.current) { + // ref.current can be null in tests, doesn't impact behaviour + ref.current.indeterminate = checked === null; + } + + if (onChange) { + onChange(event); + } + }, + [ref, checked, onChange] + ); return (
diff --git a/packages/components/src/DraggableItemList.tsx b/packages/components/src/DraggableItemList.tsx index b52e8c6912..57aef45e6a 100644 --- a/packages/components/src/DraggableItemList.tsx +++ b/packages/components/src/DraggableItemList.tsx @@ -239,23 +239,18 @@ class DraggableItemList extends PureComponent< draggablePrefix: string, isDragDisabled: boolean, renderItem: DraggableRenderItemFn - ) => ({ - item, - itemIndex, - isFocused, - isSelected, - style, - }: RenderItemProps) => - this.getCachedDraggableItem( - draggablePrefix, - renderItem, - item, - itemIndex, - isFocused, - isSelected, - isDragDisabled, - style - ), + ) => + ({ item, itemIndex, isFocused, isSelected, style }: RenderItemProps) => + this.getCachedDraggableItem( + draggablePrefix, + renderItem, + item, + itemIndex, + isFocused, + isSelected, + isDragDisabled, + style + ), { max: 1 } ); @@ -265,45 +260,46 @@ class DraggableItemList extends PureComponent< items: readonly T[], offset: number, renderItem: DraggableRenderItemFn + ): DraggableChildrenFn => // eslint-disable-next-line react/no-unstable-nested-components, react/display-name, react/function-component-definition - ): DraggableChildrenFn => (provided, snapshot, rubric) => { - // eslint-disable-next-line react/no-this-in-sfc - const { selectedCount } = this.state; - const { draggableProps, dragHandleProps, innerRef } = provided; - const { index: itemIndex } = rubric.source; - const item = items[itemIndex - offset]; - return ( -
+ (provided, snapshot, rubric) => { + // eslint-disable-next-line react/no-this-in-sfc + const { selectedCount } = this.state; + const { draggableProps, dragHandleProps, innerRef } = provided; + const { index: itemIndex } = rubric.source; + const item = items[itemIndex - offset]; + return (
2 } + 'draggable-item-list-dragging-item-container', + draggingItemClassName )} + // eslint-disable-next-line react/jsx-props-no-spreading + {...draggableProps} + // eslint-disable-next-line react/jsx-props-no-spreading + {...dragHandleProps} + ref={innerRef} > - {renderItem({ - item, - itemIndex, - isFocused: false, - isSelected: true, - style: {}, - isClone: true, - selectedCount, - })} +
2 } + )} + > + {renderItem({ + item, + itemIndex, + isFocused: false, + isSelected: true, + style: {}, + isClone: true, + selectedCount, + })} +
-
- ); - }, + ); + }, { max: 1 } ); diff --git a/packages/components/src/MaskedInput.tsx b/packages/components/src/MaskedInput.tsx index c59bd52177..e7e481854f 100644 --- a/packages/components/src/MaskedInput.tsx +++ b/packages/components/src/MaskedInput.tsx @@ -26,7 +26,7 @@ const FIXED_WIDTH_SPACE = '\u2007'; export type SelectionSegment = { selectionStart: number; selectionEnd: number; - selectionDirection?: typeof SELECTION_DIRECTION[keyof typeof SELECTION_DIRECTION]; + selectionDirection?: (typeof SELECTION_DIRECTION)[keyof typeof SELECTION_DIRECTION]; }; type MaskedInputProps = { @@ -107,11 +107,8 @@ const MaskedInput = React.forwardRef( function setSelectedSegment() { if (selection != null) { log.debug('setting selection...', selection); - const { - selectionStart, - selectionEnd, - selectionDirection, - } = selection; + const { selectionStart, selectionEnd, selectionDirection } = + selection; input.current?.setSelectionRange( selectionStart, selectionEnd, diff --git a/packages/components/src/ThemeExport.ts b/packages/components/src/ThemeExport.ts index d4e2cfde60..63ad1ac275 100644 --- a/packages/components/src/ThemeExport.ts +++ b/packages/components/src/ThemeExport.ts @@ -11,7 +11,7 @@ const transitions = { } as const; type Theme = { - [Property in keyof typeof transitions]: typeof transitions[Property]; + [Property in keyof typeof transitions]: (typeof transitions)[Property]; } & { [key: string]: string }; export default Object.freeze({ diff --git a/packages/components/src/TimeInput.test.tsx b/packages/components/src/TimeInput.test.tsx index ba45d6e9a8..092ba2f0e8 100644 --- a/packages/components/src/TimeInput.test.tsx +++ b/packages/components/src/TimeInput.test.tsx @@ -300,11 +300,8 @@ describe('arrow left and right jumps segments', () => { } } - const { - selectionStart, - selectionEnd, - selectionDirection, - } = expectedSelection; + const { selectionStart, selectionEnd, selectionDirection } = + expectedSelection; expect(input).toBeInstanceOf(HTMLInputElement); expect(input.selectionStart).toEqual(selectionStart); diff --git a/packages/components/src/TimeSlider.scss b/packages/components/src/TimeSlider.scss index d5c82adb28..660c91ee82 100644 --- a/packages/components/src/TimeSlider.scss +++ b/packages/components/src/TimeSlider.scss @@ -1,4 +1,4 @@ -@use "sass:math"; +@use 'sass:math'; @import '../scss/custom.scss'; diff --git a/packages/components/src/ToastNotification.tsx b/packages/components/src/ToastNotification.tsx index 6d34b83fb0..d26754ac35 100644 --- a/packages/components/src/ToastNotification.tsx +++ b/packages/components/src/ToastNotification.tsx @@ -7,7 +7,7 @@ import ThemeExport from './ThemeExport'; import './ToastNotification.scss'; type ToastNotificationProps = { - buttons?: typeof Button[]; + buttons?: (typeof Button)[]; classNames?: string; isShown?: boolean; message?: string; diff --git a/packages/components/src/UISwitch.scss b/packages/components/src/UISwitch.scss index 344b5d724e..7c3c88e877 100644 --- a/packages/components/src/UISwitch.scss +++ b/packages/components/src/UISwitch.scss @@ -32,7 +32,9 @@ $switch-background-active-color: $primary; border-radius: $switch-handle-size; background-color: $switch-handle-color; transform: translateX(0); - transition: transform $transition ease-in, background-color $transition; + transition: + transform $transition ease-in, + background-color $transition; } ::before, diff --git a/packages/components/src/context-actions/ContextMenu.tsx b/packages/components/src/context-actions/ContextMenu.tsx index e4ab447c5a..8e7971195f 100644 --- a/packages/components/src/context-actions/ContextMenu.tsx +++ b/packages/components/src/context-actions/ContextMenu.tsx @@ -342,13 +342,11 @@ class ContextMenu extends PureComponent { // as the number of menu items can change (actions can bubble) // and menu should always be positioned relative to spawn point let { top, left } = this.initialPosition; - const { - width, - height, - } = this.container.current?.getBoundingClientRect() ?? { - width: 0, - height: 0, - }; + const { width, height } = + this.container.current?.getBoundingClientRect() ?? { + width: 0, + height: 0, + }; const hasOverflow = (this.container.current?.scrollHeight ?? 0) > window.innerHeight; @@ -430,7 +428,7 @@ class ContextMenu extends PureComponent { if (oldFocus >= 0 && oldFocus < menuItems.length) { this.handleMenuItemClick( menuItems[oldFocus], - (e as React.SyntheticEvent) as React.MouseEvent + e as React.SyntheticEvent as React.MouseEvent ); } return; diff --git a/packages/components/src/navigation/Stack.tsx b/packages/components/src/navigation/Stack.tsx index da640c13da..1b65a7a8bd 100644 --- a/packages/components/src/navigation/Stack.tsx +++ b/packages/components/src/navigation/Stack.tsx @@ -17,9 +17,10 @@ export function Stack({ children, 'data-testid': dataTestId, }: StackProps): JSX.Element { - const childrenArray = useMemo(() => React.Children.toArray(children), [ - children, - ]); + const childrenArray = useMemo( + () => React.Children.toArray(children), + [children] + ); const prevChildrenArray = usePrevious(childrenArray); const [mainView, setMainView] = useState( childrenArray[childrenArray.length - 1] diff --git a/packages/components/src/popper/Popper.scss b/packages/components/src/popper/Popper.scss index 26df895ee8..d263fd6287 100644 --- a/packages/components/src/popper/Popper.scss +++ b/packages/components/src/popper/Popper.scss @@ -14,7 +14,9 @@ $animation-offset: 10px; background: $tooltip-bg; color: $tooltip-color; border-radius: $border-radius; - transition: visibility $transition, opacity $transition; + transition: + visibility $transition, + opacity $transition; pointer-events: none; outline: 0; diff --git a/packages/components/src/popper/Popper.tsx b/packages/components/src/popper/Popper.tsx index bfcede2c76..cb2f42e1e5 100644 --- a/packages/components/src/popper/Popper.tsx +++ b/packages/components/src/popper/Popper.tsx @@ -239,13 +239,8 @@ class Popper extends Component { } renderContent(): JSX.Element { - const { - className, - children, - timeout, - interactive, - closeOnBlur, - } = this.props; + const { className, children, timeout, interactive, closeOnBlur } = + this.props; const { show } = this.state; return ( diff --git a/packages/console/src/Console.tsx b/packages/console/src/Console.tsx index 5bde0feb8e..2fd806f791 100644 --- a/packages/console/src/Console.tsx +++ b/packages/console/src/Console.tsx @@ -140,7 +140,7 @@ export class Console extends PureComponent { * @returns true if the log level should be output to the console */ static isOutputLevel( - logLevel: typeof LogLevel[keyof typeof LogLevel] + logLevel: (typeof LogLevel)[keyof typeof LogLevel] ): boolean { // We want all errors to be output, in addition to STDOUT. // That way the user is more likely to see them. @@ -158,12 +158,10 @@ export class Console extends PureComponent { this.handleLogMessage = this.handleLogMessage.bind(this); this.handleOverflowActions = this.handleOverflowActions.bind(this); this.handleScrollPaneScroll = this.handleScrollPaneScroll.bind(this); - this.handleToggleAutoLaunchPanels = this.handleToggleAutoLaunchPanels.bind( - this - ); - this.handleToggleClosePanelsOnDisconnect = this.handleToggleClosePanelsOnDisconnect.bind( - this - ); + this.handleToggleAutoLaunchPanels = + this.handleToggleAutoLaunchPanels.bind(this); + this.handleToggleClosePanelsOnDisconnect = + this.handleToggleClosePanelsOnDisconnect.bind(this); this.handleTogglePrintStdout = this.handleTogglePrintStdout.bind(this); this.handleUploadCsv = this.handleUploadCsv.bind(this); this.handleHideCsv = this.handleHideCsv.bind(this); @@ -412,7 +410,7 @@ export class Console extends PureComponent { if ( Console.isOutputLevel( - message.logLevel as typeof LogLevel[keyof typeof LogLevel] + message.logLevel as (typeof LogLevel)[keyof typeof LogLevel] ) ) { this.queueLogMessage(message.message, message.logLevel); @@ -422,7 +420,7 @@ export class Console extends PureComponent { queueLogMessage(message: string, logLevel: string): void { const result: Record = {}; if ( - Console.isErrorLevel(logLevel as typeof LogLevel[keyof typeof LogLevel]) + Console.isErrorLevel(logLevel as (typeof LogLevel)[keyof typeof LogLevel]) ) { result.error = message; } else { @@ -733,13 +731,8 @@ export class Console extends PureComponent { } handleOpenCsvTable(title: string): void { - const { - dh, - openObject, - commandHistoryStorage, - language, - scope, - } = this.props; + const { dh, openObject, commandHistoryStorage, language, scope } = + this.props; const { consoleHistory, objectMap } = this.state; const object = { name: title, title, type: dh.VariableType.TABLE }; const isExistingObject = objectMap.has(title); diff --git a/packages/console/src/csv/CsvFormats.ts b/packages/console/src/csv/CsvFormats.ts index 67ec46df7e..a732e6d74f 100644 --- a/packages/console/src/csv/CsvFormats.ts +++ b/packages/console/src/csv/CsvFormats.ts @@ -1,4 +1,4 @@ -export type CsvTypes = typeof CsvFormats.TYPES[keyof typeof CsvFormats.TYPES]; +export type CsvTypes = (typeof CsvFormats.TYPES)[keyof typeof CsvFormats.TYPES]; class CsvFormats { static DEFAULT_TYPE = 'DEFAULT_CSV' as const; diff --git a/packages/console/src/csv/CsvInputBar.tsx b/packages/console/src/csv/CsvInputBar.tsx index 5af4c97d3c..3753d3462a 100644 --- a/packages/console/src/csv/CsvInputBar.tsx +++ b/packages/console/src/csv/CsvInputBar.tsx @@ -293,13 +293,8 @@ class CsvInputBar extends Component { render(): ReactElement { const { file, paste } = this.props; - const { - tableName, - isFirstRowHeaders, - showProgress, - progressValue, - type, - } = this.state; + const { tableName, isFirstRowHeaders, showProgress, progressValue, type } = + this.state; // A blank table name is invalid for pasted values const isNameInvalid = Boolean(paste) && !tableName; return ( diff --git a/packages/console/src/csv/CsvTypeParser.ts b/packages/console/src/csv/CsvTypeParser.ts index 80d58e6bf6..1762cfc710 100644 --- a/packages/console/src/csv/CsvTypeParser.ts +++ b/packages/console/src/csv/CsvTypeParser.ts @@ -11,8 +11,10 @@ const UNKNOWN = 'unknown'; const MAX_INT = 2147483647; const MIN_INT = -2147483648; -const DATE_TIME_REGEX = /^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/; -const LOCAL_TIME_REGEX = /^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/; +const DATE_TIME_REGEX = + /^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/; +const LOCAL_TIME_REGEX = + /^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/; /** * Determines the type of each column in a CSV file by parsing it and looking at every value. @@ -52,7 +54,7 @@ class CsvTypeParser { // Allows for cusomt rules in addition to isNaN static isNotParsableNumber(s: string): boolean { return ( - isNaN((s as unknown) as number) || s === 'Infinity' || s === '-Infinity' + isNaN(s as unknown as number) || s === 'Infinity' || s === '-Infinity' ); } diff --git a/packages/console/src/monaco/MonacoProviders.tsx b/packages/console/src/monaco/MonacoProviders.tsx index cde90af81c..92d2825b80 100644 --- a/packages/console/src/monaco/MonacoProviders.tsx +++ b/packages/console/src/monaco/MonacoProviders.tsx @@ -136,22 +136,18 @@ class MonacoProviders extends PureComponent< componentDidMount(): void { const { language, session } = this.props; - this.registeredCompletionProvider = monaco.languages.registerCompletionItemProvider( - language, - { + this.registeredCompletionProvider = + monaco.languages.registerCompletionItemProvider(language, { provideCompletionItems: this.handleCompletionRequest, triggerCharacters: ['.', '"', "'"], - } - ); + }); if (session.getSignatureHelp) { - this.registeredSignatureProvider = monaco.languages.registerSignatureHelpProvider( - language, - { + this.registeredSignatureProvider = + monaco.languages.registerSignatureHelpProvider(language, { provideSignatureHelp: this.handleSignatureRequest, signatureHelpTriggerCharacters: ['(', ','], - } - ); + }); } if (session.getHover) { diff --git a/packages/console/src/monaco/MonacoUtils.test.ts b/packages/console/src/monaco/MonacoUtils.test.ts index 2378cca851..702bba1d41 100644 --- a/packages/console/src/monaco/MonacoUtils.test.ts +++ b/packages/console/src/monaco/MonacoUtils.test.ts @@ -47,7 +47,7 @@ const MULTI_MOD_PARAMS: ConstructorParameters[0] = { describe('Register worker', () => { it('Registers the getWorker function', () => { - const getWorker = () => ({} as Worker); + const getWorker = () => ({}) as Worker; MonacoUtils.registerGetWorker(getWorker); expect(window.MonacoEnvironment?.getWorker).toBe(getWorker); }); @@ -154,14 +154,14 @@ describe('Mac shortcuts', () => { describe('provideLinks', () => { it('it should get a provideLinks function which should return an object with the links', () => { const { provideLinks } = MonacoUtils; - const mockModel: monaco.editor.ITextModel = ({ + const mockModel: monaco.editor.ITextModel = { getLineCount: jest.fn(() => 2), getLineContent: jest.fn(lineNumber => lineNumber === 1 ? 'https://google.com http://www.example.com/' : 'mail@gmail.com' ), - } as unknown) as monaco.editor.ITextModel; + } as unknown as monaco.editor.ITextModel; const expectedValue = { links: [ diff --git a/packages/console/src/monaco/MonacoUtils.ts b/packages/console/src/monaco/MonacoUtils.ts index e937e97912..50f26f8e5a 100644 --- a/packages/console/src/monaco/MonacoUtils.ts +++ b/packages/console/src/monaco/MonacoUtils.ts @@ -456,9 +456,9 @@ class MonacoUtils { ); } - static provideLinks( - model: monaco.editor.ITextModel - ): { links: monaco.languages.ILink[] } { + static provideLinks(model: monaco.editor.ITextModel): { + links: monaco.languages.ILink[]; + } { const newTokens: monaco.languages.ILink[] = []; for (let i = 1; i <= model.getLineCount(); i += 1) { diff --git a/packages/console/src/monaco/lang/db.ts b/packages/console/src/monaco/lang/db.ts index 8cd7c1d6f1..2b1b898f89 100644 --- a/packages/console/src/monaco/lang/db.ts +++ b/packages/console/src/monaco/lang/db.ts @@ -30,7 +30,8 @@ const conf: monaco.languages.LanguageConfiguration = { ], onEnterRules: [ { - beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, + beforeText: + /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, action: { indentAction: 1 }, // see monaco.languages.IndentAction.Indent }, ], @@ -162,7 +163,8 @@ const language: monaco.languages.IMonarchLanguage = { exponent: /[eE][\-+]?[0-9]+/, regexpctl: /[(){}\[\]\$\^|\-*+?\.]/, - regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/, + regexpesc: + /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/, tokenizer: { root: [ diff --git a/packages/console/src/monaco/lang/groovy.ts b/packages/console/src/monaco/lang/groovy.ts index a4c5d0519d..d9c191f139 100644 --- a/packages/console/src/monaco/lang/groovy.ts +++ b/packages/console/src/monaco/lang/groovy.ts @@ -29,7 +29,8 @@ const conf: monaco.languages.LanguageConfiguration = { ], onEnterRules: [ { - beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, + beforeText: + /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, action: { indentAction: 1 }, // see monaco.languages.IndentAction.Indent }, ], @@ -131,7 +132,8 @@ const language: monaco.languages.IMonarchLanguage = { delimiters: /[;=.@:,`]/, // strings - escapes: /\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, + escapes: + /\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, rawpre: /(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/, strpre: /(?:[buBU])/, diff --git a/packages/console/src/monaco/lang/python.ts b/packages/console/src/monaco/lang/python.ts index ecd2c1ec0e..2ee3718b87 100644 --- a/packages/console/src/monaco/lang/python.ts +++ b/packages/console/src/monaco/lang/python.ts @@ -29,7 +29,8 @@ const conf: monaco.languages.LanguageConfiguration = { ], onEnterRules: [ { - beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, + beforeText: + /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/, action: { indentAction: 1 }, // see monaco.languages.IndentAction.Indent }, ], @@ -128,7 +129,8 @@ const language: monaco.languages.IMonarchLanguage = { delimiters: /[;=.@:,`]/, // strings - escapes: /\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, + escapes: + /\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/, rawpre: /(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/, strpre: /(?:[buBU])/, diff --git a/packages/console/src/monaco/lang/scala.ts b/packages/console/src/monaco/lang/scala.ts index a40a052067..7e718477bd 100644 --- a/packages/console/src/monaco/lang/scala.ts +++ b/packages/console/src/monaco/lang/scala.ts @@ -38,7 +38,8 @@ const conf: monaco.languages.LanguageConfiguration = { * unary_ is allowed as an identifier. * _= is allowed as an identifier. */ - wordPattern: /(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g, + wordPattern: + /(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g, comments: { lineComment: '//', blockComment: ['/*', '*/'], @@ -141,9 +142,11 @@ const language: monaco.languages.IMonarchLanguage = { hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/, // C# style strings - escapes: /\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, + escapes: + /\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, - fstring_conv: /[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/, + fstring_conv: + /[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/, // The main tokenizer for our languages tokenizer: { diff --git a/packages/console/src/notebook/ScriptEditor.tsx b/packages/console/src/notebook/ScriptEditor.tsx index 724eaf9648..5ab9ef1285 100644 --- a/packages/console/src/notebook/ScriptEditor.tsx +++ b/packages/console/src/notebook/ScriptEditor.tsx @@ -330,14 +330,8 @@ class ScriptEditor extends Component { } render(): ReactElement { - const { - error, - isLoaded, - isLoading, - session, - sessionLanguage, - settings, - } = this.props; + const { error, isLoaded, isLoading, session, sessionLanguage, settings } = + this.props; const { model } = this.state; const errorMessage = error ? `Unable to open document. ${error}` : null; const editorLanguage = settings ? settings.language ?? null : null; diff --git a/packages/dashboard-core-plugins/src/controls/dropdown-filter/DropdownFilter.tsx b/packages/dashboard-core-plugins/src/controls/dropdown-filter/DropdownFilter.tsx index 947fe503d0..18b6bf2e3b 100644 --- a/packages/dashboard-core-plugins/src/controls/dropdown-filter/DropdownFilter.tsx +++ b/packages/dashboard-core-plugins/src/controls/dropdown-filter/DropdownFilter.tsx @@ -369,14 +369,8 @@ export class DropdownFilter extends Component< values, settingsError, } = this.props; - const { - column, - disableCancel, - id, - isValueShown, - selectedColumn, - value, - } = this.state; + const { column, disableCancel, id, isValueShown, selectedColumn, value } = + this.state; const columnSelectionDisabled = source === null; const columns = this.getCompatibleColumns(source, allColumns); const isLinked = source != null; diff --git a/packages/dashboard-core-plugins/src/linker/Linker.tsx b/packages/dashboard-core-plugins/src/linker/Linker.tsx index a2caa73522..788d93c823 100644 --- a/packages/dashboard-core-plugins/src/linker/Linker.tsx +++ b/packages/dashboard-core-plugins/src/linker/Linker.tsx @@ -81,7 +81,8 @@ const connector = connect(mapState, { addDashboardLinks: addDashboardLinksAction, deleteDashboardLinks: deleteDashboardLinksAction, setDashboardIsolatedLinkerPanelId: setDashboardIsolatedLinkerPanelIdAction, - setDashboardColumnSelectionValidator: setDashboardColumnSelectionValidatorAction, + setDashboardColumnSelectionValidator: + setDashboardColumnSelectionValidatorAction, }); export type LinkerProps = OwnProps & diff --git a/packages/dashboard-core-plugins/src/linker/LinkerOverlayContent.tsx b/packages/dashboard-core-plugins/src/linker/LinkerOverlayContent.tsx index c17ff38238..875a9c9330 100644 --- a/packages/dashboard-core-plugins/src/linker/LinkerOverlayContent.tsx +++ b/packages/dashboard-core-plugins/src/linker/LinkerOverlayContent.tsx @@ -146,7 +146,7 @@ export class LinkerOverlayContent extends Component< if (glContainer == null) { throw new Error(`Unable to find panel container for id: ${panelId}`); } - return LayoutUtils.getTabPoint((glContainer as unknown) as Container); + return LayoutUtils.getTabPoint(glContainer as unknown as Container); } handleOperatorChanged(linkId: string, type: FilterTypeValue): void { diff --git a/packages/dashboard-core-plugins/src/linker/LinkerUtils.test.tsx b/packages/dashboard-core-plugins/src/linker/LinkerUtils.test.tsx index d555bf6b1e..5172347d5f 100644 --- a/packages/dashboard-core-plugins/src/linker/LinkerUtils.test.tsx +++ b/packages/dashboard-core-plugins/src/linker/LinkerUtils.test.tsx @@ -47,7 +47,7 @@ function makeGridPanel() { test('Panels are not linkable if they do not have the required functions', () => { const gridPanel = makeGridPanel(); - const panel = (gridPanel as unknown) as PanelComponent; + const panel = gridPanel as unknown as PanelComponent; // isLinkableFromPanel requires the getCoordinateForColumn method expect(isLinkableFromPanel(panel)).toBe(false); // isLinkablePanel requires getCoordinateForColumn, setFilterMap, and unsetFilterValue methods diff --git a/packages/dashboard-core-plugins/src/panels/ChartPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/ChartPanel.test.tsx index 634c9834e0..62761aa1ce 100644 --- a/packages/dashboard-core-plugins/src/panels/ChartPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/ChartPanel.test.tsx @@ -82,7 +82,7 @@ function makeChartPanelWrapper({ columnSelectionValidator={columnSelectionValidator} makeModel={makeModel} metadata={metadata as ChartPanelMetadata} - glContainer={(glContainer as unknown) as Container} + glContainer={glContainer as unknown as Container} glEventHub={glEventHub} inputFilters={inputFilters} links={links} @@ -91,7 +91,7 @@ function makeChartPanelWrapper({ setActiveTool={setActiveTool} setDashboardIsolatedLinkerPanelId={setDashboardIsolatedLinkerPanelId} source={source} - sourcePanel={(sourcePanel as unknown) as PanelComponent} + sourcePanel={sourcePanel as unknown as PanelComponent} /> ); } diff --git a/packages/dashboard-core-plugins/src/panels/ChartPanel.tsx b/packages/dashboard-core-plugins/src/panels/ChartPanel.tsx index 77983819df..66f7302885 100644 --- a/packages/dashboard-core-plugins/src/panels/ChartPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/ChartPanel.tsx @@ -263,14 +263,8 @@ export class ChartPanel extends Component { prevState: ChartPanelState ): void { const { inputFilters, source } = this.props; - const { - columnMap, - model, - filterMap, - filterValueMap, - isLinked, - settings, - } = this.state; + const { columnMap, model, filterMap, filterValueMap, isLinked, settings } = + this.state; if (!model) { return; @@ -618,10 +612,10 @@ export class ChartPanel extends Component { this.pending .add( dh.plot.Figure.create( - (new ChartUtils(dh).makeFigureSettings( + new ChartUtils(dh).makeFigureSettings( settings, source - ) as unknown) as FigureDescriptor + ) as unknown as FigureDescriptor ) ) .then(figure => { @@ -761,9 +755,8 @@ export class ChartPanel extends Component { } getCoordinateForColumn(columnName: ColumnName): [number, number] | null { - const className = ChartColumnSelectorOverlay.makeButtonClassName( - columnName - ); + const className = + ChartColumnSelectorOverlay.makeButtonClassName(columnName); if (!this.panelContainer.current) { return null; diff --git a/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx b/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx index 014f60bcb0..866d041e38 100644 --- a/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx @@ -14,7 +14,7 @@ jest.mock('@deephaven/console', () => ({ })); function makeSession(language = 'TEST_LANG'): IdeSession { - return (new dh.IdeSession(language) as unknown) as IdeSession; + return new dh.IdeSession(language) as unknown as IdeSession; } function makeConnection({ @@ -24,10 +24,10 @@ function makeConnection({ addEventListener?: (eventName: string, callback: () => void) => void; removeEventListener?: (eventName: string, callback: () => void) => void; } = {}): IdeConnection { - return ({ + return { addEventListener, removeEventListener, - } as unknown) as IdeConnection; + } as unknown as IdeConnection; } function makeSessionConfig(): SessionConfig { @@ -53,11 +53,11 @@ function makeEventHub() { } function makeGlContainer(): Container { - return ({ + return { emit: jest.fn(), on: jest.fn(), off: jest.fn(), - } as unknown) as Container; + } as unknown as Container; } function makeCommandHistoryStorage(): CommandHistoryStorage { diff --git a/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.test.tsx index 304394236d..a7edd436ec 100644 --- a/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.test.tsx @@ -8,18 +8,18 @@ import { } from './DropdownFilterPanel'; import DropdownFilter from '../controls/dropdown-filter/DropdownFilter'; -const eventHub = ({ +const eventHub = { emit: jest.fn(), on: jest.fn(), off: jest.fn(), trigger: jest.fn(), unbind: jest.fn(), -} as unknown) as EventHub; -const container = ({ +} as unknown as EventHub; +const container = { emit: jest.fn(), on: jest.fn(), off: jest.fn(), -} as unknown) as Container; +} as unknown as Container; function makeContainer({ columns = [], diff --git a/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.tsx b/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.tsx index 5b6d61a446..8ba6a5edb1 100644 --- a/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/DropdownFilterPanel.tsx @@ -178,8 +178,13 @@ export class DropdownFilterPanel extends Component< showTSeparator: true, defaultDateTimeFormatString: `yyyy-MM-dd HH:mm:ss.SSSSSSSSS`, }); - const { value = '', isValueShown = false, name, type, timestamp } = - panelState ?? {}; + const { + value = '', + isValueShown = false, + name, + type, + timestamp, + } = panelState ?? {}; const column = name != null && type != null ? { name, type } : undefined; this.state = { column, diff --git a/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.tsx b/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.tsx index 4aa73d1038..5a1e586bf1 100644 --- a/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.tsx @@ -96,12 +96,10 @@ export class FileExplorerPanel extends React.Component< this.handleFileSelect = this.handleFileSelect.bind(this); this.handleCreateFile = this.handleCreateFile.bind(this); this.handleCreateDirectory = this.handleCreateDirectory.bind(this); - this.handleCreateDirectoryCancel = this.handleCreateDirectoryCancel.bind( - this - ); - this.handleCreateDirectorySubmit = this.handleCreateDirectorySubmit.bind( - this - ); + this.handleCreateDirectoryCancel = + this.handleCreateDirectoryCancel.bind(this); + this.handleCreateDirectorySubmit = + this.handleCreateDirectorySubmit.bind(this); this.handleDelete = this.handleDelete.bind(this); this.handleRename = this.handleRename.bind(this); this.handleSessionOpened = this.handleSessionOpened.bind(this); diff --git a/packages/dashboard-core-plugins/src/panels/FilterSetManager.tsx b/packages/dashboard-core-plugins/src/panels/FilterSetManager.tsx index e7795ef21c..83639c25cb 100644 --- a/packages/dashboard-core-plugins/src/panels/FilterSetManager.tsx +++ b/packages/dashboard-core-plugins/src/panels/FilterSetManager.tsx @@ -103,9 +103,8 @@ class FilterSetManager extends Component< this.handleNameInputKeyPress = this.handleNameInputKeyPress.bind(this); this.handleRenameConfirm = this.handleRenameConfirm.bind(this); this.handleRenameCancel = this.handleRenameCancel.bind(this); - this.handleRestoreFullStateChange = this.handleRestoreFullStateChange.bind( - this - ); + this.handleRestoreFullStateChange = + this.handleRestoreFullStateChange.bind(this); this.handleSetDelete = this.handleSetDelete.bind(this); this.handleSetEdit = this.handleSetEdit.bind(this); @@ -279,12 +278,8 @@ class FilterSetManager extends Component< } handleRenameConfirm(): void { - const { - nameInputValue, - renameSet, - modifiedFilterSets, - restoreFullState, - } = this.state; + const { nameInputValue, renameSet, modifiedFilterSets, restoreFullState } = + this.state; if (renameSet === undefined) { log.error('Renamed set undefined.'); return; diff --git a/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.test.tsx index cd6b47e1f6..feab7e0200 100644 --- a/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.test.tsx @@ -53,11 +53,8 @@ describe('FilterSetManagerPanel', () => { it('Rejects empty filter set name', async () => { const user = userEvent.setup(); - const { - getAllByRole, - getByPlaceholderText, - getByText, - } = renderFilterSetManagerPanel(); + const { getAllByRole, getByPlaceholderText, getByText } = + renderFilterSetManagerPanel(); await user.click(getByText('Capture filter set')); expect(getByText('Name captured set')).toBeVisible(); await user.clear(getByPlaceholderText('Enter name...')); @@ -69,11 +66,8 @@ describe('FilterSetManagerPanel', () => { const user = userEvent.setup(); const title = 'TEST SET'; const setFilterSets = jest.fn(); - const { - getAllByRole, - getByPlaceholderText, - getByText, - } = renderFilterSetManagerPanel({ setFilterSets }); + const { getAllByRole, getByPlaceholderText, getByText } = + renderFilterSetManagerPanel({ setFilterSets }); await user.click(getByText('Capture filter set')); expect(getByText('Name captured set')).toBeVisible(); await user.type(getByPlaceholderText('Enter name...'), title); @@ -91,12 +85,8 @@ describe('FilterSetManagerPanel', () => { const user = userEvent.setup(); const title = 'TEST SET'; const setFilterSets = jest.fn(); - const { - getByTestId, - getByLabelText, - getByPlaceholderText, - getByText, - } = renderFilterSetManagerPanel({ setFilterSets }); + const { getByTestId, getByLabelText, getByPlaceholderText, getByText } = + renderFilterSetManagerPanel({ setFilterSets }); await user.click(getByText('Capture filter set')); expect(getByText('Name captured set')).toBeVisible(); await user.type(getByPlaceholderText('Enter name...'), title); diff --git a/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.tsx b/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.tsx index 630f17eb5f..9560dc6813 100644 --- a/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/FilterSetManagerPanel.tsx @@ -72,15 +72,15 @@ interface FilterSetManagerPanelState { panelState: PanelState; // Dehydrated panel state that can load this panel } -function hasSetPanelState( - panel: PanelComponent -): panel is PanelComponent & { +function hasSetPanelState(panel: PanelComponent): panel is PanelComponent & { setPanelState: (state: InputFilterPanelState) => void; } { return ( - (panel as PanelComponent & { - setPanelState: (state: InputFilterPanelState) => void; - }).setPanelState != null + ( + panel as PanelComponent & { + setPanelState: (state: InputFilterPanelState) => void; + } + ).setPanelState != null ); } export class FilterSetManagerPanel extends Component< diff --git a/packages/dashboard-core-plugins/src/panels/InputFilterPanel.tsx b/packages/dashboard-core-plugins/src/panels/InputFilterPanel.tsx index 8741b7d3b3..b4647b4aa4 100644 --- a/packages/dashboard-core-plugins/src/panels/InputFilterPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/InputFilterPanel.tsx @@ -65,8 +65,13 @@ class InputFilterPanel extends Component< const { panelState } = props; // if panelstate is null, use destructured defaults - const { value, isValueShown = false, name, type, timestamp } = - panelState ?? {}; + const { + value, + isValueShown = false, + name, + type, + timestamp, + } = panelState ?? {}; this.state = { columns: [], diff --git a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.scss b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.scss index 3f03e86d74..457c74e1bb 100644 --- a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.scss +++ b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.scss @@ -30,4 +30,4 @@ $panel-message-overlay-top: 30px; .grid-cursor-linker { cursor: crosshair; -} \ No newline at end of file +} diff --git a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx index 5cf4d8bbb0..00c77c7c79 100644 --- a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx @@ -66,7 +66,7 @@ function makeIrisGridPanelWrapper( { await expectLoading(container); await expectLoading(container); - const params = ((MockIrisGrid.mock.calls[ - MockIrisGrid.mock.calls.length - 1 - ] as unknown) as { - onStateChange(param1: unknown, param2: unknown); - }[])[0]; + const params = ( + MockIrisGrid.mock.calls[MockIrisGrid.mock.calls.length - 1] as unknown as { + onStateChange(param1: unknown, param2: unknown); + }[] + )[0]; params.onStateChange({}, {}); await expectNotLoading(container); diff --git a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx index 762bcb675b..e4962b3da6 100644 --- a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx @@ -225,9 +225,8 @@ export class IrisGridPanel extends PureComponent< constructor(props: IrisGridPanelProps) { super(props); - this.handleAdvancedSettingsChange = this.handleAdvancedSettingsChange.bind( - this - ); + this.handleAdvancedSettingsChange = + this.handleAdvancedSettingsChange.bind(this); this.handleColumnsChanged = this.handleColumnsChanged.bind(this); this.handleTableChanged = this.handleTableChanged.bind(this); this.handleColumnSelected = this.handleColumnSelected.bind(this); @@ -937,10 +936,11 @@ export class IrisGridPanel extends PureComponent< model.columns, quickFilters ).filter(([columnIndex]) => model.isFilterable(columnIndex)); - const indexedAdvancedFilters = IrisGridUtils.changeFilterColumnNamesToIndexes( - model.columns, - advancedFilters - ).filter(([columnIndex]) => model.isFilterable(columnIndex)); + const indexedAdvancedFilters = + IrisGridUtils.changeFilterColumnNamesToIndexes( + model.columns, + advancedFilters + ).filter(([columnIndex]) => model.isFilterable(columnIndex)); assertNotNull(this.irisGridUtils); irisGrid.clearAllFilters(); irisGrid.setFilters({ @@ -994,24 +994,26 @@ export class IrisGridPanel extends PureComponent< advancedFilters: savedAdvancedFilters, } = irisGridStateOverrides; if (savedQuickFilters) { - irisGridStateOverrides.quickFilters = IrisGridUtils.changeFilterColumnNamesToIndexes( - model.columns, - (savedQuickFilters as unknown) as { - name: string; - filter: { - text: string; - }; - }[] - ); + irisGridStateOverrides.quickFilters = + IrisGridUtils.changeFilterColumnNamesToIndexes( + model.columns, + savedQuickFilters as unknown as { + name: string; + filter: { + text: string; + }; + }[] + ); } if (savedAdvancedFilters) { - irisGridStateOverrides.advancedFilters = IrisGridUtils.changeFilterColumnNamesToIndexes( - model.columns, - (savedAdvancedFilters as unknown) as { - name: string; - filter: { options: AdvancedFilterOptions }; - }[] - ); + irisGridStateOverrides.advancedFilters = + IrisGridUtils.changeFilterColumnNamesToIndexes( + model.columns, + savedAdvancedFilters as unknown as { + name: string; + filter: { options: AdvancedFilterOptions }; + }[] + ); } const { isSelectingPartition, @@ -1045,16 +1047,12 @@ export class IrisGridPanel extends PureComponent< ...irisGridState, ...irisGridStateOverrides, }); - const { - isStuckToBottom, - isStuckToRight, - movedColumns, - movedRows, - } = IrisGridUtils.hydrateGridState( - model, - { ...gridState, ...gridStateOverrides }, - irisGridState.customColumns - ); + const { isStuckToBottom, isStuckToRight, movedColumns, movedRows } = + IrisGridUtils.hydrateGridState( + model, + { ...gridState, ...gridStateOverrides }, + irisGridState.customColumns + ); this.setState({ advancedFilters, advancedSettings, @@ -1127,12 +1125,8 @@ export class IrisGridPanel extends PureComponent< assertNotNull(metrics); const { userColumnWidths, userRowHeights } = metrics; assertNotNull(gridState); - const { - isStuckToBottom, - isStuckToRight, - movedColumns, - movedRows, - } = gridState; + const { isStuckToBottom, isStuckToRight, movedColumns, movedRows } = + gridState; const panelState = this.getCachedPanelState( this.getDehydratedIrisGridPanelState( diff --git a/packages/dashboard-core-plugins/src/panels/MarkdownNotebook.scss b/packages/dashboard-core-plugins/src/panels/MarkdownNotebook.scss index 313d5cd22f..2111c47032 100644 --- a/packages/dashboard-core-plugins/src/panels/MarkdownNotebook.scss +++ b/packages/dashboard-core-plugins/src/panels/MarkdownNotebook.scss @@ -116,14 +116,20 @@ $btn-play-color: $success; @keyframes flash { 0% { - text-shadow: 0 0 5px $content-bg, 0 0 20px $content-bg; + text-shadow: + 0 0 5px $content-bg, + 0 0 20px $content-bg; } 50% { - text-shadow: 0 0 2px rgba(255, 255, 255, 50%), 0 0 10px $success; + text-shadow: + 0 0 2px rgba(255, 255, 255, 50%), + 0 0 10px $success; } 100% { - text-shadow: 0 0 5px $content-bg, 0 0 20px $content-bg; + text-shadow: + 0 0 5px $content-bg, + 0 0 20px $content-bg; } } diff --git a/packages/dashboard-core-plugins/src/panels/MarkdownPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/MarkdownPanel.test.tsx index b6a886fa9e..80083dc541 100644 --- a/packages/dashboard-core-plugins/src/panels/MarkdownPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/MarkdownPanel.test.tsx @@ -30,7 +30,7 @@ function mountMarkdownPanel( ) { return render( { this.handleTransformLinkUri = this.handleTransformLinkUri.bind(this); this.handleOverwrite = this.handleOverwrite.bind(this); this.handlePreviewPromotion = this.handlePreviewPromotion.bind(this); - this.getDropdownOverflowActions = this.getDropdownOverflowActions.bind( - this - ); + this.getDropdownOverflowActions = + this.getDropdownOverflowActions.bind(this); this.pending = new Pending(); this.debouncedSavePanelState = debounce( @@ -1155,12 +1154,13 @@ class NotebookPanel extends Component { 'Notebook extension', 'Run' ); - const disabledRunSelectedButtonTooltip = ScriptEditorUtils.getDisabledRunTooltip( - isSessionConnected, - isLanguageMatching, - 'Notebook extension', - 'Run Selected' - ); + const disabledRunSelectedButtonTooltip = + ScriptEditorUtils.getDisabledRunTooltip( + isSessionConnected, + isLanguageMatching, + 'Notebook extension', + 'Run Selected' + ); const additionalActions = [ { diff --git a/packages/dashboard-core-plugins/src/panels/Panel.test.tsx b/packages/dashboard-core-plugins/src/panels/Panel.test.tsx index 4e71f738fb..ed6942a395 100644 --- a/packages/dashboard-core-plugins/src/panels/Panel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/Panel.test.tsx @@ -41,7 +41,7 @@ function renderPanel({ return render( + ); } diff --git a/packages/dashboard-core-plugins/src/panels/PanelContextMenu.tsx b/packages/dashboard-core-plugins/src/panels/PanelContextMenu.tsx index 9d7cad7115..803c65edc6 100644 --- a/packages/dashboard-core-plugins/src/panels/PanelContextMenu.tsx +++ b/packages/dashboard-core-plugins/src/panels/PanelContextMenu.tsx @@ -44,8 +44,8 @@ class PanelContextMenu extends PureComponent< // No need to check if isClosable, golden-layout returns // false when attempting to close tabs that you can't - tabs.forEach(tab => - ((tab?.contentItem as unknown) as HasContainer).container?.close() + tabs.forEach( + tab => (tab?.contentItem as unknown as HasContainer).container?.close() ); } @@ -62,7 +62,7 @@ class PanelContextMenu extends PureComponent< } // eslint-disable-next-line no-unused-expressions - ((tabs[i]?.contentItem as unknown) as HasContainer).container?.close(); + (tabs[i]?.contentItem as unknown as HasContainer).container?.close(); } } diff --git a/packages/dashboard-core-plugins/src/panels/WidgetPanel.tsx b/packages/dashboard-core-plugins/src/panels/WidgetPanel.tsx index 2388e27f74..a214fb149b 100644 --- a/packages/dashboard-core-plugins/src/panels/WidgetPanel.tsx +++ b/packages/dashboard-core-plugins/src/panels/WidgetPanel.tsx @@ -197,11 +197,8 @@ class WidgetPanel extends PureComponent { onTabClicked, } = this.props; - const { - isPanelDisconnected, - isWidgetDisconnected, - isPanelInactive, - } = this.state; + const { isPanelDisconnected, isWidgetDisconnected, isPanelInactive } = + this.state; const errorMessage = this.getErrorMessage(); const doRenderTabTooltip = renderTabTooltip ?? diff --git a/packages/dashboard-core-plugins/src/redux/actions.ts b/packages/dashboard-core-plugins/src/redux/actions.ts index 858bb8a85f..a51d47112d 100644 --- a/packages/dashboard-core-plugins/src/redux/actions.ts +++ b/packages/dashboard-core-plugins/src/redux/actions.ts @@ -15,115 +15,127 @@ import { ColumnSelectionValidator } from '../linker/ColumnSelectionValidator'; * @param id The ID of the dashboard to set the connection for * @param connection The connection object to set for the dashboard */ -export const setDashboardConnection = ( - id: string, - connection: IdeConnection -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { connection })); +export const setDashboardConnection = + ( + id: string, + connection: IdeConnection + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { connection })); /** * Set the session wrapper for the dashboard specified * @param id The ID of the dashboard to set the session for * @param sessionWrapper The session wrapper object to set for the dashboard */ -export const setDashboardSessionWrapper = ( - id: string, - sessionWrapper: SessionWrapper -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { sessionWrapper })); +export const setDashboardSessionWrapper = + ( + id: string, + sessionWrapper: SessionWrapper + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { sessionWrapper })); /** * Set the links for a given dashboard * @param id The ID of the dashboard to set the links for * @param links The links to set */ -export const setDashboardLinks = ( - id: string, - links: Link[] -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { links })); +export const setDashboardLinks = + ( + id: string, + links: Link[] + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { links })); /** * Add links to the existing links in a dashboard. Filters out any duplicate links. * @param id The ID of the dashboard to add links to * @param newLinks The new links to add */ -export const addDashboardLinks = ( - id: string, - newLinks: Link[] -): ThunkAction> => ( - dispatch, - getState -) => { - const links = getLinksForDashboard(getState(), id); - const filtered = newLinks.filter( - newLink => - links.findIndex( - link => - deepEqual(link.start, newLink.start) && - deepEqual(link.end, newLink.end) - ) < 0 - ); - return dispatch(setDashboardLinks(id, links.concat(filtered))); -}; +export const addDashboardLinks = + ( + id: string, + newLinks: Link[] + ): ThunkAction> => + (dispatch, getState) => { + const links = getLinksForDashboard(getState(), id); + const filtered = newLinks.filter( + newLink => + links.findIndex( + link => + deepEqual(link.start, newLink.start) && + deepEqual(link.end, newLink.end) + ) < 0 + ); + return dispatch(setDashboardLinks(id, links.concat(filtered))); + }; /** * Delete links from a dashboard * @param id The ID of the dashboard to delete links from * @param linkIds The link IDs to delete */ -export const deleteDashboardLinks = ( - id: string, - linkIds: string[] -): ThunkAction> => ( - dispatch, - getState -) => { - const links = getLinksForDashboard(getState(), id); - const newLinks = links.filter(link => !linkIds.includes(link.id)); - return dispatch(setDashboardLinks(id, newLinks)); -}; +export const deleteDashboardLinks = + ( + id: string, + linkIds: string[] + ): ThunkAction> => + (dispatch, getState) => { + const links = getLinksForDashboard(getState(), id); + const newLinks = links.filter(link => !linkIds.includes(link.id)); + return dispatch(setDashboardLinks(id, newLinks)); + }; /** * Set the isolated linker panel ID for a dashboard * @param id The ID of the dashboard to set the isolated linker panel ID in * @param isolatedLinkerPanelId The isolated panel ID, or undefined to unset */ -export const setDashboardIsolatedLinkerPanelId = ( - id: string, - isolatedLinkerPanelId: string | string[] | undefined -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { isolatedLinkerPanelId })); +export const setDashboardIsolatedLinkerPanelId = + ( + id: string, + isolatedLinkerPanelId: string | string[] | undefined + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { isolatedLinkerPanelId })); /** * Set the column selection validator for a dashboard * @param id The ID of the dashboard to set the column selection validator on * @param columnSelectionValidator The column selection validator to set */ -export const setDashboardColumnSelectionValidator = ( - id: string, - columnSelectionValidator: ColumnSelectionValidator | undefined -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { columnSelectionValidator })); +export const setDashboardColumnSelectionValidator = + ( + id: string, + columnSelectionValidator: ColumnSelectionValidator | undefined + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { columnSelectionValidator })); /** * Set the console settings for a dashboard * @param id The ID of the dashboard to set the console settings on * @param consoleSettings The console settings to set for the dashboard */ -export const setDashboardConsoleSettings = ( - id: string, - consoleSettings: Record -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { consoleSettings })); +export const setDashboardConsoleSettings = + ( + id: string, + consoleSettings: Record + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { consoleSettings })); /** * Set the filter sets for a specific dashboard * @param id The ID of the dashboard to set the filter sets for * @param filterSets The filter sets to set */ -export const setDashboardFilterSets = ( - id: string, - filterSets: FilterSet[] -): ThunkAction> => dispatch => - dispatch(updateDashboardData(id, { filterSets })); +export const setDashboardFilterSets = + ( + id: string, + filterSets: FilterSet[] + ): ThunkAction> => + dispatch => + dispatch(updateDashboardData(id, { filterSets })); diff --git a/packages/dashboard/src/DashboardPlugin.ts b/packages/dashboard/src/DashboardPlugin.ts index 07aa28213a..145012cfbe 100644 --- a/packages/dashboard/src/DashboardPlugin.ts +++ b/packages/dashboard/src/DashboardPlugin.ts @@ -44,12 +44,12 @@ export type PanelFunctionComponentType = ForwardRefComponentType & export type WrappedComponentType< P extends PanelProps, - C extends ComponentType

+ C extends ComponentType

, > = ConnectedComponent; export type PanelComponentType< P extends PanelProps = PanelProps, - C extends ComponentType

= ComponentType

+ C extends ComponentType

= ComponentType

, > = ( | ComponentType

| WrappedComponentType @@ -59,7 +59,7 @@ export type PanelComponentType< export function isWrappedComponent< P extends PanelProps, - C extends ComponentType

+ C extends ComponentType

, >(type: PanelComponentType): type is WrappedComponentType { return (type as WrappedComponentType)?.WrappedComponent !== undefined; } diff --git a/packages/dashboard/src/PanelManager.ts b/packages/dashboard/src/PanelManager.ts index 8ac4e1fc5b..e33c0b873c 100644 --- a/packages/dashboard/src/PanelManager.ts +++ b/packages/dashboard/src/PanelManager.ts @@ -177,14 +177,14 @@ class PanelManager { getLastUsedPanelOfType< P extends PanelProps = PanelProps, - C extends ComponentType

= ComponentType

+ C extends ComponentType

= ComponentType

, >(type: PanelComponentType): PanelComponent

| undefined { return this.getLastUsedPanelOfTypes([type]); } getLastUsedPanelOfTypes< P extends PanelProps = PanelProps, - C extends ComponentType

= ComponentType

+ C extends ComponentType

= ComponentType

, >(types: PanelComponentType[]): PanelComponent

| undefined { return this.getLastUsedPanel(panel => types.some( diff --git a/packages/dashboard/src/layout/usePanelRegistration.ts b/packages/dashboard/src/layout/usePanelRegistration.ts index dd1f9c396e..b0706f9b7c 100644 --- a/packages/dashboard/src/layout/usePanelRegistration.ts +++ b/packages/dashboard/src/layout/usePanelRegistration.ts @@ -17,7 +17,7 @@ import { */ export default function usePanelRegistration< P extends PanelProps, - C extends React.ComponentType

+ C extends React.ComponentType

, >( registerComponent: DashboardPluginComponentProps['registerComponent'], ComponentType: PanelComponentType, diff --git a/packages/dashboard/src/redux/actions.ts b/packages/dashboard/src/redux/actions.ts index 952f439a5c..1fd9b14225 100644 --- a/packages/dashboard/src/redux/actions.ts +++ b/packages/dashboard/src/redux/actions.ts @@ -29,16 +29,15 @@ export const setDashboardData = ( * @param updateData The data to combine with the existing dashboard data * @returns */ -export const updateDashboardData = ( - id: string, - data: DashboardData -): ThunkAction> => ( - dispatch, - getState -) => - dispatch( - setDashboardData(id, { - ...getDashboardData(getState(), id), - ...data, - }) - ); +export const updateDashboardData = + ( + id: string, + data: DashboardData + ): ThunkAction> => + (dispatch, getState) => + dispatch( + setDashboardData(id, { + ...getDashboardData(getState(), id), + ...data, + }) + ); diff --git a/packages/file-explorer/src/NewItemModal.tsx b/packages/file-explorer/src/NewItemModal.tsx index a8ba97ff58..ac75f9b6fa 100644 --- a/packages/file-explorer/src/NewItemModal.tsx +++ b/packages/file-explorer/src/NewItemModal.tsx @@ -96,12 +96,10 @@ class NewItemModal extends PureComponent { this.handleValidationError = this.handleValidationError.bind(this); this.handleOverwriteCancel = this.handleOverwriteCancel.bind(this); this.handleOverwriteConfirm = this.handleOverwriteConfirm.bind(this); - this.handleExtensionChangeCancel = this.handleExtensionChangeCancel.bind( - this - ); - this.handleExtensionChangeConfirm = this.handleExtensionChangeConfirm.bind( - this - ); + this.handleExtensionChangeCancel = + this.handleExtensionChangeCancel.bind(this); + this.handleExtensionChangeConfirm = + this.handleExtensionChangeConfirm.bind(this); this.handleBreadcrumbSelect = this.handleBreadcrumbSelect.bind(this); const { defaultValue } = props; diff --git a/packages/filters/src/Operator.ts b/packages/filters/src/Operator.ts index e438ee4c9a..98903c9770 100644 --- a/packages/filters/src/Operator.ts +++ b/packages/filters/src/Operator.ts @@ -6,7 +6,7 @@ export class Operator { static readonly or = 'or'; } -export type OperatorValue = typeof Operator[Exclude< +export type OperatorValue = (typeof Operator)[Exclude< keyof typeof Operator, 'prototype' >]; diff --git a/packages/filters/src/Type.ts b/packages/filters/src/Type.ts index b35869fffe..c64cc95f97 100644 --- a/packages/filters/src/Type.ts +++ b/packages/filters/src/Type.ts @@ -45,4 +45,4 @@ export class Type { static readonly containsAny = 'containsAny'; } -export type TypeValue = typeof Type[Exclude]; +export type TypeValue = (typeof Type)[Exclude]; diff --git a/packages/golden-layout/src/LayoutManager.ts b/packages/golden-layout/src/LayoutManager.ts index 09cdb6d79e..f962c48443 100644 --- a/packages/golden-layout/src/LayoutManager.ts +++ b/packages/golden-layout/src/LayoutManager.ts @@ -39,7 +39,7 @@ import { import { DragListenerEvent } from './utils/DragListener'; export type ComponentConstructor< - C extends ComponentConfig | ReactComponentConfig = ComponentConfig + C extends ComponentConfig | ReactComponentConfig = ComponentConfig, > = { new (container: ItemContainer, state: unknown): unknown; }; @@ -268,15 +268,15 @@ export class LayoutManager extends EventEmitter { if (root) { next( - (config as unknown) as ComponentConfig & Record, + config as unknown as ComponentConfig & Record, { contentItems: [root] } as AbstractContentItem & { config: Record; } ); } else { next( - (config as unknown) as ComponentConfig & Record, - (this.root as unknown) as AbstractContentItem & { + config as unknown as ComponentConfig & Record, + this.root as unknown as AbstractContentItem & { config: Record; } ); @@ -1034,8 +1034,9 @@ export class LayoutManager extends EventEmitter { * to allow the opening window to interact with * it */ - (window as Window & - typeof globalThis & { __glInstance: LayoutManager }).__glInstance = this; + ( + window as Window & typeof globalThis & { __glInstance: LayoutManager } + ).__glInstance = this; } /** diff --git a/packages/golden-layout/src/container/ItemContainer.ts b/packages/golden-layout/src/container/ItemContainer.ts index 0c31ff0115..536538e15f 100644 --- a/packages/golden-layout/src/container/ItemContainer.ts +++ b/packages/golden-layout/src/container/ItemContainer.ts @@ -12,7 +12,7 @@ import EventEmitter from '../utils/EventEmitter'; export type CloseOptions = { force?: boolean }; export default class ItemContainer< - C extends ComponentConfig | ReactComponentConfig = ComponentConfig + C extends ComponentConfig | ReactComponentConfig = ComponentConfig, > extends EventEmitter { width?: number; height?: number; diff --git a/packages/golden-layout/src/controls/BrowserPopout.ts b/packages/golden-layout/src/controls/BrowserPopout.ts index 3a2381c76d..bcbdc96ba5 100644 --- a/packages/golden-layout/src/controls/BrowserPopout.ts +++ b/packages/golden-layout/src/controls/BrowserPopout.ts @@ -36,9 +36,8 @@ export default class BrowserPopout extends EventEmitter { private _parentId: string; private _indexInParent: number; private _layoutManager: LayoutManager; - private _popoutWindow: - | (Window & { __glInstance: LayoutManager }) - | null = null; + private _popoutWindow: (Window & { __glInstance: LayoutManager }) | null = + null; private _id = null; constructor( @@ -62,7 +61,7 @@ export default class BrowserPopout extends EventEmitter { if (this.isInitialised === false) { throw new Error("Can't create config, layout not yet initialised"); } - return ({ + return { dimensions: { width: this.getGlInstance()?.width, height: this.getGlInstance()?.height, @@ -73,7 +72,7 @@ export default class BrowserPopout extends EventEmitter { content: this.getGlInstance()?.toConfig().content, parentId: this._parentId, indexInParent: this._indexInParent, - } as unknown) as PopoutConfig; + } as unknown as PopoutConfig; } getGlInstance() { diff --git a/packages/golden-layout/src/controls/DragSourceFromEvent.ts b/packages/golden-layout/src/controls/DragSourceFromEvent.ts index f4b63d8b62..5c85384781 100644 --- a/packages/golden-layout/src/controls/DragSourceFromEvent.ts +++ b/packages/golden-layout/src/controls/DragSourceFromEvent.ts @@ -14,7 +14,7 @@ import DragProxy from './DragProxy'; * @param event used to get the starting position */ export default class DragSourceFromEvent { - private _element? = ($(window) as unknown) as JQuery; // we need something to listen for mousemoves against + private _element? = $(window) as unknown as JQuery; // we need something to listen for mousemoves against private _itemConfig?: ItemConfig | (() => ItemConfig); private _layoutManager?: LayoutManager; private _dragListener?: DragListener; diff --git a/packages/golden-layout/src/controls/Header.ts b/packages/golden-layout/src/controls/Header.ts index 145c22e6a9..7406bfd5f9 100644 --- a/packages/golden-layout/src/controls/Header.ts +++ b/packages/golden-layout/src/controls/Header.ts @@ -107,18 +107,14 @@ export default class Header extends EventEmitter { this._handlePreviousMouseEnter = this._handlePreviousMouseEnter.bind(this); this._handlePreviousMouseLeave = this._handlePreviousMouseLeave.bind(this); this._handleScrollRepeat = this._handleScrollRepeat.bind(this); - this._handleNextButtonMouseDown = this._handleNextButtonMouseDown.bind( - this - ); - this._handlePreviousButtonMouseDown = this._handlePreviousButtonMouseDown.bind( - this - ); - this._handleScrollButtonMouseDown = this._handleScrollButtonMouseDown.bind( - this - ); - this._handleScrollButtonMouseUp = this._handleScrollButtonMouseUp.bind( - this - ); + this._handleNextButtonMouseDown = + this._handleNextButtonMouseDown.bind(this); + this._handlePreviousButtonMouseDown = + this._handlePreviousButtonMouseDown.bind(this); + this._handleScrollButtonMouseDown = + this._handleScrollButtonMouseDown.bind(this); + this._handleScrollButtonMouseUp = + this._handleScrollButtonMouseUp.bind(this); this._handleScrollEvent = this._handleScrollEvent.bind(this); this.tabNextButton.on('mousedown', this._handleNextButtonMouseDown); @@ -134,14 +130,13 @@ export default class Header extends EventEmitter { this.tabPreviousButton = this.tabPreviousButton.find('>:first-child'); this.tabPreviousButton.hide(); - this._showAdditionalTabsDropdown = this._showAdditionalTabsDropdown.bind( - this - ); - this._hideAdditionalTabsDropdown = this._hideAdditionalTabsDropdown.bind( - this - ); + this._showAdditionalTabsDropdown = + this._showAdditionalTabsDropdown.bind(this); + this._hideAdditionalTabsDropdown = + this._hideAdditionalTabsDropdown.bind(this); - this._tabControlOffset = this.layoutManager.config.settings?.tabControlOffset; + this._tabControlOffset = + this.layoutManager.config.settings?.tabControlOffset; this._createControls(); } @@ -536,7 +531,7 @@ export default class Header extends EventEmitter { * @returns when exists */ _getHeaderSetting< - N extends 'show' | 'popout' | 'maximise' | 'close' | 'minimise' + N extends 'show' | 'popout' | 'maximise' | 'close' | 'minimise', >(name: N): StackHeaderConfig[N] { if (name in this.parent._header) return this.parent._header[name]; } @@ -559,8 +554,8 @@ export default class Header extends EventEmitter { tabDropdownLabel = this.layoutManager.config.labels.tabDropdown; tabOverflowNextLabel = this.layoutManager.config.labels.tabNextLabel; - tabOverflowPreviousLabel = this.layoutManager.config.labels - .tabPreviousLabel; + tabOverflowPreviousLabel = + this.layoutManager.config.labels.tabPreviousLabel; this.tabDropdownButton = new HeaderButton( this, @@ -807,7 +802,8 @@ export default class Header extends EventEmitter { // position relative to the dropdown button if (!this.tabDropdownButton) return; - const button_rect = this.tabDropdownButton.element[0].getBoundingClientRect(); + const button_rect = + this.tabDropdownButton.element[0].getBoundingClientRect(); // If it fits below button, put it there. If it doesn't and there is more // than 60% space above, then flip to displaying menu above button diff --git a/packages/golden-layout/src/items/AbstractContentItem.ts b/packages/golden-layout/src/items/AbstractContentItem.ts index 5e6774943d..1a0f17e79c 100644 --- a/packages/golden-layout/src/items/AbstractContentItem.ts +++ b/packages/golden-layout/src/items/AbstractContentItem.ts @@ -480,7 +480,7 @@ export default abstract class AbstractContentItem extends EventEmitter { } _callOnActiveComponents(methodName: 'hide' | 'show') { - const stacks = (this.getItemsByType('stack') as unknown) as Stack[]; + const stacks = this.getItemsByType('stack') as unknown as Stack[]; let activeContentItem: AbstractContentItem | null = null; for (let i = 0; i < stacks.length; i++) { diff --git a/packages/golden-layout/src/items/RowOrColumn.ts b/packages/golden-layout/src/items/RowOrColumn.ts index 3e5150b596..6335f30ca4 100644 --- a/packages/golden-layout/src/items/RowOrColumn.ts +++ b/packages/golden-layout/src/items/RowOrColumn.ts @@ -505,9 +505,10 @@ export default class RowOrColumn extends AbstractContentItem { */ _onSplitterDragStart(splitter: Splitter) { const items = this._getItemsForSplitter(splitter); - const minSize = this.layoutManager.config.dimensions[ - this._isColumn ? 'minItemHeight' : 'minItemWidth' - ]; + const minSize = + this.layoutManager.config.dimensions[ + this._isColumn ? 'minItemHeight' : 'minItemWidth' + ]; var beforeMinDim = this._getMinimumDimensions( items.before.config.content ?? [] diff --git a/packages/golden-layout/src/utils/ReactComponentHandler.tsx b/packages/golden-layout/src/utils/ReactComponentHandler.tsx index ede1cdc34f..0cccd3dab3 100644 --- a/packages/golden-layout/src/utils/ReactComponentHandler.tsx +++ b/packages/golden-layout/src/utils/ReactComponentHandler.tsx @@ -133,10 +133,10 @@ export default class ReactComponentHandler { ); } - const reactClass = ((this._container.layoutManager.getComponent( + const reactClass = (this._container.layoutManager.getComponent( componentName ) || - this._container.layoutManager.getFallbackComponent()) as unknown) as React.ComponentClass; + this._container.layoutManager.getFallbackComponent()) as unknown as React.ComponentClass; if (!reactClass) { throw new Error( diff --git a/packages/grid/src/DataBarCellRenderer.ts b/packages/grid/src/DataBarCellRenderer.ts index 0b47b0258a..ff440e8108 100644 --- a/packages/grid/src/DataBarCellRenderer.ts +++ b/packages/grid/src/DataBarCellRenderer.ts @@ -104,10 +104,8 @@ class DataBarCellRenderer extends CellRenderer { } = this.getDataBarRenderMetrics(context, state, column, row); if (this.heightOfDigits === undefined) { - const { - actualBoundingBoxAscent, - actualBoundingBoxDescent, - } = context.measureText('1234567890'); + const { actualBoundingBoxAscent, actualBoundingBoxDescent } = + context.measureText('1234567890'); this.heightOfDigits = actualBoundingBoxAscent + actualBoundingBoxDescent; } @@ -317,11 +315,8 @@ class DataBarCellRenderer extends CellRenderer { modelRows, visibleRows, } = metrics; - const { - cellHorizontalPadding, - treeDepthIndent, - treeHorizontalPadding, - } = theme; + const { cellHorizontalPadding, treeDepthIndent, treeHorizontalPadding } = + theme; const modelColumn = getOrThrow(modelColumns, column); const modelRow = getOrThrow(modelRows, row); diff --git a/packages/grid/src/Grid.test.tsx b/packages/grid/src/Grid.test.tsx index e71341673b..a7806934f5 100644 --- a/packages/grid/src/Grid.test.tsx +++ b/packages/grid/src/Grid.test.tsx @@ -12,7 +12,7 @@ import GridModel from './GridModel'; function makeMockContext(): CanvasRenderingContext2D { // Just return a partial mock - return ({ + return { arc: jest.fn(), beginPath: jest.fn(), clip: jest.fn(), @@ -24,7 +24,7 @@ function makeMockContext(): CanvasRenderingContext2D { fillRect: jest.fn(), fillText: jest.fn(), lineTo: jest.fn(), - measureText: jest.fn(str => ({ width: str.length * 10 } as TextMetrics)), + measureText: jest.fn(str => ({ width: str.length * 10 }) as TextMetrics), moveTo: jest.fn(), rect: jest.fn(), restore: jest.fn(), @@ -35,7 +35,7 @@ function makeMockContext(): CanvasRenderingContext2D { translate: jest.fn(), scale: jest.fn(), createPattern: jest.fn(), - } as unknown) as CanvasRenderingContext2D; + } as unknown as CanvasRenderingContext2D; } // We only use the '2d' mode of getContext. Defining the type in TS is tricky, @@ -87,7 +87,7 @@ function makeGridComponent( createNodeMock, } ); - return (testRenderer.getInstance() as unknown) as Grid; + return testRenderer.getInstance() as unknown as Grid; } function getClientX( @@ -116,7 +116,7 @@ function mouseEvent( clientY = getClientY(row) ) { const mouseArgs = { clientX, clientY, ...extraArgs }; - fn((new MouseEvent(type, mouseArgs) as unknown) as React.MouseEvent); + fn(new MouseEvent(type, mouseArgs) as unknown as React.MouseEvent); } function mouseDown( @@ -149,7 +149,7 @@ function mouseMove( mouseEvent( column, row, - (component.handleMouseDrag as unknown) as React.MouseEventHandler, + component.handleMouseDrag as unknown as React.MouseEventHandler, 'mousemove', extraMouseArgs, clientX, @@ -168,7 +168,7 @@ function mouseUp( mouseEvent( column, row, - (component.handleMouseUp as unknown) as React.MouseEventHandler, + component.handleMouseUp as unknown as React.MouseEventHandler, 'mouseup', extraMouseArgs, clientX, @@ -210,7 +210,7 @@ function mouseDoubleClick( function keyDown(key: string, component: Grid, extraArgs?: KeyboardEventInit) { const args = { key, ...extraArgs }; component.handleKeyDown( - (new KeyboardEvent('keydown', args) as unknown) as React.KeyboardEvent + new KeyboardEvent('keydown', args) as unknown as React.KeyboardEvent ); } diff --git a/packages/grid/src/Grid.tsx b/packages/grid/src/Grid.tsx index b323546f13..bc5338bdc1 100644 --- a/packages/grid/src/Grid.tsx +++ b/packages/grid/src/Grid.tsx @@ -553,12 +553,12 @@ class Grid extends PureComponent { window.removeEventListener( 'mousemove', - (this.handleMouseDrag as unknown) as EventListenerOrEventListenerObject, + this.handleMouseDrag as unknown as EventListenerOrEventListenerObject, true ); window.removeEventListener( 'mouseup', - (this.handleMouseUp as unknown) as EventListenerOrEventListenerObject, + this.handleMouseUp as unknown as EventListenerOrEventListenerObject, true ); window.removeEventListener('resize', this.handleResize); @@ -1057,12 +1057,8 @@ class Grid extends PureComponent { this.setState((state: GridState) => { const { theme } = this.props; const { autoSelectRow } = theme; - const { - selectedRanges, - lastSelectedRanges, - cursorRow, - cursorColumn, - } = state; + const { selectedRanges, lastSelectedRanges, cursorRow, cursorColumn } = + state; if ( selectedRanges.length === 1 && @@ -1191,12 +1187,8 @@ class Grid extends PureComponent { deltaRow: number, extendSelection: boolean ): void { - const { - cursorRow, - cursorColumn, - selectionEndColumn, - selectionEndRow, - } = this.state; + const { cursorRow, cursorColumn, selectionEndColumn, selectionEndRow } = + this.state; const column = extendSelection ? selectionEndColumn : cursorColumn; const row = extendSelection ? selectionEndRow : cursorRow; if (row === null || column === null) { @@ -1297,12 +1289,8 @@ class Grid extends PureComponent { if (!this.metrics) throw new Error('metrics not set'); const { metricCalculator } = this; - const { - bottomVisible, - rightVisible, - topVisible, - leftVisible, - } = this.metrics; + const { bottomVisible, rightVisible, topVisible, leftVisible } = + this.metrics; const metricState = this.getMetricState(this.state); let { top, left, topOffset, leftOffset } = this.state; diff --git a/packages/grid/src/GridMetricCalculator.ts b/packages/grid/src/GridMetricCalculator.ts index bc49d116dd..e9c2a9f950 100644 --- a/packages/grid/src/GridMetricCalculator.ts +++ b/packages/grid/src/GridMetricCalculator.ts @@ -994,11 +994,8 @@ export class GridMetricCalculator { treePaddingX: number = this.calculateTreePaddingX(state) ): SizeMap { const { model } = state; - const { - columnCount, - floatingLeftColumnCount, - floatingRightColumnCount, - } = model; + const { columnCount, floatingLeftColumnCount, floatingRightColumnCount } = + model; const columnWidths = new Map(); for (let i = 0; i < floatingLeftColumnCount && i < columnCount; i += 1) { @@ -1067,11 +1064,8 @@ export class GridMetricCalculator { maxX: Coordinate ): CoordinateMap { const { model } = state; - const { - columnCount, - floatingLeftColumnCount, - floatingRightColumnCount, - } = model; + const { columnCount, floatingLeftColumnCount, floatingRightColumnCount } = + model; return getFloatingCoordinates( floatingLeftColumnCount, diff --git a/packages/grid/src/GridModel.ts b/packages/grid/src/GridModel.ts index 3f0dda5f7e..c52db2e765 100644 --- a/packages/grid/src/GridModel.ts +++ b/packages/grid/src/GridModel.ts @@ -20,7 +20,7 @@ abstract class GridModel< string, Event >, - TMode extends 'standard' | 'strict' = 'standard' + TMode extends 'standard' | 'strict' = 'standard', > extends EventTarget { /** Count of rows in the grid */ abstract get rowCount(): number; diff --git a/packages/grid/src/GridRange.test.ts b/packages/grid/src/GridRange.test.ts index ac9b3fa438..8bfd6903f4 100644 --- a/packages/grid/src/GridRange.test.ts +++ b/packages/grid/src/GridRange.test.ts @@ -14,13 +14,13 @@ describe('contains tests', () => { GridRangeIndex, GridRangeIndex, GridRangeIndex, - GridRangeIndex + GridRangeIndex, ], range2Values: [ GridRangeIndex, GridRangeIndex, GridRangeIndex, - GridRangeIndex + GridRangeIndex, ] ) { const range1 = new GridRange(...range1Values); @@ -56,13 +56,13 @@ describe('touching tests', () => { GridRangeIndex, GridRangeIndex, GridRangeIndex, - GridRangeIndex + GridRangeIndex, ], range2Values: [ GridRangeIndex, GridRangeIndex, GridRangeIndex, - GridRangeIndex + GridRangeIndex, ] ) { const range1 = new GridRange(...range1Values); diff --git a/packages/grid/src/GridRange.ts b/packages/grid/src/GridRange.ts index 0b5675e9b1..8f30a5d1ac 100644 --- a/packages/grid/src/GridRange.ts +++ b/packages/grid/src/GridRange.ts @@ -878,10 +878,8 @@ export class GridRange { direction = GridRange.SELECTION_DIRECTION.RIGHT ): void { let i = 0; - let { - column: c, - row: r, - }: { column?: number; row?: number } = this.startCell(direction); + let { column: c, row: r }: { column?: number; row?: number } = + this.startCell(direction); while (c != null && r != null) { callback(c, r, i); i += 1; diff --git a/packages/grid/src/GridRenderer.test.tsx b/packages/grid/src/GridRenderer.test.tsx index 5d4891ceba..7828327795 100644 --- a/packages/grid/src/GridRenderer.test.tsx +++ b/packages/grid/src/GridRenderer.test.tsx @@ -9,7 +9,7 @@ import { GridRenderState } from './GridRendererTypes'; const makeMockContext = (): CanvasRenderingContext2D => // Just return a partial mock - (({ + ({ arc: jest.fn(), beginPath: jest.fn(), clip: jest.fn(), @@ -21,7 +21,7 @@ const makeMockContext = (): CanvasRenderingContext2D => fillRect: jest.fn(), fillText: jest.fn(), lineTo: jest.fn(), - measureText: jest.fn(str => ({ width: str.length * 10 } as TextMetrics)), + measureText: jest.fn(str => ({ width: str.length * 10 }) as TextMetrics), moveTo: jest.fn(), rect: jest.fn(), restore: jest.fn(), @@ -32,7 +32,7 @@ const makeMockContext = (): CanvasRenderingContext2D => translate: jest.fn(), scale: jest.fn(), createPattern: jest.fn(), - } as unknown) as CanvasRenderingContext2D); + }) as unknown as CanvasRenderingContext2D; const makeMockGridMetrics = (): GridMetrics => ({ @@ -66,7 +66,7 @@ const makeMockGridMetrics = (): GridMetrics => [1, 10], [2, 10], ]), - } as GridMetrics); + }) as GridMetrics; const makeMockGridRenderState = ({ metrics = makeMockGridMetrics(), diff --git a/packages/grid/src/GridRenderer.ts b/packages/grid/src/GridRenderer.ts index 38b142ea9e..848560eb91 100644 --- a/packages/grid/src/GridRenderer.ts +++ b/packages/grid/src/GridRenderer.ts @@ -1823,14 +1823,8 @@ export class GridRenderer { context: CanvasRenderingContext2D, state: GridRenderState ): void { - const { - mouseX, - mouseY, - metrics, - model, - theme, - draggingRowSeparator, - } = state; + const { mouseX, mouseY, metrics, model, theme, draggingRowSeparator } = + state; const { gridY, gridX, @@ -2226,10 +2220,8 @@ export class GridRenderer { return; } - const { - range: draggingColumnVisibleRange, - depth: draggingColumnDepth, - } = draggingColumn; + const { range: draggingColumnVisibleRange, depth: draggingColumnDepth } = + draggingColumn; const { gridX, diff --git a/packages/grid/src/GridUtils.test.ts b/packages/grid/src/GridUtils.test.ts index 577c898bdc..2fb2dd46db 100644 --- a/packages/grid/src/GridUtils.test.ts +++ b/packages/grid/src/GridUtils.test.ts @@ -30,7 +30,7 @@ const makeMockGridMetrics = (): GridMetrics => height: 500, verticalBarWidth: 20, horizontalBarHeight: 20, - } as GridMetrics); + }) as GridMetrics; describe('move items', () => { it('returns the proper model/visible index when one column is moved', () => { diff --git a/packages/grid/src/GridUtils.ts b/packages/grid/src/GridUtils.ts index 46eb59b3ae..47511a31b5 100644 --- a/packages/grid/src/GridUtils.ts +++ b/packages/grid/src/GridUtils.ts @@ -601,11 +601,8 @@ export class GridUtils { return false; } - const { - floatingLeftColumnCount, - floatingRightColumnCount, - columnCount, - } = metrics; + const { floatingLeftColumnCount, floatingRightColumnCount, columnCount } = + metrics; return ( column < floatingLeftColumnCount || column >= columnCount - floatingRightColumnCount @@ -928,22 +925,20 @@ export class GridUtils { ] ) .filter(([s, e]) => s <= e) // Remove invalid ranges - .map( - (range): Range => { - const [s, e] = range; - if (fromStart <= s && fromEnd >= e) { - // Current range in moved range - movedRange = [s + moveDistance, e + moveDistance]; - return movedRange; - } - - if (fromEnd < s) { - // Current range is after moved range - return [s - length, e - length]; - } - return range; + .map((range): Range => { + const [s, e] = range; + if (fromStart <= s && fromEnd >= e) { + // Current range in moved range + movedRange = [s + moveDistance, e + moveDistance]; + return movedRange; } - ) + + if (fromEnd < s) { + // Current range is after moved range + return [s - length, e - length]; + } + return range; + }) .map((range): Range[] => { const [s, e] = range; if (toStart > s && toStart <= e) { @@ -1472,11 +1467,8 @@ export class GridUtils { modelRows, modelColumns, } = metrics; - const { - cellHorizontalPadding, - treeDepthIndent, - treeHorizontalPadding, - } = theme; + const { cellHorizontalPadding, treeDepthIndent, treeHorizontalPadding } = + theme; const modelRow = getOrThrow(modelRows, row); const modelColumn = getOrThrow(modelColumns, column); diff --git a/packages/grid/src/README.md b/packages/grid/src/README.md index f612e9981c..ff906c8975 100644 --- a/packages/grid/src/README.md +++ b/packages/grid/src/README.md @@ -1,5 +1,7 @@ # Grid Component + Some ad-hoc documentation about overall design of the grid ## Floating Rows/Columns -With the grid you can add "floating" rows or columns to the start or end of the grid. A floating (eg. pinned, frozen) row/column is always visible, no matter where you scroll. \ No newline at end of file + +With the grid you can add "floating" rows or columns to the start or end of the grid. A floating (eg. pinned, frozen) row/column is always visible, no matter where you scroll. diff --git a/packages/grid/src/TextCellRenderer.ts b/packages/grid/src/TextCellRenderer.ts index 685d237dba..ac7515f1cc 100644 --- a/packages/grid/src/TextCellRenderer.ts +++ b/packages/grid/src/TextCellRenderer.ts @@ -16,13 +16,8 @@ class TextCellRenderer extends CellRenderer implements TokenBoxCellRenderer { row: VisibleIndex ): void { const { metrics, model, theme } = state; - const { - fontWidths, - modelColumns, - modelRows, - allRowHeights, - firstColumn, - } = metrics; + const { fontWidths, modelColumns, modelRows, allRowHeights, firstColumn } = + metrics; const isFirstColumn = column === firstColumn; const { textColor } = theme; const rowHeight = getOrThrow(allRowHeights, row); @@ -126,7 +121,7 @@ class TextCellRenderer extends CellRenderer implements TokenBoxCellRenderer { const { metrics, context, model, theme } = state; if (context == null || metrics == null) { - return (EMPTY_ARRAY as unknown) as TokenBox[]; + return EMPTY_ARRAY as unknown as TokenBox[]; } const { modelRows, modelColumns } = metrics; @@ -156,10 +151,8 @@ class TextCellRenderer extends CellRenderer implements TokenBoxCellRenderer { truncationChar ); - const { - actualBoundingBoxAscent, - actualBoundingBoxDescent, - } = context.measureText(truncatedText); + const { actualBoundingBoxAscent, actualBoundingBoxDescent } = + context.measureText(truncatedText); const textHeight = actualBoundingBoxAscent + actualBoundingBoxDescent; const tokens = model.tokensForCell( @@ -171,7 +164,7 @@ class TextCellRenderer extends CellRenderer implements TokenBoxCellRenderer { // Check if the truncated text contains a link if (tokens.length === 0) { context.restore(); - return (EMPTY_ARRAY as unknown) as TokenBox[]; + return EMPTY_ARRAY as unknown as TokenBox[]; } const cachedTokenBoxes = this.getCachedTokenBoxesForVisibleCell( diff --git a/packages/grid/src/ThemeContext.ts b/packages/grid/src/ThemeContext.ts index d6d82352b8..5fb3e3cd2e 100644 --- a/packages/grid/src/ThemeContext.ts +++ b/packages/grid/src/ThemeContext.ts @@ -1,8 +1,7 @@ import React from 'react'; import { GridTheme as GridThemeType } from './GridTheme'; -export const ThemeContext: React.Context< - Partial -> = React.createContext({}); +export const ThemeContext: React.Context> = + React.createContext({}); export default ThemeContext; diff --git a/packages/grid/src/key-handlers/SelectionKeyHandler.ts b/packages/grid/src/key-handlers/SelectionKeyHandler.ts index 9a9026a43f..20ae726f13 100644 --- a/packages/grid/src/key-handlers/SelectionKeyHandler.ts +++ b/packages/grid/src/key-handlers/SelectionKeyHandler.ts @@ -140,12 +140,8 @@ class SelectionKeyHandler extends KeyHandler { grid.clearSelectedRanges(); } - const { - cursorRow, - cursorColumn, - selectionEndColumn, - selectionEndRow, - } = grid.state; + const { cursorRow, cursorColumn, selectionEndColumn, selectionEndRow } = + grid.state; const column = isShiftKey ? selectionEndColumn : cursorColumn; const row = isShiftKey ? selectionEndRow : cursorRow; if (isModifierKey) { @@ -223,11 +219,8 @@ class SelectionKeyHandler extends KeyHandler { } const metricState = grid.getMetricState(); const { metricCalculator } = grid; - const { - bottomVisible, - topVisible, - hasHorizontalBar, - } = metricCalculator.getMetrics(metricState); + const { bottomVisible, topVisible, hasHorizontalBar } = + metricCalculator.getMetrics(metricState); let selectRangeEndPosition = row - (bottomVisible - topVisible); selectRangeEndPosition -= hasHorizontalBar ? 0 : 1; @@ -266,13 +259,8 @@ class SelectionKeyHandler extends KeyHandler { } const metricState = grid.getMetricState(); const { metricCalculator } = grid; - const { - bottomVisible, - topVisible, - hasHorizontalBar, - rowCount, - lastTop, - } = metricCalculator.getMetrics(metricState); + const { bottomVisible, topVisible, hasHorizontalBar, rowCount, lastTop } = + metricCalculator.getMetrics(metricState); const lastRowIndex = rowCount - 1; let selectRangeEndPosition = bottomVisible - topVisible + row; diff --git a/packages/grid/src/mouse-handlers/GridColumnMoveMouseHandler.ts b/packages/grid/src/mouse-handlers/GridColumnMoveMouseHandler.ts index 094f4b86d4..e9d6300e4a 100644 --- a/packages/grid/src/mouse-handlers/GridColumnMoveMouseHandler.ts +++ b/packages/grid/src/mouse-handlers/GridColumnMoveMouseHandler.ts @@ -85,9 +85,8 @@ function getColumnInfo( let range: BoundedAxisRange; if (group != null) { - const [startVisibleIndex, endVisibleIndex] = group.getVisibleRange( - movedColumns - ); + const [startVisibleIndex, endVisibleIndex] = + group.getVisibleRange(movedColumns); left = allColumnXs.get(startVisibleIndex) ?? floatingLeftWidth; right = @@ -414,12 +413,8 @@ class GridColumnMoveMouseHandler extends GridMouseHandler { const { metrics } = grid; if (!metrics) throw new Error('Metrics not set'); - const { - floatingLeftWidth, - width, - columnHeaderMaxDepth, - allColumnXs, - } = metrics; + const { floatingLeftWidth, width, columnHeaderMaxDepth, allColumnXs } = + metrics; const isDraggingLeft = deltaX < 0; diff --git a/packages/grid/src/mouse-handlers/GridHorizontalScrollBarMouseHandler.ts b/packages/grid/src/mouse-handlers/GridHorizontalScrollBarMouseHandler.ts index ec28e29ea4..3403fba188 100644 --- a/packages/grid/src/mouse-handlers/GridHorizontalScrollBarMouseHandler.ts +++ b/packages/grid/src/mouse-handlers/GridHorizontalScrollBarMouseHandler.ts @@ -116,10 +116,8 @@ class GridHorizontalScrollBarMouseHandler extends GridMouseHandler { } else { this.dragOffset = 0; - const { - left: newLeft, - leftOffset: newLeftOffset, - } = this.getLeftWithOffset(gridPoint, grid); + const { left: newLeft, leftOffset: newLeftOffset } = + this.getLeftWithOffset(gridPoint, grid); grid.setViewState({ left: newLeft, @@ -134,10 +132,8 @@ class GridHorizontalScrollBarMouseHandler extends GridMouseHandler { onDrag(gridPoint: GridPoint, grid: Grid): EventHandlerResult { if (this.dragOffset != null) { - const { - left: newLeft, - leftOffset: newLeftOffset, - } = this.getLeftWithOffset(gridPoint, grid); + const { left: newLeft, leftOffset: newLeftOffset } = + this.getLeftWithOffset(gridPoint, grid); grid.setViewState({ left: newLeft, diff --git a/packages/grid/src/mouse-handlers/GridSeparatorMouseHandler.ts b/packages/grid/src/mouse-handlers/GridSeparatorMouseHandler.ts index 906fb9fb28..7074520131 100644 --- a/packages/grid/src/mouse-handlers/GridSeparatorMouseHandler.ts +++ b/packages/grid/src/mouse-handlers/GridSeparatorMouseHandler.ts @@ -165,9 +165,8 @@ abstract class GridSeparatorMouseHandler extends GridMouseHandler { const newSizes: Map = new Map(); // Use a loop as we may need to resize multiple items if they drag quickly - let resizeIndex: number | null = this.resizingItems[ - this.resizingItems.length - 1 - ]; + let resizeIndex: number | null = + this.resizingItems[this.resizingItems.length - 1]; while (resizeIndex != null) { const itemOffset = getOrThrow(visibleOffsets, resizeIndex); const itemSize = point - margin - itemOffset - this.dragOffset; @@ -280,9 +279,8 @@ abstract class GridSeparatorMouseHandler extends GridMouseHandler { metrics[this.calculatedSizesProperty], modelIndex ); - const defaultSize = metricCalculator[this.initialSizesProperty].get( - modelIndex - ); + const defaultSize = + metricCalculator[this.initialSizesProperty].get(modelIndex); if (calculatedSize === defaultSize) { this.resetSize(metricCalculator, modelIndex); diff --git a/packages/iris-grid/src/AdvancedFilterCreator.tsx b/packages/iris-grid/src/AdvancedFilterCreator.tsx index 850f2fbb7e..86ee436ac4 100644 --- a/packages/iris-grid/src/AdvancedFilterCreator.tsx +++ b/packages/iris-grid/src/AdvancedFilterCreator.tsx @@ -108,9 +108,8 @@ class AdvancedFilterCreator extends PureComponent< this.handleAddAnd = this.handleAddAnd.bind(this); this.handleAddOr = this.handleAddOr.bind(this); - this.handleChangeFilterOperator = this.handleChangeFilterOperator.bind( - this - ); + this.handleChangeFilterOperator = + this.handleChangeFilterOperator.bind(this); this.handleDone = this.handleDone.bind(this); this.handleFilterChange = this.handleFilterChange.bind(this); this.handleFilterDelete = this.handleFilterDelete.bind(this); @@ -231,9 +230,11 @@ class AdvancedFilterCreator extends PureComponent< } handleFocusTrapEnd(): void { - (this.focusTrapContainer?.current?.querySelector( - 'button,select,input,textarea' - ) as HTMLElement).focus(); + ( + this.focusTrapContainer?.current?.querySelector( + 'button,select,input,textarea' + ) as HTMLElement + ).focus(); } handleFocusTrapStart(): void { @@ -420,12 +421,8 @@ class AdvancedFilterCreator extends PureComponent< } sendUpdate(): void { - const { - filterItems, - filterOperators, - invertSelection, - selectedValues, - } = this.state; + const { filterItems, filterOperators, invertSelection, selectedValues } = + this.state; const { column, onFilterChange, model, tableUtils } = this.props; const { formatter } = model; diff --git a/packages/iris-grid/src/AdvancedFilterCreatorFilterItem.scss b/packages/iris-grid/src/AdvancedFilterCreatorFilterItem.scss index e732b22cb3..a555e6c089 100644 --- a/packages/iris-grid/src/AdvancedFilterCreatorFilterItem.scss +++ b/packages/iris-grid/src/AdvancedFilterCreatorFilterItem.scss @@ -4,7 +4,9 @@ input.error { color: $danger; &:focus { - box-shadow: inset 0 0 0 2px $danger, $input-focus-box-shadow; + box-shadow: + inset 0 0 0 2px $danger, + $input-focus-box-shadow; } } } diff --git a/packages/iris-grid/src/FilterInputField.scss b/packages/iris-grid/src/FilterInputField.scss index 2c81071289..828eba5bf6 100644 --- a/packages/iris-grid/src/FilterInputField.scss +++ b/packages/iris-grid/src/FilterInputField.scss @@ -58,7 +58,9 @@ &.error { color: $danger; &:focus { - box-shadow: inset 0 0 0 2px $danger, $input-focus-box-shadow; + box-shadow: + inset 0 0 0 2px $danger, + $input-focus-box-shadow; } } } diff --git a/packages/iris-grid/src/GotoRow.test.tsx b/packages/iris-grid/src/GotoRow.test.tsx index 87a633a388..7724a96eaf 100644 --- a/packages/iris-grid/src/GotoRow.test.tsx +++ b/packages/iris-grid/src/GotoRow.test.tsx @@ -154,7 +154,8 @@ describe('Go to value', () => { const user = userEvent.setup({ delay: null }); const onGotoValueSelectedColumnNameChangedMock = jest.fn(); const component = makeGotoRow({ - onGotoValueSelectedColumnNameChanged: onGotoValueSelectedColumnNameChangedMock, + onGotoValueSelectedColumnNameChanged: + onGotoValueSelectedColumnNameChangedMock, }); const inputElement = screen.getByLabelText('column-name-select'); diff --git a/packages/iris-grid/src/IrisGrid.scss b/packages/iris-grid/src/IrisGrid.scss index c63e93de28..652f3bbd43 100644 --- a/packages/iris-grid/src/IrisGrid.scss +++ b/packages/iris-grid/src/IrisGrid.scss @@ -2,7 +2,9 @@ @import './IrisGridTheme.module.scss'; $iris-grid-bg: $content-bg; -$iris-grid-font: 12px fira sans, sans-serif; +$iris-grid-font: + 12px fira sans, + sans-serif; $table-sidebar-max-width: 320px; $table-sidebar-bg: $gray-700; $iris-grid-bar-bg: $primary-dark; @@ -10,9 +12,12 @@ $iris-grid-bar-bg-highlight: $primary; $iris-grid-bar-max-height: 250px; $iris-grid-bar-max-width: $table-sidebar-max-width; $transition-iris-grid-bar-flash: 1s; -$cell-box-shadow: 0 0 0 2px $selection-outline-color, +$cell-box-shadow: + 0 0 0 2px $selection-outline-color, 0 0 0 5px rgba($selection-outline-color, 0.25); -$cell-invalid-box-shadow: 0 0 0 2px $danger, 0 0 0 5px rgba($danger, 0.25); +$cell-invalid-box-shadow: + 0 0 0 2px $danger, + 0 0 0 5px rgba($danger, 0.25); .iris-grid { width: 100%; @@ -92,7 +97,8 @@ $cell-invalid-box-shadow: 0 0 0 2px $danger, 0 0 0 5px rgba($danger, 0.25); width: $header-height; background-color: $header-bg; border-bottom: 1px solid $header-separator-color; - transition: transform $transition-mid ease-out, + transition: + transform $transition-mid ease-out, opacity $transition-mid ease-out; .btn { @@ -291,7 +297,8 @@ $cell-invalid-box-shadow: 0 0 0 2px $danger, 0 0 0 5px rgba($danger, 0.25); max-height: 0; } &.iris-grid-bar-horizontal-enter-active { - transition: background-color $transition-iris-grid-bar-flash ease-in, + transition: + background-color $transition-iris-grid-bar-flash ease-in, max-height $transition ease-in; max-height: $iris-grid-bar-max-height; } @@ -311,7 +318,8 @@ $cell-invalid-box-shadow: 0 0 0 2px $danger, 0 0 0 5px rgba($danger, 0.25); max-width: 0; } &.iris-grid-bar-vertical-enter-active { - transition: background-color $transition-iris-grid-bar-flash ease-in, + transition: + background-color $transition-iris-grid-bar-flash ease-in, max-width $transition ease-in; max-width: $iris-grid-bar-max-width; } diff --git a/packages/iris-grid/src/IrisGrid.test.tsx b/packages/iris-grid/src/IrisGrid.test.tsx index bf4844ec47..ea9a58ac6f 100644 --- a/packages/iris-grid/src/IrisGrid.test.tsx +++ b/packages/iris-grid/src/IrisGrid.test.tsx @@ -11,7 +11,7 @@ class MockPath2D { addPath = jest.fn(); } -window.Path2D = (MockPath2D as unknown) as new () => Path2D; +window.Path2D = MockPath2D as unknown as new () => Path2D; const VIEW_SIZE = 5000; diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index 273612cefa..a06b258c27 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -513,12 +513,10 @@ export class IrisGrid extends Component { constructor(props: IrisGridProps) { super(props); - this.handleAdvancedFilterChange = this.handleAdvancedFilterChange.bind( - this - ); - this.handleAdvancedFilterSortChange = this.handleAdvancedFilterSortChange.bind( - this - ); + this.handleAdvancedFilterChange = + this.handleAdvancedFilterChange.bind(this); + this.handleAdvancedFilterSortChange = + this.handleAdvancedFilterSortChange.bind(this); this.handleAdvancedFilterDone = this.handleAdvancedFilterDone.bind(this); this.handleAdvancedMenuOpened = this.handleAdvancedMenuOpened.bind(this); this.handleGotoRowOpened = this.handleGotoRowOpened.bind(this); @@ -549,38 +547,28 @@ export class IrisGrid extends Component { this.handleTooltipRef = this.handleTooltipRef.bind(this); this.handleViewChanged = this.handleViewChanged.bind(this); this.handleFormatSelection = this.handleFormatSelection.bind(this); - this.handleConditionalFormatCreate = this.handleConditionalFormatCreate.bind( - this - ); - this.handleConditionalFormatEdit = this.handleConditionalFormatEdit.bind( - this - ); - this.handleConditionalFormatsChange = this.handleConditionalFormatsChange.bind( - this - ); - this.handleConditionalFormatEditorSave = this.handleConditionalFormatEditorSave.bind( - this - ); - this.handleConditionalFormatEditorCancel = this.handleConditionalFormatEditorCancel.bind( - this - ); + this.handleConditionalFormatCreate = + this.handleConditionalFormatCreate.bind(this); + this.handleConditionalFormatEdit = + this.handleConditionalFormatEdit.bind(this); + this.handleConditionalFormatsChange = + this.handleConditionalFormatsChange.bind(this); + this.handleConditionalFormatEditorSave = + this.handleConditionalFormatEditorSave.bind(this); + this.handleConditionalFormatEditorCancel = + this.handleConditionalFormatEditorCancel.bind(this); this.handleUpdateCustomColumns = this.handleUpdateCustomColumns.bind(this); - this.handleCustomColumnsChanged = this.handleCustomColumnsChanged.bind( - this - ); - this.handleSelectDistinctChanged = this.handleSelectDistinctChanged.bind( - this - ); + this.handleCustomColumnsChanged = + this.handleCustomColumnsChanged.bind(this); + this.handleSelectDistinctChanged = + this.handleSelectDistinctChanged.bind(this); this.handlePendingDataUpdated = this.handlePendingDataUpdated.bind(this); - this.handlePendingCommitClicked = this.handlePendingCommitClicked.bind( - this - ); - this.handlePendingDiscardClicked = this.handlePendingDiscardClicked.bind( - this - ); - this.handleGotoRowSelectedRowNumberSubmit = this.handleGotoRowSelectedRowNumberSubmit.bind( - this - ); + this.handlePendingCommitClicked = + this.handlePendingCommitClicked.bind(this); + this.handlePendingDiscardClicked = + this.handlePendingDiscardClicked.bind(this); + this.handleGotoRowSelectedRowNumberSubmit = + this.handleGotoRowSelectedRowNumberSubmit.bind(this); this.focusRowInGrid = this.focusRowInGrid.bind(this); this.handleDownloadTable = this.handleDownloadTable.bind(this); this.handleDownloadTableStart = this.handleDownloadTableStart.bind(this); @@ -591,25 +579,20 @@ export class IrisGrid extends Component { this.handlePartitionChange = this.handlePartitionChange.bind(this); this.handlePartitionFetchAll = this.handlePartitionFetchAll.bind(this); this.handlePartitionDone = this.handlePartitionDone.bind(this); - this.handleColumnVisibilityChanged = this.handleColumnVisibilityChanged.bind( - this - ); - this.handleColumnVisibilityReset = this.handleColumnVisibilityReset.bind( - this - ); + this.handleColumnVisibilityChanged = + this.handleColumnVisibilityChanged.bind(this); + this.handleColumnVisibilityReset = + this.handleColumnVisibilityReset.bind(this); this.handleCrossColumnSearch = this.handleCrossColumnSearch.bind(this); this.handleRollupChange = this.handleRollupChange.bind(this); this.handleOverflowClose = this.handleOverflowClose.bind(this); this.getColumnBoundingRect = this.getColumnBoundingRect.bind(this); - this.handleGotoRowSelectedRowNumberChanged = this.handleGotoRowSelectedRowNumberChanged.bind( - this - ); - this.handleGotoValueSelectedColumnNameChanged = this.handleGotoValueSelectedColumnNameChanged.bind( - this - ); - this.handleGotoValueSelectedFilterChanged = this.handleGotoValueSelectedFilterChanged.bind( - this - ); + this.handleGotoRowSelectedRowNumberChanged = + this.handleGotoRowSelectedRowNumberChanged.bind(this); + this.handleGotoValueSelectedColumnNameChanged = + this.handleGotoValueSelectedColumnNameChanged.bind(this); + this.handleGotoValueSelectedFilterChanged = + this.handleGotoValueSelectedFilterChanged.bind(this); this.handleGotoValueChanged = this.handleGotoValueChanged.bind(this); this.handleGotoValueSubmitted = this.handleGotoValueSubmitted.bind(this); @@ -1734,9 +1717,8 @@ export class IrisGrid extends Component { updateFormatterSettings(settings?: Settings, forceUpdate = true): void { const globalColumnFormats = FormatterUtils.getColumnFormats(settings); - const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions( - settings - ); + const dateTimeFormatterOptions = + FormatterUtils.getDateTimeFormatterOptions(settings); const defaultDecimalFormatOptions = settings?.defaultDecimalFormatOptions ?? {}; @@ -2249,9 +2231,8 @@ export class IrisGrid extends Component { assertNotNull(metrics); if (isVisible) { modelIndexes.forEach(modelIndex => { - const defaultWidth = metricCalculator.initialColumnWidths.get( - modelIndex - ); + const defaultWidth = + metricCalculator.initialColumnWidths.get(modelIndex); const calculatedWidth = getOrThrow( metrics.calculatedColumnWidths, modelIndex @@ -2582,9 +2563,8 @@ export class IrisGrid extends Component { throw new Error('Save already in progress'); } - const containsGridCellInputField = document?.activeElement?.classList.contains( - 'grid-cell-input-field' - ); + const containsGridCellInputField = + document?.activeElement?.classList.contains('grid-cell-input-field'); if (containsGridCellInputField != null && containsGridCellInputField) { if ( document.activeElement != null && @@ -3083,10 +3063,11 @@ export class IrisGrid extends Component { movedColumns, removedColumnNames ); - const newSelectDistinctColumns = IrisGridUtils.removeColumnsFromSelectDistinctColumns( - selectDistinctColumns, - removedColumnNames - ); + const newSelectDistinctColumns = + IrisGridUtils.removeColumnsFromSelectDistinctColumns( + selectDistinctColumns, + removedColumnNames + ); if (newSorts.length !== sorts.length) { log.debug('removing sorts from removed custom columns...'); this.setState({ sorts: newSorts }); @@ -4100,13 +4081,8 @@ export class IrisGrid extends Component { const filterBar = []; if (metrics && isFilterBarShown) { - const { - gridX, - gridY, - visibleColumns, - allColumnXs, - allColumnWidths, - } = metrics; + const { gridX, gridY, visibleColumns, allColumnXs, allColumnWidths } = + metrics; const { filterBarHeight } = theme; for (let i = 0; i < visibleColumns.length; i += 1) { diff --git a/packages/iris-grid/src/IrisGridModel.test.ts b/packages/iris-grid/src/IrisGridModel.test.ts index 6946cd2f51..99da0da325 100644 --- a/packages/iris-grid/src/IrisGridModel.test.ts +++ b/packages/iris-grid/src/IrisGridModel.test.ts @@ -131,7 +131,7 @@ it('updates the model correctly when adding and removing a rollup config', async const rollupConfig = irisGridTestUtils.makeRollupTableConfig(); const mock = jest.fn(() => - Promise.resolve((rollupTable as unknown) as TreeTable) + Promise.resolve(rollupTable as unknown as TreeTable) ); table.rollup = mock; diff --git a/packages/iris-grid/src/IrisGridModel.ts b/packages/iris-grid/src/IrisGridModel.ts index d96065af87..868ff7fdb5 100644 --- a/packages/iris-grid/src/IrisGridModel.ts +++ b/packages/iris-grid/src/IrisGridModel.ts @@ -30,7 +30,8 @@ import { } from './CommonTypes'; import ColumnHeaderGroup from './ColumnHeaderGroup'; -type IrisGridModelEventNames = typeof IrisGridModel.EVENT[keyof typeof IrisGridModel.EVENT]; +type IrisGridModelEventNames = + (typeof IrisGridModel.EVENT)[keyof typeof IrisGridModel.EVENT]; type IrisGridModelEventMap = { [E in IrisGridModelEventNames]: Event; @@ -50,7 +51,7 @@ abstract class IrisGridModel< string, Event >, - TMode extends 'standard' | 'strict' = 'standard' + TMode extends 'standard' | 'strict' = 'standard', > extends GridModel { static EVENT = Object.freeze({ UPDATED: 'UPDATED', diff --git a/packages/iris-grid/src/IrisGridPartitionSelector.tsx b/packages/iris-grid/src/IrisGridPartitionSelector.tsx index b566e7dadb..9c5761aed8 100644 --- a/packages/iris-grid/src/IrisGridPartitionSelector.tsx +++ b/packages/iris-grid/src/IrisGridPartitionSelector.tsx @@ -46,9 +46,8 @@ class IrisGridPartitionSelector extends Component< this.handleIgnoreClick = this.handleIgnoreClick.bind(this); this.handlePartitionChange = this.handlePartitionChange.bind(this); this.handlePartitionSelect = this.handlePartitionSelect.bind(this); - this.handlePartitionListResized = this.handlePartitionListResized.bind( - this - ); + this.handlePartitionListResized = + this.handlePartitionListResized.bind(this); this.handleSearchOpened = this.handleSearchOpened.bind(this); this.handleSearchClosed = this.handleSearchClosed.bind(this); diff --git a/packages/iris-grid/src/IrisGridRenderer.ts b/packages/iris-grid/src/IrisGridRenderer.ts index 9dcb1b3ebc..5a2c0eac55 100644 --- a/packages/iris-grid/src/IrisGridRenderer.ts +++ b/packages/iris-grid/src/IrisGridRenderer.ts @@ -726,14 +726,8 @@ class IrisGridRenderer extends GridRenderer { return; } - const { - gridX, - gridY, - maxX, - visibleColumns, - allColumnWidths, - allColumnXs, - } = metrics; + const { gridX, gridY, maxX, visibleColumns, allColumnWidths, allColumnXs } = + metrics; const columnHeaderHeight = gridY - filterBarCollapsedHeight; context.save(); diff --git a/packages/iris-grid/src/IrisGridTableModelTemplate.ts b/packages/iris-grid/src/IrisGridTableModelTemplate.ts index 223caf406d..5e7f021952 100644 --- a/packages/iris-grid/src/IrisGridTableModelTemplate.ts +++ b/packages/iris-grid/src/IrisGridTableModelTemplate.ts @@ -73,7 +73,7 @@ export function isIrisGridTableModelTemplate( class IrisGridTableModelTemplate< T extends TableTemplate = Table, - R extends UIRow = UIRow + R extends UIRow = UIRow, > extends IrisGridModel { static ROW_BUFFER_PAGES = 1; @@ -213,9 +213,8 @@ class IrisGridTableModelTemplate< this.handleTableUpdate = this.handleTableUpdate.bind(this); this.handleTotalsUpdate = this.handleTotalsUpdate.bind(this); this.handleRequestFailed = this.handleRequestFailed.bind(this); - this.handleCustomColumnsChanged = this.handleCustomColumnsChanged.bind( - this - ); + this.handleCustomColumnsChanged = + this.handleCustomColumnsChanged.bind(this); this.dh = dh; this.irisFormatter = formatter; @@ -1077,10 +1076,8 @@ class IrisGridTableModelTemplate< const operationMap = this.totals?.operationMap; for (let c = 0; c < columns.length; c += 1) { const column = columns[c]; - const [ - name, - operation = operationMap?.[name]?.[0] ?? defaultOperation, - ] = column.name.split('__'); + const [name, operation = operationMap?.[name]?.[0] ?? defaultOperation] = + column.name.split('__'); if (!dataMap.has(operation)) { dataMap.set(operation, { data: new Map() }); } @@ -1521,19 +1518,18 @@ class IrisGridTableModelTemplate< { max: 10000 } ); - getCachedViewportRowRange = memoize((top: number, bottom: number): [ - number, - number - ] => { - const viewHeight = bottom - top; - const viewportTop = Math.max( - 0, - top - viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES - ); - const viewportBottom = - bottom + viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES; - return [viewportTop, viewportBottom]; - }); + getCachedViewportRowRange = memoize( + (top: number, bottom: number): [number, number] => { + const viewHeight = bottom - top; + const viewportTop = Math.max( + 0, + top - viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES + ); + const viewportBottom = + bottom + viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES; + return [viewportTop, viewportBottom]; + } + ); getCachedPendingErrors = memoize( ( diff --git a/packages/iris-grid/src/IrisGridTheme.module.scss b/packages/iris-grid/src/IrisGridTheme.module.scss index 54781e9aea..7b54744d8e 100644 --- a/packages/iris-grid/src/IrisGridTheme.module.scss +++ b/packages/iris-grid/src/IrisGridTheme.module.scss @@ -13,7 +13,9 @@ $header-height: 30px; :export { grid-bg: $gray-900; - font: $font-size Fira Sans, sans-serif; // must be preloaded + font: + $font-size Fira Sans, + sans-serif; // must be preloaded white: $white; black: $black; header-bg: $header-bg; @@ -25,7 +27,9 @@ $header-height: 30px; header-sort-bar-color: $purple; header-reverse-bar-color: $green-dark; header-bar-casing-color: $gray-900; - header-font: 600 $font-size Fira Sans, sans-serif; // must be preloaded + header-font: + 600 $font-size Fira Sans, + sans-serif; // must be preloaded row-height: $row-height; row-background-colors: $gray-800 $content-bg; selection-color: $selection-color; diff --git a/packages/iris-grid/src/IrisGridTreeTableModel.ts b/packages/iris-grid/src/IrisGridTreeTableModel.ts index 75f02a6681..555cf140c8 100644 --- a/packages/iris-grid/src/IrisGridTreeTableModel.ts +++ b/packages/iris-grid/src/IrisGridTreeTableModel.ts @@ -78,9 +78,8 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate< for (let r = intersection.startRow; r <= intersection.endRow; r += 1) { const resultRow = []; - const viewportRow = this.viewportData.rows[ - r - this.viewportData.offset - ]; + const viewportRow = + this.viewportData.rows[r - this.viewportData.offset]; assertNotNull(intersection.startColumn); assertNotNull(intersection.endColumn); for ( diff --git a/packages/iris-grid/src/IrisGridUtils.test.ts b/packages/iris-grid/src/IrisGridUtils.test.ts index 74984686dd..558bda527c 100644 --- a/packages/iris-grid/src/IrisGridUtils.test.ts +++ b/packages/iris-grid/src/IrisGridUtils.test.ts @@ -398,13 +398,13 @@ describe('getPrevVisibleColumns', () => { }); it('skips hidden columns', () => { - expect( - IrisGridUtils.getPrevVisibleColumns(columns, 2, 2, [], [1]) - ).toEqual([makeColumn(0), makeColumn(2)]); + expect(IrisGridUtils.getPrevVisibleColumns(columns, 2, 2, [], [1])).toEqual( + [makeColumn(0), makeColumn(2)] + ); - expect( - IrisGridUtils.getPrevVisibleColumns(columns, 3, 5, [], [1]) - ).toEqual([makeColumn(0), makeColumn(2), makeColumn(3)]); + expect(IrisGridUtils.getPrevVisibleColumns(columns, 3, 5, [], [1])).toEqual( + [makeColumn(0), makeColumn(2), makeColumn(3)] + ); }); }); @@ -423,13 +423,13 @@ describe('getNextVisibleColumns', () => { }); it('skips hidden columns 2', () => { - expect( - IrisGridUtils.getNextVisibleColumns(columns, 1, 2, [], [2]) - ).toEqual([makeColumn(1), makeColumn(3)]); + expect(IrisGridUtils.getNextVisibleColumns(columns, 1, 2, [], [2])).toEqual( + [makeColumn(1), makeColumn(3)] + ); - expect( - IrisGridUtils.getNextVisibleColumns(columns, 1, 5, [], [2]) - ).toEqual([makeColumn(1), makeColumn(3), makeColumn(4)]); + expect(IrisGridUtils.getNextVisibleColumns(columns, 1, 5, [], [2])).toEqual( + [makeColumn(1), makeColumn(3), makeColumn(4)] + ); }); }); diff --git a/packages/iris-grid/src/IrisGridUtils.ts b/packages/iris-grid/src/IrisGridUtils.ts index 8e698bd2f1..fbe1f70bab 100644 --- a/packages/iris-grid/src/IrisGridUtils.ts +++ b/packages/iris-grid/src/IrisGridUtils.ts @@ -82,14 +82,14 @@ export type DehydratedAdvancedFilter = [ number, { options: AdvancedFilterOptions; - } + }, ]; export type DehydratedQuickFilter = [ number, { text: string; - } + }, ]; export type DehydratedCustomColumnFormat = [string, FormattingRule]; @@ -176,12 +176,8 @@ class IrisGridUtils { movedColumns: { from: string | [string, string]; to: string }[]; movedRows: MoveOperation[]; } { - const { - isStuckToBottom, - isStuckToRight, - movedColumns, - movedRows, - } = gridState; + const { isStuckToBottom, isStuckToRight, movedColumns, movedRows } = + gridState; const { columns } = model; @@ -229,17 +225,12 @@ class IrisGridUtils { IrisGridProps, 'isStuckToBottom' | 'isStuckToRight' | 'movedColumns' | 'movedRows' > { - const { - isStuckToBottom, - isStuckToRight, - movedColumns, - movedRows, - } = gridState; + const { isStuckToBottom, isStuckToRight, movedColumns, movedRows } = + gridState; const { columns } = model; - const customColumnNames = IrisGridUtils.parseCustomColumnNames( - customColumns - ); + const customColumnNames = + IrisGridUtils.parseCustomColumnNames(customColumns); const columnNames = columns .map(({ name }) => name) .concat(customColumnNames); @@ -473,12 +464,10 @@ class IrisGridUtils { oldCustomColumns: readonly ColumnName[], customColumns: readonly ColumnName[] ): ColumnName[] { - const oldCustomColumnsNames = IrisGridUtils.parseCustomColumnNames( - oldCustomColumns - ); - const customColumnNames = IrisGridUtils.parseCustomColumnNames( - customColumns - ); + const oldCustomColumnsNames = + IrisGridUtils.parseCustomColumnNames(oldCustomColumns); + const customColumnNames = + IrisGridUtils.parseCustomColumnNames(customColumns); return oldCustomColumnsNames.filter( oldCustomColumnName => !customColumnNames.includes(oldCustomColumnName) ); @@ -1270,18 +1259,20 @@ class IrisGridUtils { sorts: this.hydrateSort(columns, sorts), userColumnWidths: new Map( userColumnWidths - .map(([column, width]: [string | number, number]): [ - number, - number - ] => { - if ( - typeof column === 'string' || - (column as unknown) instanceof String - ) { - return [columns.findIndex(({ name }) => name === column), width]; + .map( + ([column, width]: [string | number, number]): [number, number] => { + if ( + typeof column === 'string' || + (column as unknown) instanceof String + ) { + return [ + columns.findIndex(({ name }) => name === column), + width, + ]; + } + return [column, width]; } - return [column, width]; - }) + ) .filter( ([column]) => column != null && column >= 0 && column < columns.length @@ -1324,7 +1315,7 @@ class IrisGridUtils { const importedFilters = savedQuickFilters.map( ([columnIndex, quickFilter]: DehydratedQuickFilter): [ number, - { text: string; filter: FilterCondition | null } + { text: string; filter: FilterCondition | null }, ] => { const { text } = quickFilter; @@ -1381,7 +1372,7 @@ class IrisGridUtils { const importedFilters = savedAdvancedFilters.map( ([columnIndex, advancedFilter]: DehydratedAdvancedFilter): [ number, - { options: AdvancedFilterOptions; filter: FilterCondition | null } + { options: AdvancedFilterOptions; filter: FilterCondition | null }, ] => { const column = IrisGridUtils.getColumn(columns, columnIndex); assertNotNull(column); @@ -1479,7 +1470,7 @@ class IrisGridUtils { pendingDataMap.map( ([rowIndex, { data }]: [ number, - { data: [string, CellData | string | null][] } + { data: [string, CellData | string | null][] }, ]) => [ rowIndex, { @@ -1507,7 +1498,7 @@ class IrisGridUtils { dehydrateValue(value: T, columnType: string): string | T | null { if (TableUtils.isDateType(columnType)) { return this.dehydrateDateTime( - (value as unknown) as number | DateWrapper | Date + value as unknown as number | DateWrapper | Date ); } @@ -1528,11 +1519,11 @@ class IrisGridUtils { columnType: string ): DateWrapper | LongWrapper | T | null { if (TableUtils.isDateType(columnType)) { - return this.hydrateDateTime((value as unknown) as string); + return this.hydrateDateTime(value as unknown as string); } if (TableUtils.isLongType(columnType)) { - return this.hydrateLong((value as unknown) as string); + return this.hydrateLong(value as unknown as string); } return value; diff --git a/packages/iris-grid/src/format-context-menus/DecimalFormatContextMenu.ts b/packages/iris-grid/src/format-context-menus/DecimalFormatContextMenu.ts index f200e3513e..7c34a0da81 100644 --- a/packages/iris-grid/src/format-context-menus/DecimalFormatContextMenu.ts +++ b/packages/iris-grid/src/format-context-menus/DecimalFormatContextMenu.ts @@ -75,9 +75,8 @@ class DecimalFormatContextMenu { ) ); - const isCustomSelected = FormatContextMenuUtils.isCustomSelected( - selectedFormat - ); + const isCustomSelected = + FormatContextMenuUtils.isCustomSelected(selectedFormat); const customFormat = isCustomSelected ? selectedFormat @@ -90,9 +89,8 @@ class DecimalFormatContextMenu { isCustomSelected, formatString => { if (formatString != null) { - const newCustomFormat = DecimalColumnFormatter.makeCustomFormat( - formatString - ); + const newCustomFormat = + DecimalColumnFormatter.makeCustomFormat(formatString); if (DecimalColumnFormatter.isValid(dh, newCustomFormat)) { onCustomFormatChange(newCustomFormat); } diff --git a/packages/iris-grid/src/format-context-menus/IntegerFormatContextMenu.ts b/packages/iris-grid/src/format-context-menus/IntegerFormatContextMenu.ts index c854c08313..9365b4ebe3 100644 --- a/packages/iris-grid/src/format-context-menus/IntegerFormatContextMenu.ts +++ b/packages/iris-grid/src/format-context-menus/IntegerFormatContextMenu.ts @@ -53,9 +53,8 @@ class IntegerFormatContextMenu { ) ); - const isCustomSelected = FormatContextMenuUtils.isCustomSelected( - selectedFormat - ); + const isCustomSelected = + FormatContextMenuUtils.isCustomSelected(selectedFormat); const customFormat = isCustomSelected ? selectedFormat @@ -68,9 +67,8 @@ class IntegerFormatContextMenu { isCustomSelected, formatString => { if (formatString != null) { - const newCustomFormat = IntegerColumnFormatter.makeCustomFormat( - formatString - ); + const newCustomFormat = + IntegerColumnFormatter.makeCustomFormat(formatString); if (IntegerColumnFormatter.isValid(dh, newCustomFormat)) { onCustomFormatChange(newCustomFormat); } diff --git a/packages/iris-grid/src/mousehandlers/IrisGridCellOverflowMouseHandler.ts b/packages/iris-grid/src/mousehandlers/IrisGridCellOverflowMouseHandler.ts index 8c7af3cc7c..ceb2517105 100644 --- a/packages/iris-grid/src/mousehandlers/IrisGridCellOverflowMouseHandler.ts +++ b/packages/iris-grid/src/mousehandlers/IrisGridCellOverflowMouseHandler.ts @@ -34,12 +34,7 @@ class IrisGridCellOverflowMouseHandler extends GridMouseHandler { return false; } - private getButtonPosition({ - x, - y, - column, - row, - }: GridPoint): { + private getButtonPosition({ x, y, column, row }: GridPoint): { left: number; top: number; width: number; @@ -66,9 +61,8 @@ class IrisGridCellOverflowMouseHandler extends GridMouseHandler { theme, }; - const { left, top, width, height } = renderer.getCellOverflowButtonPosition( - rendererState - ); + const { left, top, width, height } = + renderer.getCellOverflowButtonPosition(rendererState); if (left == null || width == null || top == null || height == null) { return null; } diff --git a/packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx b/packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx index b220114820..a0c706f7a5 100644 --- a/packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx +++ b/packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx @@ -839,9 +839,8 @@ class IrisGridContextMenuHandler extends GridMouseHandler { const actions = []; for (let i = 0; i < formatOptions.length; i += 1) { - const { description, format, group, isSelected, title } = formatOptions[ - i - ]; + const { description, format, group, isSelected, title } = + formatOptions[i]; actions.push({ title, description, @@ -940,9 +939,8 @@ class IrisGridContextMenuHandler extends GridMouseHandler { const { model } = this.irisGrid.props; const columnIndex = model.getColumnIndexByName(column.name); - const quickFilterValueText: - | string - | null = TableUtils.escapeQuickTextFilter(valueText); + const quickFilterValueText: string | null = + TableUtils.escapeQuickTextFilter(valueText); assertNotNull(columnIndex); diff --git a/packages/iris-grid/src/mousehandlers/IrisGridFilterMouseHandler.ts b/packages/iris-grid/src/mousehandlers/IrisGridFilterMouseHandler.ts index 380fb660ec..4d2af4112d 100644 --- a/packages/iris-grid/src/mousehandlers/IrisGridFilterMouseHandler.ts +++ b/packages/iris-grid/src/mousehandlers/IrisGridFilterMouseHandler.ts @@ -45,11 +45,8 @@ class IrisGridFilterMouseHandler extends GridMouseHandler { onMove(gridPoint: GridPoint): EventHandlerResult { const { y, column } = gridPoint; - const { - isFilterBarShown, - hoverAdvancedFilter, - metrics, - } = this.irisGrid.state; + const { isFilterBarShown, hoverAdvancedFilter, metrics } = + this.irisGrid.state; if (!metrics) throw new Error('Metrics not set'); const { columnHeaderMaxDepth } = metrics; const theme = this.irisGrid.getTheme(); diff --git a/packages/iris-grid/src/mousehandlers/IrisGridRowTreeMouseHandler.ts b/packages/iris-grid/src/mousehandlers/IrisGridRowTreeMouseHandler.ts index 64fa71d069..2b8b088c05 100644 --- a/packages/iris-grid/src/mousehandlers/IrisGridRowTreeMouseHandler.ts +++ b/packages/iris-grid/src/mousehandlers/IrisGridRowTreeMouseHandler.ts @@ -33,12 +33,7 @@ class IrisGridRowTreeMouseHandler extends GridMouseHandler { return false; } - private getButtonPosition({ - x, - y, - column, - row, - }: GridPoint): { + private getButtonPosition({ x, y, column, row }: GridPoint): { left: number; top: number; width: number; diff --git a/packages/iris-grid/src/sidebar/ChartBuilder.tsx b/packages/iris-grid/src/sidebar/ChartBuilder.tsx index 7f1c29fc73..6941cdbbb4 100644 --- a/packages/iris-grid/src/sidebar/ChartBuilder.tsx +++ b/packages/iris-grid/src/sidebar/ChartBuilder.tsx @@ -264,7 +264,8 @@ class ChartBuilder extends PureComponent { } handleSeriesDeleteClick(event: React.MouseEvent): void { - const changeEvent = (event as unknown) as React.ChangeEvent; + const changeEvent = + event as unknown as React.ChangeEvent; const index = changeEvent.target.getAttribute('data-index') as string; const intIndex = parseInt(index, 10); @@ -293,7 +294,8 @@ class ChartBuilder extends PureComponent { } handleTypeClick(event: React.MouseEvent): void { - const changeEvent = (event as unknown) as React.ChangeEvent; + const changeEvent = + event as unknown as React.ChangeEvent; const index = changeEvent.target.getAttribute('data-index') as string; const intIndex = parseInt(index, 10); @@ -348,7 +350,7 @@ class ChartBuilder extends PureComponent {

{this.getTypes().map((chartType, index) => { - const key = (chartType as unknown) as React.Key; + const key = chartType as unknown as React.Key; return (