fix linting

This commit is contained in:
Nate Kelley 2025-07-23 12:02:54 -06:00
parent 0850e503ab
commit 1dea5d5236
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
46 changed files with 107 additions and 96 deletions

View File

@ -13,5 +13,17 @@
"useKeyWithClickEvents": "off" "useKeyWithClickEvents": "off"
} }
} }
} },
"overrides": [
{
"include": ["src/components/charts/*"],
"linter": {
"rules": {
"correctness": {
"useExhaustiveDependencies": "off"
}
}
}
}
]
} }

View File

@ -12,16 +12,13 @@
"./styles": "./src/styles/styles.css", "./styles": "./src/styles/styles.css",
"./dist/style.css": "./dist/style.css" "./dist/style.css": "./dist/style.css"
}, },
"files": [ "files": ["dist", "src/styles/styles.css"],
"dist",
"src/styles/styles.css"
],
"scripts": { "scripts": {
"prebuild": "tsx scripts/validate-env.ts", "prebuild": "tsx scripts/validate-env.ts",
"build": "vite build && tsc --emitDeclarationOnly --declaration", "build": "vite build && tsc --emitDeclarationOnly --declaration",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"dev": "vite build --watch", "dev": "vite build --watch",
"lint": "biome check", "lint": "biome check --write",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest watch", "test:watch": "vitest watch",
"test:coverage": "vitest run --coverage" "test:coverage": "vitest run --coverage"

View File

@ -6,6 +6,7 @@ export interface ChartMountedPluginOptions {
} }
declare module 'chart.js' { declare module 'chart.js' {
// biome-ignore lint/correctness/noUnusedVariables: we need to define the plugin options
interface PluginOptionsByType<TType extends ChartType> { interface PluginOptionsByType<TType extends ChartType> {
chartMounted?: ChartMountedPluginOptions; chartMounted?: ChartMountedPluginOptions;
} }
@ -18,12 +19,12 @@ declare module 'chart.js' {
export const ChartMountedPlugin: Plugin<ChartType, ChartMountedPluginOptions> = { export const ChartMountedPlugin: Plugin<ChartType, ChartMountedPluginOptions> = {
id: 'chartMounted', id: 'chartMounted',
afterInit: (chart, args, options) => { afterInit: (chart, _args, options) => {
if (!chart || !options) return; if (!chart || !options) return;
options?.onMounted?.(chart); options?.onMounted?.(chart);
chart.$mountedPlugin = true; chart.$mountedPlugin = true;
}, },
afterRender: (chart, args, options) => { afterRender: (chart, _args, options) => {
if (chart.$initialAnimationCompleted === undefined) { if (chart.$initialAnimationCompleted === undefined) {
chart.$initialAnimationCompleted = true; chart.$initialAnimationCompleted = true;
} }

View File

@ -5,6 +5,7 @@ export interface ChartTotalizerPluginOptions {
} }
declare module 'chart.js' { declare module 'chart.js' {
// biome-ignore lint/correctness/noUnusedVariables: we need to define the plugin options
interface PluginOptionsByType<TType extends ChartType> { interface PluginOptionsByType<TType extends ChartType> {
totalizer?: ChartTotalizerPluginOptions | false; totalizer?: ChartTotalizerPluginOptions | false;
} }
@ -23,7 +24,7 @@ export const ChartTotalizerPlugin: Plugin<ChartType, ChartTotalizerPluginOptions
chart.$totalizer = { stackTotals: {}, seriesTotals: [] }; chart.$totalizer = { stackTotals: {}, seriesTotals: [] };
}, },
beforeDatasetsUpdate: (chart, args, options) => { beforeDatasetsUpdate: (chart, _args, options) => {
if (options?.enabled === false) return; if (options?.enabled === false) return;
const stackTotals: Record<string, number> = {}; const stackTotals: Record<string, number> = {};
@ -35,8 +36,8 @@ export const ChartTotalizerPlugin: Plugin<ChartType, ChartTotalizerPluginOptions
//dataset.hidden is true when the dataset is hidden by what was passed in the options //dataset.hidden is true when the dataset is hidden by what was passed in the options
return !meta.hidden && !dataset.hidden; return !meta.hidden && !dataset.hidden;
}) })
.forEach((dataset, datasetIndex) => { .forEach((dataset) => {
(chart.data.labels as string[])?.forEach((label, labelIndex) => { (chart.data.labels as string[])?.forEach((_label, labelIndex) => {
const value = dataset.data[labelIndex]; const value = dataset.data[labelIndex];
if (typeof value === 'number') { if (typeof value === 'number') {
stackTotals[labelIndex] = (stackTotals[labelIndex] || 0) + value; stackTotals[labelIndex] = (stackTotals[labelIndex] || 0) + value;

View File

@ -1,5 +1,5 @@
import type { Context } from 'chartjs-plugin-datalabels';
import { determineFontColorContrast } from '@/lib/colors'; import { determineFontColorContrast } from '@/lib/colors';
import type { Context } from 'chartjs-plugin-datalabels';
export const dataLabelFontColorContrast = (context: Context) => { export const dataLabelFontColorContrast = (context: Context) => {
const color = context.dataset.backgroundColor as string; const color = context.dataset.backgroundColor as string;

View File

@ -1,6 +1,6 @@
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
import type { Context } from 'chartjs-plugin-datalabels'; import type { Context } from 'chartjs-plugin-datalabels';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
import { formatBarAndLineDataLabel } from './formatBarAndLineDataLabel'; import { formatBarAndLineDataLabel } from './formatBarAndLineDataLabel';
describe('formatBarAndLineDataLabel', () => { describe('formatBarAndLineDataLabel', () => {

View File

@ -1,7 +1,7 @@
import type { Chart } from 'chart.js';
import { describe, expect, it } from 'vitest';
import type { ColumnSettings } from '@buster/server-shared/metrics'; import type { ColumnSettings } from '@buster/server-shared/metrics';
import type { ColumnLabelFormat, SimplifiedColumnType } from '@buster/server-shared/metrics'; import type { ColumnLabelFormat, SimplifiedColumnType } from '@buster/server-shared/metrics';
import type { Chart } from 'chart.js';
import { describe, expect, it } from 'vitest';
import { getLegendItems } from './getLegendItems'; import { getLegendItems } from './getLegendItems';
describe('getLegendItems', () => { describe('getLegendItems', () => {

View File

@ -1,7 +1,7 @@
import type { ColumnSettings } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { barOptionsHandler, barPluginsHandler } from './barChartOptions'; import { barOptionsHandler, barPluginsHandler } from './barChartOptions';
import type { ChartSpecificOptionsProps } from './interfaces'; import type { ChartSpecificOptionsProps } from './interfaces';
import type { ColumnSettings } from '@buster/server-shared/metrics';
type BarGroupType = 'stack' | 'group' | 'percentage-stack' | null; type BarGroupType = 'stack' | 'group' | 'percentage-stack' | null;

View File

@ -4,7 +4,7 @@ import type { ChartProps } from '../../core';
import type { ChartSpecificOptionsProps } from './interfaces'; import type { ChartSpecificOptionsProps } from './interfaces';
export const barOptionsHandler = ( export const barOptionsHandler = (
props: ChartSpecificOptionsProps _props: ChartSpecificOptionsProps
): ChartProps<ChartJSChartType>['options'] => { ): ChartProps<ChartJSChartType>['options'] => {
return {}; return {};
}; };

View File

@ -1,6 +1,6 @@
import type { ChartEncodes, ChartType } from '@buster/server-shared/metrics';
import type { ChartType as ChartJSChartType } from 'chart.js'; import type { ChartType as ChartJSChartType } from 'chart.js';
import type { BusterChartProps } from '../../../BusterChart.types'; import type { BusterChartProps } from '../../../BusterChart.types';
import type { ChartEncodes, ChartType } from '@buster/server-shared/metrics';
import type { ChartProps } from '../../core'; import type { ChartProps } from '../../core';
export interface UseChartSpecificOptionsProps { export interface UseChartSpecificOptionsProps {

View File

@ -1,3 +1,4 @@
import type { ChartType } from '@buster/server-shared/metrics';
import type { ChartType as ChartJSChartType, PluginChartOptions } from 'chart.js'; import type { ChartType as ChartJSChartType, PluginChartOptions } from 'chart.js';
import { useMemo } from 'react'; import { useMemo } from 'react';
import type { DeepPartial } from 'utility-types'; import type { DeepPartial } from 'utility-types';
@ -5,7 +6,6 @@ import type { ChartProps } from '../../core';
import { barOptionsHandler, barPluginsHandler } from './barChartOptions'; import { barOptionsHandler, barPluginsHandler } from './barChartOptions';
import type { ChartSpecificOptionsProps, UseChartSpecificOptionsProps } from './interfaces'; import type { ChartSpecificOptionsProps, UseChartSpecificOptionsProps } from './interfaces';
import { pieOptionsHandler, piePluginsHandler } from './pieChartOptions'; import { pieOptionsHandler, piePluginsHandler } from './pieChartOptions';
import type { ChartType } from '@buster/server-shared/metrics';
export const useChartSpecificOptions = ({ export const useChartSpecificOptions = ({
selectedChartType, selectedChartType,
@ -36,13 +36,13 @@ const chartTypeOptionsHandler: Record<
ChartType, ChartType,
(props: ChartSpecificOptionsProps) => ChartProps<ChartJSChartType>['options'] (props: ChartSpecificOptionsProps) => ChartProps<ChartJSChartType>['options']
> = { > = {
['pie']: pieOptionsHandler, pie: pieOptionsHandler,
['line']: defaultHandler, line: defaultHandler,
['scatter']: defaultHandler, scatter: defaultHandler,
['bar']: barOptionsHandler, bar: barOptionsHandler,
['combo']: defaultHandler, combo: defaultHandler,
['metric']: defaultHandler, metric: defaultHandler,
['table']: defaultHandler, table: defaultHandler,
}; };
//********** PLUGINS ************ */ //********** PLUGINS ************ */
@ -55,11 +55,11 @@ const chartTypePluginsHandler: Record<
ChartType, ChartType,
(props: ChartSpecificOptionsProps) => DeepPartial<PluginChartOptions<ChartJSChartType>>['plugins'] (props: ChartSpecificOptionsProps) => DeepPartial<PluginChartOptions<ChartJSChartType>>['plugins']
> = { > = {
['pie']: piePluginsHandler, pie: piePluginsHandler,
['line']: defaultPluginsHandler, line: defaultPluginsHandler,
['scatter']: defaultPluginsHandler, scatter: defaultPluginsHandler,
['bar']: barPluginsHandler, bar: barPluginsHandler,
['combo']: defaultPluginsHandler, combo: defaultPluginsHandler,
['metric']: defaultPluginsHandler, metric: defaultPluginsHandler,
['table']: defaultPluginsHandler, table: defaultPluginsHandler,
}; };

View File

@ -1,12 +1,12 @@
import {
type ChartConfigProps,
type ChartType,
DEFAULT_COLUMN_LABEL_FORMAT,
type GoalLine,
} from '@buster/server-shared/metrics';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { useGoalLines } from './useGoalLines'; import { useGoalLines } from './useGoalLines';
import {
DEFAULT_COLUMN_LABEL_FORMAT,
type ChartConfigProps,
type ChartType,
type GoalLine,
} from '@buster/server-shared/metrics';
describe('useGoalLines', () => { describe('useGoalLines', () => {
const defaultParams = { const defaultParams = {

View File

@ -1,8 +1,8 @@
import { useMemo } from 'react';
import type { ChartConfigProps } from '@buster/server-shared/metrics';
import { formatLabel } from '@/lib/columnFormatter';
import { truncateWithEllipsis } from '../../../../commonHelpers/titleHelpers';
import { AXIS_TITLE_SEPARATOR } from '@/lib/axisFormatter'; import { AXIS_TITLE_SEPARATOR } from '@/lib/axisFormatter';
import { formatLabel } from '@/lib/columnFormatter';
import type { ChartConfigProps } from '@buster/server-shared/metrics';
import { useMemo } from 'react';
import { truncateWithEllipsis } from '../../../../commonHelpers/titleHelpers';
export const useY2AxisTitle = ({ export const useY2AxisTitle = ({
y2Axis, y2Axis,

View File

@ -1,6 +1,6 @@
import type { ChartConfigProps, ChartType } from '@buster/server-shared/metrics';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { type ChartConfigProps, type ChartType } from '@buster/server-shared/metrics';
import { useInteractions } from './useInteractions'; import { useInteractions } from './useInteractions';
describe('useInteractions', () => { describe('useInteractions', () => {

View File

@ -1,7 +1,7 @@
import type { ChartConfigProps } from '@buster/server-shared/metrics';
import type { CoreInteractionOptions } from 'chart.js'; import type { CoreInteractionOptions } from 'chart.js';
import { useMemo } from 'react'; import { useMemo } from 'react';
import type { DeepPartial } from 'utility-types'; // Add this import import type { DeepPartial } from 'utility-types'; // Add this import
import type { ChartConfigProps } from '@buster/server-shared/metrics';
interface UseInteractionsProps { interface UseInteractionsProps {
selectedChartType: ChartConfigProps['selectedChartType']; selectedChartType: ChartConfigProps['selectedChartType'];

View File

@ -1,3 +1,4 @@
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
import type { import type {
BarControllerDatasetOptions, BarControllerDatasetOptions,
Chart, Chart,
@ -5,7 +6,6 @@ import type {
TooltipItem, TooltipItem,
} from 'chart.js'; } from 'chart.js';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
import { barAndLineTooltipHelper } from './barAndLineTooltipHelper'; import { barAndLineTooltipHelper } from './barAndLineTooltipHelper';
type MockDataset = Partial< type MockDataset = Partial<

View File

@ -1,6 +1,6 @@
import { type ColumnLabelFormat, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import type { Chart, TooltipItem } from 'chart.js'; import type { Chart, TooltipItem } from 'chart.js';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ColumnLabelFormat } from '@buster/server-shared/metrics';
import { pieTooltipHelper } from './pieTooltipHelper'; import { pieTooltipHelper } from './pieTooltipHelper';
describe('pieTooltipHelper', () => { describe('pieTooltipHelper', () => {

View File

@ -1,15 +1,15 @@
import '../../../ChartJSTheme'; import '../../../ChartJSTheme';
import {
type ChartEncodes,
type ColumnSettings,
DEFAULT_COLUMN_LABEL_FORMAT,
DEFAULT_COLUMN_SETTINGS,
type SimplifiedColumnType,
} from '@buster/server-shared/metrics';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { useXAxis } from './useXAxis'; import { useXAxis } from './useXAxis';
import {
DEFAULT_COLUMN_LABEL_FORMAT,
DEFAULT_COLUMN_SETTINGS,
type ChartEncodes,
type ColumnSettings,
type SimplifiedColumnType,
} from '@buster/server-shared/metrics';
describe('useXAxis', () => { describe('useXAxis', () => {
const defaultProps = { const defaultProps = {

View File

@ -1,6 +1,6 @@
import { type ComboChartAxis, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ComboChartAxis } from '@buster/server-shared/metrics';
import { useY2Axis } from './useY2Axis'; import { useY2Axis } from './useY2Axis';
describe('useY2Axis', () => { describe('useY2Axis', () => {

View File

@ -1,7 +1,7 @@
import { type ChartEncodes, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import type { LinearScaleOptions } from 'chart.js'; import type { LinearScaleOptions } from 'chart.js';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ChartEncodes } from '@buster/server-shared/metrics';
import { useYAxis } from './useYAxis'; import { useYAxis } from './useYAxis';
describe('useYAxis', () => { describe('useYAxis', () => {

View File

@ -1,6 +1,6 @@
import { DEFAULT_COLUMN_SETTINGS } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { comboSeriesBuilder_data } from './comboSeriesBuilder'; import { comboSeriesBuilder_data } from './comboSeriesBuilder';
import { DEFAULT_COLUMN_SETTINGS } from '@buster/server-shared/metrics';
describe('comboSeriesBuilder_data', () => { describe('comboSeriesBuilder_data', () => {
const mockColors = ['#000000', '#111111']; const mockColors = ['#000000', '#111111'];

View File

@ -1,14 +1,14 @@
import {
type ColumnSettings,
DEFAULT_COLUMN_SETTINGS,
ENABLED_DOTS_ON_LINE_SIZE,
} from '@buster/server-shared/metrics';
import type { DatasetOption } from '../../../chartHooks'; import type { DatasetOption } from '../../../chartHooks';
import type { ChartProps } from '../../core'; import type { ChartProps } from '../../core';
import { barBuilder } from './barSeriesBuilder'; import { barBuilder } from './barSeriesBuilder';
import type { SeriesBuilderProps } from './interfaces'; import type { SeriesBuilderProps } from './interfaces';
import { lineBuilder, lineSeriesBuilder_labels } from './lineSeriesBuilder'; import { lineBuilder, lineSeriesBuilder_labels } from './lineSeriesBuilder';
import type { LabelBuilderProps } from './useSeriesOptions'; import type { LabelBuilderProps } from './useSeriesOptions';
import {
DEFAULT_COLUMN_SETTINGS,
ENABLED_DOTS_ON_LINE_SIZE,
type ColumnSettings,
} from '@buster/server-shared/metrics';
type ComboSeries = Array< type ComboSeries = Array<
ChartProps<'bar'>['data']['datasets'][number] | ChartProps<'line'>['data']['datasets'][number] ChartProps<'bar'>['data']['datasets'][number] | ChartProps<'line'>['data']['datasets'][number]

View File

@ -1,5 +1,5 @@
import type { BusterChartProps } from '../../../BusterChart.types';
import type { ChartEncodes } from '@buster/server-shared/metrics'; import type { ChartEncodes } from '@buster/server-shared/metrics';
import type { BusterChartProps } from '../../../BusterChart.types';
import type { DatasetOptionsWithTicks } from '../../../chartHooks'; import type { DatasetOptionsWithTicks } from '../../../chartHooks';
export interface SeriesBuilderProps { export interface SeriesBuilderProps {

View File

@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { ChartType } from '@buster/server-shared/metrics'; import type { ChartType } from '@buster/server-shared/metrics';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { computeHiddenShowItems } from './helpers'; import { computeHiddenShowItems } from './helpers';
import type { BusterChartLegendItem } from './interfaces'; import type { BusterChartLegendItem } from './interfaces';

View File

@ -1,11 +1,11 @@
import { describe, expect, it } from 'vitest';
import { import {
type ColumnLabelFormat, type ColumnLabelFormat,
type ShowLegendHeadline,
type ColumnMetaData, type ColumnMetaData,
type SimplifiedColumnType,
DEFAULT_COLUMN_LABEL_FORMAT, DEFAULT_COLUMN_LABEL_FORMAT,
type ShowLegendHeadline,
type SimplifiedColumnType,
} from '@buster/server-shared/metrics'; } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import type { DatasetOptionsWithTicks } from '../chartHooks/useDatasetOptions/interfaces'; import type { DatasetOptionsWithTicks } from '../chartHooks/useDatasetOptions/interfaces';
import type { BusterChartLegendItem } from './interfaces'; import type { BusterChartLegendItem } from './interfaces';
import { addLegendHeadlines } from './legendHeadlineHelpers'; import { addLegendHeadlines } from './legendHeadlineHelpers';

View File

@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react'; import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test'; import { fn } from '@storybook/test';
import type { BusterChartLegendItem } from '../interfaces';
import { OverflowButton } from '../OverflowContainer'; import { OverflowButton } from '../OverflowContainer';
import type { BusterChartLegendItem } from '../interfaces';
const meta = { const meta = {
title: 'UI/Charts/OverflowButton', title: 'UI/Charts/OverflowButton',

View File

@ -1,7 +1,7 @@
import type React from 'react'; import type React from 'react';
import type { ITooltipItem } from './interfaces';
import { TooltipItem } from './TooltipItem'; import { TooltipItem } from './TooltipItem';
import { TooltipTitle } from './TooltipTitle'; import { TooltipTitle } from './TooltipTitle';
import type { ITooltipItem } from './interfaces';
const MAX_ITEMS_IN_TOOLTIP = 12; const MAX_ITEMS_IN_TOOLTIP = 12;

View File

@ -1,6 +1,6 @@
import type React from 'react';
import type { ChartType } from '@buster/server-shared/metrics';
import { cn } from '@/lib/classMerge'; import { cn } from '@/lib/classMerge';
import type { ChartType } from '@buster/server-shared/metrics';
import type React from 'react';
import { LegendItemDot } from '../BusterChartLegend/LegendDot'; import { LegendItemDot } from '../BusterChartLegend/LegendDot';
import type { ITooltipItem, TooltipItemValueProps } from './interfaces'; import type { ITooltipItem, TooltipItemValueProps } from './interfaces';

View File

@ -1,5 +1,5 @@
import type React from 'react';
import type { ChartType } from '@buster/server-shared/metrics'; import type { ChartType } from '@buster/server-shared/metrics';
import type React from 'react';
import { LegendItemDot } from '../BusterChartLegend'; import { LegendItemDot } from '../BusterChartLegend';
export const TooltipTitle: React.FC<{ export const TooltipTitle: React.FC<{

View File

@ -1,5 +1,5 @@
import { type ColumnLabelFormat, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ColumnLabelFormat } from '@buster/server-shared/metrics';
import { aggregateAndCreateDatasets } from './aggregateAndCreateDatasets'; import { aggregateAndCreateDatasets } from './aggregateAndCreateDatasets';
describe('aggregateAndCreateDatasets', () => { describe('aggregateAndCreateDatasets', () => {

View File

@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import type { ColumnMetaData } from '@buster/server-shared/metrics'; import type { ColumnMetaData } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import { sortLineBarData } from './datasetHelpers_BarLinePie'; import { sortLineBarData } from './datasetHelpers_BarLinePie';
describe('sortLineBarData', () => { describe('sortLineBarData', () => {

View File

@ -1,5 +1,5 @@
import { type ColumnLabelFormat, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ColumnLabelFormat } from '@buster/server-shared/metrics';
import { dataMapper } from './dataMapper'; import { dataMapper } from './dataMapper';
describe('dataMapper', () => { describe('dataMapper', () => {

View File

@ -1,6 +1,6 @@
import type { ChartConfigProps } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { type ChartConfigProps } from '@buster/server-shared/metrics'; import { InnerLabelTitleRecord, getPieInnerLabelTitle } from './pieLabelHelpers';
import { getPieInnerLabelTitle, InnerLabelTitleRecord } from './pieLabelHelpers';
describe('pieLabelHelpers', () => { describe('pieLabelHelpers', () => {
describe('InnerLabelTitleRecord', () => { describe('InnerLabelTitleRecord', () => {
@ -52,7 +52,7 @@ describe('pieLabelHelpers', () => {
}); });
it('should work with each type of aggregate', () => { it('should work with each type of aggregate', () => {
const testCases: Array<NonNullable<ChartConfigProps['pieInnerLabelAggregate']>> = [ const testCases: NonNullable<ChartConfigProps['pieInnerLabelAggregate']>[] = [
'sum', 'sum',
'average', 'average',
'median', 'median',

View File

@ -1,6 +1,6 @@
import type { ChartEncodes } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { doesChartHaveValidAxis } from './helpers'; import { doesChartHaveValidAxis } from './helpers';
import type { ChartEncodes } from '@buster/server-shared/metrics';
describe('doesChartHaveValidAxis', () => { describe('doesChartHaveValidAxis', () => {
it('should return true when isTable is true regardless of other parameters', () => { it('should return true when isTable is true regardless of other parameters', () => {

View File

@ -1,5 +1,5 @@
import type { Meta } from '@storybook/react';
import { DEFAULT_CHART_CONFIG } from '@buster/server-shared/metrics'; import { DEFAULT_CHART_CONFIG } from '@buster/server-shared/metrics';
import type { Meta } from '@storybook/react';
import { BusterChart } from '../BusterChart'; import { BusterChart } from '../BusterChart';
export const sharedMeta: Partial<Meta<typeof BusterChart>> = { export const sharedMeta: Partial<Meta<typeof BusterChart>> = {

View File

@ -1,5 +1,5 @@
import { type ColumnLabelFormat, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import type { Meta, StoryObj } from '@storybook/react'; import type { Meta, StoryObj } from '@storybook/react';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ColumnLabelFormat } from '@buster/server-shared/metrics';
import { BusterMetricChart } from '../MetricChart/BusterMetricChart'; import { BusterMetricChart } from '../MetricChart/BusterMetricChart';
const meta: Meta<typeof BusterMetricChart> = { const meta: Meta<typeof BusterMetricChart> = {

View File

@ -1,6 +1,6 @@
import { type ColumnLabelFormat, DEFAULT_COLUMN_LABEL_FORMAT } from '@buster/server-shared/metrics';
import type { Meta, StoryObj } from '@storybook/react'; import type { Meta, StoryObj } from '@storybook/react';
import { BusterTableChart } from '../TableChart/BusterTableChart'; import { BusterTableChart } from '../TableChart/BusterTableChart';
import { DEFAULT_COLUMN_LABEL_FORMAT, type ColumnLabelFormat } from '@buster/server-shared/metrics';
// Helper functions for generating sample data // Helper functions for generating sample data
const generateProductName = (index: number) => `Product ${index + 1}`; const generateProductName = (index: number) => `Product ${index + 1}`;

View File

@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { ColumnMetaData } from '@buster/server-shared/metrics'; import type { ColumnMetaData } from '@buster/server-shared/metrics';
import { DEFAULT_CHART_CONFIG } from '@buster/server-shared/metrics'; import { DEFAULT_CHART_CONFIG } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import { import {
createDefaultBarAndLineAxis, createDefaultBarAndLineAxis,
createDefaultPieAxis, createDefaultPieAxis,

View File

@ -1,9 +1,9 @@
import { describe, expect, it } from 'vitest';
import { import {
type ColumnMetaData,
type ColumnLabelFormat, type ColumnLabelFormat,
type ColumnMetaData,
DEFAULT_COLUMN_LABEL_FORMAT, DEFAULT_COLUMN_LABEL_FORMAT,
} from '@buster/server-shared/metrics'; } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import { createDefaultColumnLabelFormats } from './createDefaultColumnFormats'; import { createDefaultColumnLabelFormats } from './createDefaultColumnFormats';
describe('createDefaultColumnFormats', () => { describe('createDefaultColumnFormats', () => {

View File

@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { ColumnMetaData, ColumnSettings } from '@buster/server-shared/metrics'; import type { ColumnMetaData, ColumnSettings } from '@buster/server-shared/metrics';
import { DEFAULT_COLUMN_SETTINGS } from '@buster/server-shared/metrics'; import { DEFAULT_COLUMN_SETTINGS } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import { createDefaultColumnSettings } from './createDefaultColumnSettings'; import { createDefaultColumnSettings } from './createDefaultColumnSettings';
describe('createDefaultColumnSettings', () => { describe('createDefaultColumnSettings', () => {

View File

@ -1,10 +1,10 @@
import { create } from 'mutative';
import { import {
type ColumnMetaData,
type ChartConfigProps, type ChartConfigProps,
type ColumnMetaData,
DEFAULT_COLUMN_SETTINGS, DEFAULT_COLUMN_SETTINGS,
} from '@buster/server-shared/metrics'; } from '@buster/server-shared/metrics';
import type { ColumnSettings } from '@buster/server-shared/metrics'; import type { ColumnSettings } from '@buster/server-shared/metrics';
import { create } from 'mutative';
export const createDefaultColumnSettings = ( export const createDefaultColumnSettings = (
existingColumnSettings: Record<string, ColumnSettings> | undefined, existingColumnSettings: Record<string, ColumnSettings> | undefined,

View File

@ -1,10 +1,10 @@
import { describe, expect, it } from 'vitest';
import { import {
type ChartType,
type DataMetadata,
type ChartConfigProps, type ChartConfigProps,
type ChartType,
DEFAULT_CHART_CONFIG, DEFAULT_CHART_CONFIG,
type DataMetadata,
} from '@buster/server-shared/metrics'; } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest';
import { createDefaultChartConfig } from '.'; import { createDefaultChartConfig } from '.';
describe('createDefaultChartConfig', () => { describe('createDefaultChartConfig', () => {

View File

@ -1,7 +1,7 @@
import { cn } from '@/lib/classMerge';
import type { Row } from '@tanstack/react-table'; import type { Row } from '@tanstack/react-table';
import type { VirtualItem } from '@tanstack/react-virtual'; import type { VirtualItem } from '@tanstack/react-virtual';
import type React from 'react'; import type React from 'react';
import { cn } from '@/lib/classMerge';
import { DataGridCell } from './DataGridCell'; import { DataGridCell } from './DataGridCell';
interface DataGridRowProps { interface DataGridRowProps {

View File

@ -1,6 +1,6 @@
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { formatLabel } from './columnFormatter'; import { formatLabel } from './columnFormatter';
import type { ColumnLabelFormat } from '@buster/server-shared/metrics';
describe('formatLabel', () => { describe('formatLabel', () => {
describe('number formatting', () => { describe('number formatting', () => {

View File

@ -1,12 +1,12 @@
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { import {
DATE_TYPES, DATE_TYPES,
NUMBER_TYPES,
TEXT_TYPES,
isDateColumnType, isDateColumnType,
isNumericColumnStyle, isNumericColumnStyle,
isNumericColumnType, isNumericColumnType,
NUMBER_TYPES,
simplifyColumnType, simplifyColumnType,
TEXT_TYPES,
} from './messages'; } from './messages';
describe('simplifyColumnType', () => { describe('simplifyColumnType', () => {

View File

@ -376,7 +376,7 @@ async function createPackageFiles(config: PackageConfig) {
build: "tsc", build: "tsc",
typecheck: "tsc --noEmit", typecheck: "tsc --noEmit",
dev: "tsc --watch", dev: "tsc --watch",
lint: "biome check", lint: "biome check --write",
test: "vitest run", test: "vitest run",
"test:watch": "vitest watch", "test:watch": "vitest watch",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",