Skip to content

Commit

Permalink
feat: alter default props eslint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
junseublim committed Jul 12, 2024
1 parent 82eeaa6 commit d21f2fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
{
"html": "ignore"
}
],
"react/require-default-props": [
"error", {
"functions" : "defaultArguments"
}
]
}
}
15 changes: 4 additions & 11 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
}

function Button({
className,
size,
className = '',
size = 'md',
children,
variant,
isSubmit,
variant = 'primary',
isSubmit = false,
...props
}: ButtonProps) {
const getSizeClass = () => {
Expand Down Expand Up @@ -51,11 +51,4 @@ function Button({
)
}

Button.defaultProps = {
variant: 'primary',
size: 'md',
className: '',
isSubmit: false,
}

export default Button
8 changes: 0 additions & 8 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ const ModalFooterConfirm = ({
)
}

ModalFooterConfirm.defaultProps = {
onConfirm: () => {},
}

const ModalFooterConfirmCancel = ({
cancelText,
confirmText,
Expand Down Expand Up @@ -216,10 +212,6 @@ const ModalFooterConfirmCancel = ({
)
}

ModalFooterConfirmCancel.defaultProps = {
onConfirm: () => {},
}

Modal.CenterModal = CenterModal
Modal.BottomModal = BottomModal
Modal.Close = ModalClose
Expand Down
9 changes: 2 additions & 7 deletions src/components/TagButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ interface TagButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
}

function TagButton({
className,
children,
isSubmit,
className = '',
isSubmit = false,
disabled,
size,
...props
Expand Down Expand Up @@ -43,9 +43,4 @@ function TagButton({
)
}

TagButton.defaultProps = {
className: '',
isSubmit: false,
}

export default TagButton

0 comments on commit d21f2fb

Please sign in to comment.