Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[code-infra] Replace or remove all instances of e identifier #14724

Merged
merged 11 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data/charts/bars/BorderRadius.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function BorderRadius() {
<Typography gutterBottom>Border Radius</Typography>
<Slider
value={radius}
onChange={(e, v) => setRadius(v)}
onChange={(event, value) => setRadius(value)}
valueLabelDisplay="auto"
min={0}
max={50}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/bars/BorderRadius.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function BorderRadius() {
<Typography gutterBottom>Border Radius</Typography>
<Slider
value={radius}
onChange={(e, v) => setRadius(v as number)}
onChange={(event, value) => setRadius(value as number)}
valueLabelDisplay="auto"
min={0}
max={50}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export default function ServerSideErrorHandling() {
<DataGridPro
{...props}
unstable_dataSource={dataSource}
unstable_onDataSourceError={(e) => setError(e.message)}
unstable_onDataSourceError={(dataSourceError) =>
setError(dataSourceError.message)
}
unstable_dataSourceCache={null}
apiRef={apiRef}
pagination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export default function ServerSideErrorHandling() {
<DataGridPro
{...props}
unstable_dataSource={dataSource}
unstable_onDataSourceError={(e) => setError(e.message)}
unstable_onDataSourceError={(dataSourceError) =>
setError(dataSourceError.message)
}
unstable_dataSourceCache={null}
apiRef={apiRef}
pagination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ export default function ServerSideTreeDataErrorHandling() {
{...props}
treeData
unstable_dataSource={dataSource}
unstable_onDataSourceError={(e, params) => {
unstable_onDataSourceError={(error, params) => {
if (!params.groupKeys || params.groupKeys.length === 0) {
setRootError(e.message);
setRootError(error.message);
} else {
setChildrenError(
`${e.message} (Requested level: ${params.groupKeys.join(' > ')})`,
`${error.message} (Requested level: ${params.groupKeys.join(' > ')})`,
);
}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ export default function ServerSideTreeDataErrorHandling() {
{...props}
treeData
unstable_dataSource={dataSource}
unstable_onDataSourceError={(e, params) => {
unstable_onDataSourceError={(error, params) => {
if (!params.groupKeys || params.groupKeys.length === 0) {
setRootError(e.message);
setRootError(error.message);
} else {
setChildrenError(
`${e.message} (Requested level: ${params.groupKeys.join(' > ')})`,
`${error.message} (Requested level: ${params.groupKeys.join(' > ')})`,
);
}
}}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/CustomizationPlayground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({

type TabsProps = {
value: string;
onChange: (e: React.SyntheticEvent, value: any) => void;
onChange: (event: React.SyntheticEvent, value: any) => void;
options: Partial<CustomizationLabelType>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function TimezonesDemo() {
const brandingTheme = useTheme();
const theme = createTheme({ palette: { mode: brandingTheme.palette.mode } });

const handleContinentClick: ContinentClickHandler = (e, newTimezone) => {
const handleContinentClick: ContinentClickHandler = (event, newTimezone) => {
if (selectedTimezone === newTimezone) {
setSelectedTimezone(null);
} else {
Expand Down
6 changes: 3 additions & 3 deletions docs/src/modules/components/overview/Keyboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,20 +410,20 @@ export default function Keyboard() {
const brandingTheme = useTheme();
const theme = createTheme({ palette: { mode: brandingTheme.palette.mode } });

const handleKeySelection = (e: React.SyntheticEvent, key: SelectedKey | null) => {
const handleKeySelection = (event: React.SyntheticEvent, key: SelectedKey | null) => {
const sectionContent = (ref.current as any).querySelector(
`.MuiPickersSectionList-section[data-sectionindex="${selectedSection.current || 0}"] .MuiPickersSectionList-sectionContent`,
);
sectionContent.focus();

if (key) {
const event = new KeyboardEvent('keydown', {
const keydownEvent = new KeyboardEvent('keydown', {
...key,
bubbles: true,
cancelable: true,
});

sectionContent.dispatchEvent(event);
sectionContent.dispatchEvent(keydownEvent);

if (key.key === 'Backspace') {
sectionContent.textContent = '';
Expand Down
12 changes: 6 additions & 6 deletions docs/src/modules/components/overview/WorldMapSvg.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@mui/internal-markdown": "^1.0.14",
"@mui/internal-test-utils": "^1.0.14",
"@mui/material": "^5.16.7",
"@mui/monorepo": "github:mui/material-ui#263c7259451d5b928bbdfd299c9c0afc89dfec02",
"@mui/monorepo": "github:mui/material-ui#95fd6b5c97aca84f1f8b02bfeefddf4a55baea5c",
"@mui/utils": "^5.16.6",
"@next/eslint-plugin-next": "14.2.13",
"@octokit/plugin-retry": "^7.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const useSetupPan = () => {

const handleUp = (event: PointerEvent) => {
eventCacheRef.current.splice(
eventCacheRef.current.findIndex((e) => e.pointerId === event.pointerId),
eventCacheRef.current.findIndex((cachedEvent) => cachedEvent.pointerId === event.pointerId),
1,
);
setIsInteracting(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const useSetupZoom = () => {

function pointerUpHandler(event: PointerEvent) {
eventCacheRef.current.splice(
eventCacheRef.current.findIndex((e) => e.pointerId === event.pointerId),
eventCacheRef.current.findIndex((cachedEvent) => cachedEvent.pointerId === event.pointerId),
1,
);

Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/ChartContainer/useDefaultizeAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const defaultizeAxis = (
return axisConfig;
}
if (dataset === undefined) {
throw Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
throw new Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
}
return {
...axisConfig,
Expand Down
8 changes: 4 additions & 4 deletions packages/x-charts/src/ChartsAxis/ChartsAxis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,31 @@ function ChartsAxis(props: ChartsAxisProps) {
const rightId = getAxisId(rightAxis, yAxisIds[0]);

if (topId !== null && !xAxis[topId]) {
throw Error(
throw new Error(
[
`MUI X: id used for top axis "${topId}" is not defined.`,
`Available ids are: ${xAxisIds.join(', ')}.`,
].join('\n'),
);
}
if (leftId !== null && !yAxis[leftId]) {
throw Error(
throw new Error(
[
`MUI X: id used for left axis "${leftId}" is not defined.`,
`Available ids are: ${yAxisIds.join(', ')}.`,
].join('\n'),
);
}
if (rightId !== null && !yAxis[rightId]) {
throw Error(
throw new Error(
[
`MUI X: id used for right axis "${rightId}" is not defined.`,
`Available ids are: ${yAxisIds.join(', ')}.`,
].join('\n'),
);
}
if (bottomId !== null && !xAxis[bottomId]) {
throw Error(
throw new Error(
[
`MUI X: id used for bottom axis "${bottomId}" is not defined.`,
`Available ids are: ${xAxisIds.join(', ')}.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/ChartsLegend/DefaultChartsLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function DefaultChartsLegend(props: LegendRendererProps) {
itemsToDisplay={seriesToDisplay}
onItemClick={
onItemClick
? (e, i) => onItemClick(e, seriesContextBuilder(seriesToDisplay[i]), i)
? (event, i) => onItemClick(event, seriesContextBuilder(seriesToDisplay[i]), i)
: undefined
}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/ChartsLegend/LegendPerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function LegendPerItem(props: LegendPerItemProps) {
markGap={markGap}
labelStyle={labelStyle}
classes={classes}
onClick={onItemClick ? (e) => onItemClick(e, i) : undefined}
onClick={onItemClick ? (event) => onItemClick(event, i) : undefined}
/>
))}
</ChartsLegendRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function PiecewiseColorLegend(props: PiecewiseColorLegendProps) {
itemsToDisplay={itemsToDisplay}
onItemClick={
onItemClick
? (e, i) => onItemClick(e, piecewiseColorContextBuilder(itemsToDisplay[i]), i)
? (event, i) => onItemClick(event, piecewiseColorContextBuilder(itemsToDisplay[i]), i)
: undefined
}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/context/ZAxisContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function ZAxisContextProvider(props: ZAxisContextProviderProps) {
return axisConfig;
}
if (dataset === undefined) {
throw Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
throw new Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
}
return {
...axisConfig,
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/hooks/useReducedMotion.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';
import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';

const handleMediaChange = (e: { matches: boolean | undefined }) => {
const handleMediaChange = (event: { matches: boolean | undefined }) => {
Globals.assign({
// Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
skipAnimation: e.matches || undefined,
skipAnimation: event.matches || undefined,
});
};

Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/internals/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const getStringSize = (text: string | number, style: React.CSSProperties
}, 0);

return result;
} catch (e) {
} catch {
return { width: 0, height: 0 };
}
};
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/internals/getPercentageValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getPercentageValue(value: number | string, refValue: number) {
return val;
}
}
throw Error(
throw new Error(
`MUI X: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`,
);
}
2 changes: 1 addition & 1 deletion packages/x-data-grid-generator/src/hooks/useMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function decodeParams(url: string): GridGetRowsParams {
for (const [key, value] of array) {
try {
decodedParams[key] = JSON.parse(value);
} catch (e) {
} catch {
decodedParams[key] = value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const getAggregationFunctionLabel = ({
aggregationRule.aggregationFunctionName,
)}` as 'aggregationFunctionLabelSum',
);
} catch (e) {
} catch {
return aggregationRule.aggregationFunctionName;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ export const useGridDataSource = (
apiRef.current.updateServerRows(getRowsResponse.rows, rowNode.path);
apiRef.current.setRowChildrenExpansion(id, true);
} catch (error) {
const e = error as Error;
apiRef.current.unstable_dataSource.setChildrenFetchError(id, e);
onError?.(e, fetchParams);
const childrenFetchError = error as Error;
apiRef.current.unstable_dataSource.setChildrenFetchError(id, childrenFetchError);
onError?.(childrenFetchError, fetchParams);
} finally {
apiRef.current.unstable_dataSource.setChildrenLoading(id, false);
nestedDataManager.setRequestSettled(id);
Expand Down
6 changes: 3 additions & 3 deletions packages/x-data-grid/src/components/cell/GridCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ const GridCell = React.forwardRef<HTMLDivElement, GridCellProps>(function GridCe
);
result.api = apiRef.current;
return result;
} catch (e) {
if (e instanceof MissingRowIdError) {
} catch (error) {
if (error instanceof MissingRowIdError) {
return EMPTY_CELL_PARAMS;
}
throw e;
throw error;
}
},
objectShallowCompare,
Expand Down
6 changes: 6 additions & 0 deletions packages/x-data-grid/src/utils/createSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const createSelector = ((
b: Function,
c?: Function,
d?: Function,
// eslint-disable-next-line id-denylist
e?: Function,
f?: Function,
...other: any[]
Expand All @@ -101,6 +102,7 @@ export const createSelector = ((

let selector: any;

// eslint-disable-next-line id-denylist
if (a && b && c && d && e && f) {
selector = (stateOrApiRef: any, instanceIdParam: any) => {
const isAPIRef = checkIsAPIRef(stateOrApiRef);
Expand All @@ -114,6 +116,7 @@ export const createSelector = ((
const ve = e(state, instanceId);
return f(va, vb, vc, vd, ve);
};
// eslint-disable-next-line id-denylist
} else if (a && b && c && d && e) {
selector = (stateOrApiRef: any, instanceIdParam: any) => {
const isAPIRef = checkIsAPIRef(stateOrApiRef);
Expand Down Expand Up @@ -173,6 +176,7 @@ export const createSelectorV8 = ((
b: Function,
c?: Function,
d?: Function,
// eslint-disable-next-line id-denylist
e?: Function,
f?: Function,
...other: any[]
Expand All @@ -183,6 +187,7 @@ export const createSelectorV8 = ((

let selector: any;

// eslint-disable-next-line id-denylist
if (a && b && c && d && e && f) {
selector = (stateOrApiRef: any, args: any, instanceIdParam: any) => {
const isAPIRef = checkIsAPIRef(stateOrApiRef);
Expand All @@ -196,6 +201,7 @@ export const createSelectorV8 = ((
const ve = e(state, args, instanceId);
return f(va, vb, vc, vd, ve, args);
};
// eslint-disable-next-line id-denylist
} else if (a && b && c && d && e) {
selector = (stateOrApiRef: any, args: any, instanceIdParam: any) => {
const isAPIRef = checkIsAPIRef(stateOrApiRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const formatTokenMap: FieldFormatTokenMap = {
ii: 'weekDay',
iii: { sectionType: 'weekDay', contentType: 'letter' },
iiii: { sectionType: 'weekDay', contentType: 'letter' },
// eslint-disable-next-line id-denylist
e: { sectionType: 'weekDay', contentType: 'digit', maxLength: 1 },
ee: 'weekDay',
eee: { sectionType: 'weekDay', contentType: 'letter' },
Expand Down
1 change: 1 addition & 0 deletions packages/x-date-pickers/src/AdapterMoment/AdapterMoment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const formatTokenMap: FieldFormatTokenMap = {

// Day of the week
E: { sectionType: 'weekDay', contentType: 'digit', maxLength: 1 },
// eslint-disable-next-line id-denylist
e: { sectionType: 'weekDay', contentType: 'digit', maxLength: 1 },
d: { sectionType: 'weekDay', contentType: 'digit', maxLength: 1 },
dd: { sectionType: 'weekDay', contentType: 'letter' },
Expand Down
Loading