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

chore: upgrade react-compiler's eslint and babel plugins #418

Merged
merged 2 commits into from
Sep 7, 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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@
"@types/react-signature-canvas": "^1.0.5",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"babel-plugin-react-compiler": "0.0.0-experimental-7d62301-20240821",
"babel-plugin-react-compiler": "0.0.0-experimental-7449567-20240905",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-compiler": "0.0.0-experimental-8e3b87c-20240821",
"eslint-plugin-react-compiler": "0.0.0-experimental-8d8bd53-20240905",
"eslint-plugin-react-hooks": "5.1.0-beta-26f2496093-20240514",
"globals": "^15.9.0",
"postcss": "^8.4.45",
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 38 additions & 34 deletions src/components/ui/input-datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface InputDatetimeProps extends React.HTMLAttributes<HTMLDivElement> {

function InputDatetime(props: InputDatetimeProps) {
const elementId = React.useRef(generateShortId());
// eslint-disable-next-line react-compiler/react-compiler
const id = props.id ?? elementId.current;

const [date, setDate] = React.useState<Date | undefined>(
Expand Down Expand Up @@ -62,42 +63,45 @@ function InputDatetime(props: InputDatetimeProps) {
className="flex h-10 items-center justify-start gap-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background duration-100 focus-within:border-input focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50"
{...getRootProps()}
>
{segments.map((segment, idx) => {
if (segment.type === "separator") {
{
// eslint-disable-next-line react-compiler/react-compiler
segments.map((segment, idx) => {
if (segment.type === "separator") {
return (
<span
key={`${id}-separator-${idx}`}
className="separator m-0 font-mono text-[60%] text-muted-foreground"
>
{segment.value}
</span>
);
}

const inputId = idx === 0 ? id : `${id}-${segment.type}`;
const placeholder =
segment.type !== "am/pm" ? segment.value : undefined;

return (
<span
key={`${id}-separator-${idx}`}
className="separator m-0 font-mono text-[60%] text-muted-foreground"
>
{segment.value}
</span>
<input
key={`${id}-${segment.type}-${idx}`}
id={inputId}
placeholder={placeholder}
disabled={props.disabled}
readOnly={props.readOnly}
onFocus={props.onDateFocus}
onBlur={props.onDateBlur}
className="inline-block h-full flex-grow-0 rounded-sm border-none bg-transparent px-0.5 font-sans text-sm tabular-nums text-foreground caret-transparent outline-none ring-0 selection:bg-foreground selection:text-background placeholder:font-mono focus:bg-foreground focus:text-background focus:ring-0"
style={
{
"--char-length": `${segment.type === "years" ? 4 : segment.type === "am/pm" ? 2.5 : 2}ch`,
minWidth: "calc(var(--char-length) + 0.25rem)",
} as React.CSSProperties
}
{...getInputProps(segment.type)}
/>
);
}

const inputId = idx === 0 ? id : `${id}-${segment.type}`;
const placeholder =
segment.type !== "am/pm" ? segment.value : undefined;

return (
<input
key={`${id}-${segment.type}-${idx}`}
id={inputId}
placeholder={placeholder}
disabled={props.disabled}
readOnly={props.readOnly}
onFocus={props.onDateFocus}
onBlur={props.onDateBlur}
className="inline-block h-full flex-grow-0 rounded-sm border-none bg-transparent px-0.5 font-sans text-sm tabular-nums text-foreground caret-transparent outline-none ring-0 selection:bg-foreground selection:text-background placeholder:font-mono focus:bg-foreground focus:text-background focus:ring-0"
style={
{
"--char-length": `${segment.type === "years" ? 4 : segment.type === "am/pm" ? 2.5 : 2}ch`,
minWidth: "calc(var(--char-length) + 0.25rem)",
} as React.CSSProperties
}
{...getInputProps(segment.type)}
/>
);
})}
})
}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function ReportTableContent<TData, TValue>(
}
return colSizes;
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [table.getState().columnSizingInfo, table.getFlatHeaders()]);

const visibleColumns = React.useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ViewColumns: ReportTablePlugin = (props) => {
const allLeafColumns = React.useMemo(
() => table.getAllLeafColumns(),
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
[table.getAllLeafColumns()]
);

Expand Down
2 changes: 1 addition & 1 deletion src/routes/_auth/-modules/table-list/column-visibility.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function TableListColumnVisibilityDropdown() {
const columns = React.useMemo(
() => table.getAllColumns(),
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
[table.getAllColumns()]
);

Expand Down
2 changes: 1 addition & 1 deletion src/routes/_auth/-modules/table-list/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function TableListContent(props: TableListContentProps) {
const rowModel = React.useMemo(
() => table.getRowModel(),
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
[table.getRowModel()]
);

Expand Down
4 changes: 2 additions & 2 deletions src/routes/_auth/-modules/table-list/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function TableListToolbarActions({
const tableFilters = React.useMemo(
() => table.getState().columnFilters,
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
[table.getState().columnFilters]
);

Expand Down Expand Up @@ -280,7 +280,7 @@ function ToolbarFilter({
const baseState = React.useMemo(
() => table.getState().columnFilters.find((item) => item.id === id),
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps, react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
[id, table.getState().columnFilters]
);

Expand Down