Skip to content

Commit 02f47cc

Browse files
Merge pull request #6111 from bryceosterhaus/LPD-26040
chore: enable react-compiler eslint rule
2 parents faec6ad + 90d046b commit 02f47cc

File tree

12 files changed

+30
-37
lines changed

12 files changed

+30
-37
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = {
4646
},
4747
],
4848
'react/no-unescaped-entities': 'off',
49+
'react-compiler/react-compiler': 'error',
4950
'react-hooks/exhaustive-deps': 'off',
5051
'sort-vars': 'error',
5152
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"css-loader": "^2.1.1",
8686
"esbuild": "^0.25.6",
8787
"eslint": "^7.1.0",
88-
"eslint-plugin-react-compiler": "^19.0.0-beta-6fc168f-20241025",
88+
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
8989
"fork-ts-checker-webpack-plugin": "^4.0.3",
9090
"jest": "27.5.1",
9191
"jest-fetch-mock": "^3.0.3",

packages/clay-charts/src/BillboardWrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const BillboardWrapper = ({
5858
}
5959
}
6060

61+
// eslint-disable-next-line react-compiler/react-compiler
6162
forwardRef.current = null;
6263
};
6364
}, []);

packages/clay-charts/src/GeoMap.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const Geomap = ({
243243

244244
React.useEffect(() => {
245245
if (forwardRef) {
246+
// eslint-disable-next-line react-compiler/react-compiler
246247
forwardRef.current = new GeomapBase({
247248
...otherProps,
248249
data,

packages/clay-charts/src/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@ const ClayChart = React.forwardRef<HTMLDivElement, IProps>(
4747
({color, data, elementProps, grid, line, point, ...otherProps}, ref) => {
4848
const defaultRef = React.useRef<any>();
4949

50+
const renderData = {...data};
51+
5052
let ChartComponent;
5153

5254
switch (data.type as Types) {
5355
case 'geo-map':
54-
delete data.type;
56+
delete renderData.type;
5557

5658
ChartComponent = GeoMap;
5759
break;
5860
case 'predictive':
59-
delete data.type;
61+
delete renderData.type;
6062

6163
ChartComponent = Predictive;
6264
break;
@@ -68,7 +70,7 @@ const ClayChart = React.forwardRef<HTMLDivElement, IProps>(
6870
<ChartComponent
6971
{...otherProps}
7072
color={{pattern: DEFAULT_COLORS, ...color}}
71-
data={data as Data}
73+
data={renderData as Data}
7274
elementProps={elementProps}
7375
grid={Object.assign(DEFAULT_GRID_OBJECT, grid)}
7476
line={{classes: DEFAULT_LINE_CLASSES, ...line}}

packages/clay-core/src/collection/useCollection.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ export function useCollection<
256256
[performFilter, publicApi, itemIdKey]
257257
);
258258

259+
const virtualizerItems = virtualizer?.getVirtualItems();
260+
259261
const performCollectionRender = useCallback(
260262
({children, items}: ICollectionProps<T, P>) => {
261263
if (children instanceof Function && items) {
@@ -370,7 +372,7 @@ export function useCollection<
370372
[
371373
performItemRender,
372374
publicApi,
373-
virtualizer?.getVirtualItems().length,
375+
virtualizerItems?.length,
374376
visibleKeys,
375377
itemIdKey,
376378
]

packages/clay-core/src/overlay-mask/OverlayMask.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export function OverlayMask<T>({
205205
if (typeof ref === 'function') {
206206
ref(node);
207207
} else if (ref !== null) {
208+
// eslint-disable-next-line react-compiler/react-compiler
208209
(ref as React.MutableRefObject<any>).current = node;
209210
}
210211
},

packages/clay-core/stories/TreeView.stories.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,6 @@ export const PreSelectedItems = (args: any) => {
647647
// Just to avoid TypeScript error with required props
648648
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
649649

650-
OptionalCheckbox.displayName = 'ClayCheckbox';
651-
652650
return (
653651
<TreeView
654652
defaultItems={ITEMS_DRIVE}
@@ -695,8 +693,6 @@ export const Disabled = () => {
695693
// Just to avoid TypeScript error with required props
696694
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
697695

698-
OptionalCheckbox.displayName = 'ClayCheckbox';
699-
700696
return (
701697
<TreeView
702698
defaultItems={ITEMS_DRIVE}
@@ -734,8 +730,6 @@ export const MultipleSelection = (args: any) => {
734730
// Just to avoid TypeScript error with required props
735731
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
736732

737-
OptionalCheckbox.displayName = 'ClayCheckbox';
738-
739733
return (
740734
<TreeView
741735
defaultItems={ITEMS_DRIVE}
@@ -787,8 +781,6 @@ export const MultipleSelectionWithAsyncLoad = (args: any) => {
787781
// Just to avoid TypeScript error with required props
788782
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
789783

790-
OptionalCheckbox.displayName = 'ClayCheckbox';
791-
792784
return (
793785
<TreeView
794786
defaultItems={ITEMS_DRIVE}
@@ -915,8 +907,6 @@ export const ExpandOnCheck = (args: any) => {
915907
// Just to avoid TypeScript error with required props
916908
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
917909

918-
OptionalCheckbox.displayName = 'ClayCheckbox';
919-
920910
return (
921911
<TreeView
922912
defaultItems={ITEMS_DRIVE}
@@ -1238,8 +1228,6 @@ export const SelectionWithFilter = () => {
12381228

12391229
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
12401230

1241-
OptionalCheckbox.displayName = 'ClayCheckbox';
1242-
12431231
const itemsFiltered = useMemo<any>(() => {
12441232
if (!value) {
12451233
return items;
@@ -1305,8 +1293,6 @@ export const PerformanceTest = () => {
13051293
// Just to avoid TypeScript error with required props
13061294
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
13071295

1308-
OptionalCheckbox.displayName = 'ClayCheckbox';
1309-
13101296
const itemsFiltered = useMemo<Data>(() => {
13111297
if (!value) {
13121298
return items;
@@ -1522,8 +1508,6 @@ export const DemoCategoriesMultiple = () => {
15221508
// Just to avoid TypeScript error with required props
15231509
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
15241510

1525-
OptionalCheckbox.displayName = 'ClayCheckbox';
1526-
15271511
return (
15281512
<TreeView
15291513
defaultItems={[
@@ -1673,8 +1657,6 @@ export const DemoDocumentsMultiple = () => {
16731657
// Just to avoid TypeScript error with required props
16741658
const OptionalCheckbox = (props: any) => <Checkbox {...props} />;
16751659

1676-
OptionalCheckbox.displayName = 'ClayCheckbox';
1677-
16781660
const MAPPING_ICON = {
16791661
article: 'web-content',
16801662
documents: 'documents-and-media',

packages/clay-drop-down/src/Items.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ const Contextual = ({
210210
});
211211

212212
const setThrottleVisible = useCallback(
213+
// eslint-disable-next-line react-compiler/react-compiler
213214
throttle((value: boolean) => setVisible(value), 100),
214215
[]
215216
);

packages/clay-shared/src/FocusScope.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const FocusScope = ({
114114

115115
if (ref) {
116116
if (typeof ref === 'object') {
117+
// eslint-disable-next-line react-compiler/react-compiler
117118
ref.current = r;
118119
} else if (typeof ref === 'function') {
119120
ref(r);

0 commit comments

Comments
 (0)