Skip to content

Commit dfbb9dd

Browse files
committed
Enforce top-level type imports across charts, data-grid and pickers
Switch consistent-type-imports to separate-type-imports and add import/consistent-type-specifier-style (prefer-top-level). Autofix converts existing inline type imports to block style.
1 parent 0006f41 commit dfbb9dd

1,367 files changed

Lines changed: 5289 additions & 5779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,24 @@ export default defineConfig(
252252
files: [`packages/x-charts{,-*}/**/*${EXTENSION_TS}`],
253253
rules: {
254254
'import/no-cycle': 'error',
255-
'@typescript-eslint/consistent-type-imports': [
256-
'error',
257-
{
258-
fixStyle: 'inline-type-imports',
259-
},
260-
],
261255
// Charts have no semantics, so we often need to query by container
262256
'testing-library/no-container': 'off',
263257
},
264258
},
265259
{
266-
files: [`packages/x-data-grid{,-*}/**/*${EXTENSION_TS}`],
260+
files: [
261+
`packages/x-charts{,-*}/**/*${EXTENSION_TS}`,
262+
`packages/x-data-grid{,-*}/**/*${EXTENSION_TS}`,
263+
`packages/x-date-pickers{,-*}/**/*${EXTENSION_TS}`,
264+
],
267265
rules: {
268-
'@typescript-eslint/consistent-type-imports': 'error',
266+
'@typescript-eslint/consistent-type-imports': [
267+
'error',
268+
{
269+
fixStyle: 'separate-type-imports',
270+
},
271+
],
272+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
269273
},
270274
},
271275
{

packages/x-charts-premium/src/BarChartPremium/BarChartPremium.plugins.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { type ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2-
import {
3-
BAR_CHART_PRO_PLUGINS,
4-
type BarChartProPluginSignatures,
5-
} from '@mui/x-charts-pro/BarChartPro';
1+
import type { ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2+
import { BAR_CHART_PRO_PLUGINS } from '@mui/x-charts-pro/BarChartPro';
3+
import type { BarChartProPluginSignatures } from '@mui/x-charts-pro/BarChartPro';
64

75
export type BarChartPremiumPluginSignatures = BarChartProPluginSignatures;
86

packages/x-charts-premium/src/BarChartPremium/BarChartPremium.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { useThemeProps } from '@mui/material/styles';
5-
import {
6-
type BarChartProProps,
7-
type BarChartProSlotProps,
8-
type BarChartProSlots,
5+
import type {
6+
BarChartProProps,
7+
BarChartProSlotProps,
8+
BarChartProSlots,
99
} from '@mui/x-charts-pro/BarChartPro';
1010
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
1111
import { ChartsToolbarPro } from '@mui/x-charts-pro/ChartsToolbarPro';
@@ -14,7 +14,8 @@ import { ChartsWrapper } from '@mui/x-charts/ChartsWrapper';
1414
import { ChartsLayerContainer } from '@mui/x-charts/ChartsLayerContainer';
1515
import { ChartsSvgLayer } from '@mui/x-charts/ChartsSvgLayer';
1616
import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
17-
import { FocusedBar, type BarSeries } from '@mui/x-charts/BarChart';
17+
import { FocusedBar } from '@mui/x-charts/BarChart';
18+
import type { BarSeries } from '@mui/x-charts/BarChart';
1819
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
1920
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
2021
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
@@ -25,14 +26,11 @@ import { useChartsContainerProProps } from '@mui/x-charts-pro/internals';
2526
import type { BarChartPremiumPluginSignatures } from './BarChartPremium.plugins';
2627
import { useBarChartPremiumProps } from './useBarChartPremiumProps';
2728
import { BAR_CHART_PREMIUM_PLUGINS } from './BarChartPremium.plugins';
28-
import { BarPlotPremium, type BarPlotPremiumProps } from './BarPlotPremium';
29+
import { BarPlotPremium } from './BarPlotPremium';
30+
import type { BarPlotPremiumProps } from './BarPlotPremium';
2931
import { ChartsWebGLLayer } from '../ChartsWebGLLayer';
3032
import { ChartsDataProviderPremium } from '../ChartsDataProviderPremium';
31-
import {
32-
type BarItemIdentifier,
33-
type RangeBarItemIdentifier,
34-
type RangeBarSeriesType,
35-
} from '../models';
33+
import type { BarItemIdentifier, RangeBarItemIdentifier, RangeBarSeriesType } from '../models';
3634
import { RangeBarPlot } from './RangeBar/RangeBarPlot';
3735
import { FocusedRangeBar } from './RangeBar/FocusedRangeBar';
3836

packages/x-charts-premium/src/BarChartPremium/BarPlotPremium.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
'use client';
22
import * as React from 'react';
33
import PropTypes from 'prop-types';
4-
import {
5-
BarPlot,
6-
type BarPlotProps,
7-
type BarPlotSlotProps,
8-
type BarPlotSlots,
9-
} from '@mui/x-charts/BarChart';
4+
import { BarPlot } from '@mui/x-charts/BarChart';
5+
import type { BarPlotProps, BarPlotSlotProps, BarPlotSlots } from '@mui/x-charts/BarChart';
106
import type { RendererType } from '@mui/x-charts/ScatterChart';
117
import { BarWebGLPlot } from './webgl/BarWebGLPlot';
128

packages/x-charts-premium/src/BarChartPremium/RangeBar/AnimatedRangeBarElement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22
import * as React from 'react';
3-
import { type BarProps } from '@mui/x-charts/BarChart';
3+
import type { BarProps } from '@mui/x-charts/BarChart';
44
import { useAnimateRangeBar } from '../../hooks/animation/useAnimateRangeBar';
55

66
export interface AnimatedRangeBarElementProps extends BarProps {

packages/x-charts-premium/src/BarChartPremium/RangeBar/RangeBarPlot.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { styled } from '@mui/material/styles';
55
import { useSkipAnimation } from '@mui/x-charts/internals';
6-
import {
7-
BarElement,
8-
type BarElementSlotProps,
9-
type BarElementSlots,
10-
barClasses,
11-
type BarLabelSlots,
12-
type BarLabelSlotProps,
6+
import { BarElement, barClasses } from '@mui/x-charts/BarChart';
7+
import type {
8+
BarElementSlotProps,
9+
BarElementSlots,
10+
BarLabelSlots,
11+
BarLabelSlotProps,
1312
} from '@mui/x-charts/BarChart';
1413
import { useDrawingArea, useXAxes, useYAxes } from '@mui/x-charts/hooks';
1514
import { useIsZoomInteracting } from '@mui/x-charts-pro/hooks';
1615
import { useUtilityClasses } from './useUtilityClasses';
1716
import { useRangeBarPlotData } from './useRangeBarPlotData';
1817
import { AnimatedRangeBarElement } from './AnimatedRangeBarElement';
1918
import { RangeBarWebGLPlot } from './RangeBarWebGLPlot';
20-
import { type RangeBarItemIdentifier } from '../../models';
19+
import type { RangeBarItemIdentifier } from '../../models';
2120

2221
export type RangeBarPlotRenderer = 'svg-single' | 'webgl';
2322

packages/x-charts-premium/src/BarChartPremium/RangeBar/RangeBarWebGLPlot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useWebGLLayer } from '../../ChartsWebGLLayer/ChartsWebGLContext';
55
import { BarWebGLProgram } from '../webgl/BarWebGLProgram';
66
import { useWebGLBarLikePlotData } from '../webgl/useWebGLBarLikePlotData';
77
import { useRangeBarPlotData } from './useRangeBarPlotData';
8-
import { type ProcessedRangeBarSeriesData } from './types';
8+
import type { ProcessedRangeBarSeriesData } from './types';
99

1010
export interface RangeBarWebGLPlotProps {
1111
borderRadius?: number;

packages/x-charts-premium/src/BarChartPremium/RangeBar/createGetRangeBarDimensions.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {
2-
getBandSize,
3-
type ChartSeriesDefaultized,
4-
type ChartsXAxisProps,
5-
type ChartsYAxisProps,
6-
type ComputedAxis,
7-
type ScaleName,
1+
import { getBandSize } from '@mui/x-charts/internals';
2+
import type {
3+
ChartSeriesDefaultized,
4+
ChartsXAxisProps,
5+
ChartsYAxisProps,
6+
ComputedAxis,
7+
ScaleName,
88
} from '@mui/x-charts/internals';
99

1010
export function createGetRangeBarDimensions(params: {

packages/x-charts-premium/src/BarChartPremium/RangeBar/seriesConfig/descriptionGetter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getLabel, type DescriptionGetter } from '@mui/x-charts/internals';
1+
import { getLabel } from '@mui/x-charts/internals';
2+
import type { DescriptionGetter } from '@mui/x-charts/internals';
23

34
const descriptionGetter: DescriptionGetter<'rangeBar'> = (params) => {
45
const { identifier, series, xAxis, yAxis, localeText } = params;

packages/x-charts-premium/src/BarChartPremium/RangeBar/seriesConfig/extrema.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { type CartesianExtremumGetter, findMinMax } from '@mui/x-charts/internals';
2-
import { type RangeBarValueType } from '../../../models';
1+
import { findMinMax } from '@mui/x-charts/internals';
2+
import type { CartesianExtremumGetter } from '@mui/x-charts/internals';
3+
import type { RangeBarValueType } from '../../../models';
34

45
const createResult = (data: any, direction: 'x' | 'y') => {
56
if (direction === 'x') {

0 commit comments

Comments
 (0)