chore(lint): migrate Jest lint rules from eslint to oxlint (#37787)

Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
Đỗ Trọng Hải
2026-02-08 16:44:42 +07:00
committed by GitHub
parent c4d2d42b3b
commit 563d9f1a3f
264 changed files with 1893 additions and 1952 deletions

View File

@@ -44,7 +44,7 @@ jest.mock('@superset-ui/chart-controls', () => {
});
describe('BigNumber Total Control Panel Config', () => {
it('should have the required control panel sections', () => {
test('should have the required control panel sections', () => {
expect(controlPanel).toHaveProperty('controlPanelSections');
const sections = controlPanel.controlPanelSections;
expect(Array.isArray(sections)).toBe(true);
@@ -74,7 +74,7 @@ describe('BigNumber Total Control Panel Config', () => {
expect(conditionalFormattingRow).toBeTruthy();
});
it('should have y_axis_format override with correct label', () => {
test('should have y_axis_format override with correct label', () => {
expect(controlPanel).toHaveProperty('controlOverrides');
expect(controlPanel.controlOverrides).toHaveProperty('y_axis_format');
expect(controlPanel.controlOverrides!.y_axis_format!.label).toBe(
@@ -82,7 +82,7 @@ describe('BigNumber Total Control Panel Config', () => {
);
});
it('should override formData metric using getStandardizedControls', () => {
test('should override formData metric using getStandardizedControls', () => {
const dummyFormData = { someProp: 'test' } as unknown as SqlaFormData;
const newFormData = controlPanel.formDataOverrides!(dummyFormData);

View File

@@ -66,7 +66,7 @@ describe('BigNumberTotal transformProps', () => {
const baseRawFormData = { dummy: 'raw' };
it('should return null bigNumber when no data is provided', () => {
test('should return null bigNumber when no data is provided', () => {
const chartProps = {
width: 400,
height: 300,
@@ -91,7 +91,7 @@ describe('BigNumberTotal transformProps', () => {
// colorThresholdFormatters fallback to empty array when getColorFormatters returns falsy
expect(result.colorThresholdFormatters).toEqual([]);
});
it('should convert subheader to subtitle', () => {
test('should convert subheader to subtitle', () => {
const chartProps = {
width: 400,
height: 300,
@@ -120,7 +120,7 @@ describe('BigNumberTotal transformProps', () => {
},
};
it('uses subtitle font size when subtitle is provided', () => {
test('uses subtitle font size when subtitle is provided', () => {
const result = transformProps({
...baseChartProps,
formData: {
@@ -139,7 +139,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.subtitleFontSize).toBe(0.4);
});
it('should compute bigNumber using parseMetricValue when data exists', () => {
test('should compute bigNumber using parseMetricValue when data exists', () => {
const chartProps = {
width: 500,
height: 400,
@@ -160,7 +160,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.bigNumber).toEqual(456);
});
it('should use formatTime as headerFormatter for Temporal or String types or forced formatting', () => {
test('should use formatTime as headerFormatter for Temporal or String types or forced formatting', () => {
// Case 1: Temporal type
const chartPropsTemporal = {
width: 600,
@@ -214,7 +214,7 @@ describe('BigNumberTotal transformProps', () => {
expect(resultForced.headerFormatter(5)).toBe('5pm');
});
it('should use numberFormatter as headerFormatter when not Temporal/String and no forced formatting', () => {
test('should use numberFormatter as headerFormatter when not Temporal/String and no forced formatting', () => {
const chartProps = {
width: 700,
height: 500,
@@ -231,7 +231,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.headerFormatter(500)).toBe('$500');
});
it('should propagate colorThresholdFormatters from getColorFormatters', () => {
test('should propagate colorThresholdFormatters from getColorFormatters', () => {
// Override the getColorFormatters mock to return specific value
const mockFormatters = [{ formatter: 'red' }];
(getColorFormatters as jest.Mock).mockReturnValueOnce(mockFormatters);

View File

@@ -49,7 +49,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
aggregation: null,
};
it('creates raw metric query when aggregation is "raw"', () => {
test('creates raw metric query when aggregation is "raw"', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'raw' });
const bigNumberQuery = queryContext.queries[1];
@@ -58,7 +58,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
expect(bigNumberQuery.columns).toEqual([]);
});
it('returns single query for aggregation methods that can be computed client-side', () => {
test('returns single query for aggregation methods that can be computed client-side', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'sum' });
expect(queryContext.queries.length).toBe(1);
@@ -70,7 +70,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
]);
});
it('returns single query for LAST_VALUE aggregation', () => {
test('returns single query for LAST_VALUE aggregation', () => {
const queryContext = buildQuery({
...baseFormData,
aggregation: 'LAST_VALUE',
@@ -85,7 +85,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
]);
});
it('returns two queries only for raw aggregation', () => {
test('returns two queries only for raw aggregation', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'raw' });
expect(queryContext.queries.length).toBe(2);

View File

@@ -123,7 +123,7 @@ describe('BigNumberWithTrendline transformProps', () => {
const baseHooks = { onContextMenu };
const baseRawFormData = { dummy: 'raw' };
it('should return null bigNumber when no data is provided', () => {
test('should return null bigNumber when no data is provided', () => {
const chartProps = {
width: 400,
height: 300,
@@ -142,7 +142,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.subtitle).toBe('subtitle message');
});
it('should calculate subheader as percent change with suffix', () => {
test('should calculate subheader as percent change with suffix', () => {
const chartProps = {
width: 500,
height: 400,
@@ -169,7 +169,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.subheader).toBe('10.0% WoW');
});
it('should compute bigNumber from parseMetricValue', () => {
test('should compute bigNumber from parseMetricValue', () => {
const chartProps = {
width: 600,
height: 450,
@@ -195,7 +195,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.bigNumber).toEqual(456);
});
it('should use formatTime as headerFormatter for Temporal/String or forced', () => {
test('should use formatTime as headerFormatter for Temporal/String or forced', () => {
const formData = { ...baseFormData, forceTimestampFormatting: true };
const chartProps = {
width: 600,
@@ -222,7 +222,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.headerFormatter(5)).toBe('5pm');
});
it('should use numberFormatter when not Temporal/String and not forced', () => {
test('should use numberFormatter when not Temporal/String and not forced', () => {
const formData = { ...baseFormData, forceTimestampFormatting: false };
const chartProps = {
width: 600,
@@ -247,7 +247,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.headerFormatter.format(500)).toBe('$500');
});
it('should use last data point for comparison when big number comes from aggregated data', () => {
test('should use last data point for comparison when big number comes from aggregated data', () => {
const chartProps = {
width: 500,
height: 400,

View File

@@ -43,9 +43,8 @@ const mockEchart = jest.fn();
jest.mock('../components/Echart', () => {
const { forwardRef } = jest.requireActual<typeof import('react')>('react');
const MockEchart = forwardRef<EchartsHandler | null, EchartsProps>(
(props, ref) => {
(props, _ref) => {
mockEchart(props);
void ref;
return null;
},
);
@@ -227,9 +226,7 @@ test('observes extra control height changes when ResizeObserver is available', a
observeSpy(target);
};
unobserve(_target: Element): void {
void _target;
}
unobserve(_target: Element): void {}
disconnect = () => {
disconnectSpy();

View File

@@ -19,7 +19,7 @@
import { mergeReplaceArrays } from '@superset-ui/core';
describe('Theme Override Deep Merge Behavior', () => {
it('should merge nested objects correctly', () => {
test('should merge nested objects correctly', () => {
const baseOptions = {
grid: {
left: '5%',
@@ -67,7 +67,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
it('should replace arrays instead of merging them', () => {
test('should replace arrays instead of merging them', () => {
const baseOptions = {
series: [
{ name: 'Series 1', type: 'line' },
@@ -86,7 +86,7 @@ describe('Theme Override Deep Merge Behavior', () => {
expect(result.series).toHaveLength(1);
});
it('should handle null overrides correctly', () => {
test('should handle null overrides correctly', () => {
const baseOptions = {
grid: {
left: '5%',
@@ -127,7 +127,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
it('should handle override precedence correctly', () => {
test('should handle override precedence correctly', () => {
const baseTheme = {
textStyle: { color: '#000', fontSize: 12 },
};
@@ -167,7 +167,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
it('should preserve deep nested structures', () => {
test('should preserve deep nested structures', () => {
const baseOptions = {
xAxis: {
axisLabel: {
@@ -215,7 +215,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
it('should handle function values correctly', () => {
test('should handle function values correctly', () => {
const formatFunction = (value: any) => `${value}%`;
const overrideFunction = (value: any) => `$${value}`;
@@ -241,7 +241,7 @@ describe('Theme Override Deep Merge Behavior', () => {
expect(result.yAxis.axisLabel.formatter('100')).toBe('$100');
});
it('should handle empty objects and arrays', () => {
test('should handle empty objects and arrays', () => {
const baseOptions = {
series: [{ name: 'Test', data: [1, 2, 3] }],
grid: { left: '5%' },