Skip to content

Commit

Permalink
use readonly props to satisfy eslint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnize committed Nov 24, 2024
1 parent 8401223 commit de1414e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/DefaultCatchBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@tanstack/react-router";
import { Button } from "./ui/button";

export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
export function DefaultCatchBoundary({ error }: Readonly<ErrorComponentProps>) {
const router = useRouter();
const isRoot = useMatch({
strict: false,
Expand Down
6 changes: 3 additions & 3 deletions app/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Slot } from "@radix-ui/react-slot";
import { type VariantProps, cva } from "class-variance-authority";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";

import { cn } from "~/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
Expand Down Expand Up @@ -37,7 +37,7 @@ export interface ButtonProps
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
const Button = React.forwardRef<HTMLButtonElement, Readonly<ButtonProps>>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
Expand Down
2 changes: 1 addition & 1 deletion app/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function RootComponent() {
);
}

function RootDocument({ children }: { children: React.ReactNode }) {
function RootDocument({ children }: { readonly children: React.ReactNode }) {
return (
<html>
<head>
Expand Down
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ export default tseslint.config(
},
...react.configs["recommended-type-checked"],
},
{
rules: {
// You can override any rules here
// "@eslint-react/prefer-read-only-props": "off",
},
},
);

0 comments on commit de1414e

Please sign in to comment.