Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Mark the props of the component as read-only. (non-standard props)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 18, 2023
1 parent 8198a82 commit e267aef
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ interface ThoughtProps {
thought: Thought;
}

function ArchivedBoardThought({ thought }: ThoughtProps): React.ReactElement {
function ArchivedBoardThought({
thought,
}: Readonly<ThoughtProps>): React.ReactElement {
return (
<li data-testid={'thought' + thought.id} className="archived-thought">
<p className="message">{thought.message}</p>
Expand All @@ -51,7 +53,7 @@ function ArchivedBoardThought({ thought }: ThoughtProps): React.ReactElement {
function ArchivedBoardColumn({
column,
thoughts,
}: ColumnProps): React.ReactElement {
}: Readonly<ColumnProps>): React.ReactElement {
return (
<div data-testid="archived-column" className="archived-column">
<ColumnHeader initialTitle={column.title} type={column.topic} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type FeedbackStarsProps = {
onChange: (stars: number) => void;
};

function FeedbackStars(props: FeedbackStarsProps) {
function FeedbackStars(props: Readonly<FeedbackStarsProps>) {
const { value, onChange } = props;
const [hoveredStarValue, setHoveredStarValue] = useState<number>(-1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type AddActionItemProps = {
hideComponentCallback: () => void;
};

function AddActionItem(props: AddActionItemProps) {
function AddActionItem(props: Readonly<AddActionItemProps>) {
const { hideComponentCallback, thoughtId } = props;

const team = useRecoilValue(TeamState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface AddBoardOwnersFormProps {
email2?: string;
}

function AddBoardOwnersForm(props: AddBoardOwnersFormProps) {
function AddBoardOwnersForm(props: Readonly<AddBoardOwnersFormProps>) {
const { email1 = '', email2 = '' } = props;

const setModalContents = useSetRecoilState(ModalContentsState);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Assets/CheckedCheckboxIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {
className?: string;
}

function CheckedCheckboxIcon({ color, className }: Props) {
function CheckedCheckboxIcon({ color, className }: Readonly<Props>) {
return (
<svg
role="presentation"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Common/AuthTemplate/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface FormProps extends ComponentPropsWithoutRef<'form'> {
disableSubmitBtn?: boolean;
}

function Form(props: FormProps): React.ReactElement {
function Form(props: Readonly<FormProps>): React.ReactElement {
const {
onSubmit,
errorMessages = [],
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Common/ColumnHeader/ColumnHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface ColumnHeaderProps extends HTMLAttributes<HTMLDivElement> {
onTitleChange?(title: string): void;
}

function ColumnHeader(props: ColumnHeaderProps): React.ReactElement {
function ColumnHeader(props: Readonly<ColumnHeaderProps>): React.ReactElement {
const {
initialTitle = '',
type = '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface DeletionOverlayProps {
className?: string;
}

function DeleteColumnItem(props: DeletionOverlayProps) {
function DeleteColumnItem(props: Readonly<DeletionOverlayProps>) {
const { onConfirm, onCancel, children, height, className } = props;

const cancelButtonRef = useRef<HTMLButtonElement>(null);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Common/CountSeparator/CountSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
count: number;
}

function CountSeparator(props: SeparatorProps): ReactElement {
function CountSeparator(props: Readonly<SeparatorProps>): ReactElement {
const { count, ...divProps } = props;
return (
<div {...divProps} className="count-separator" data-testid="countSeparator">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Common/DateCreated/DateCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type DateCreatedProps = {
className?: string;
};

export function DateCreated(props: DateCreatedProps) {
export function DateCreated(props: Readonly<DateCreatedProps>) {
const { date, className, disabled = false, readOnly = false } = props;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ interface RuleProps {
text: string;
}

function HorizontalRuleWithText(props: RuleProps): React.ReactElement {
function HorizontalRuleWithText(
props: Readonly<RuleProps>
): React.ReactElement {
const { text } = props;
return (
<div className="or-separator-line">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Common/UpvoteCount/UpvoteCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Props {
votes: number;
}

function UpvoteCount({ votes }: Props): React.ReactElement {
function UpvoteCount({ votes }: Readonly<Props>): React.ReactElement {
return (
<div className="upvote-count">
<div className="star-icon">
Expand Down

0 comments on commit e267aef

Please sign in to comment.