[WEB-5459] feat(codemods): add function declaration transformer with tests (#8137)

- Add jscodeshift-based codemod to convert arrow function components to function declarations
- Support React.FC, observer-wrapped, and forwardRef components
- Include comprehensive test suite covering edge cases
- Add npm script to run transformer across codebase
- Target only .tsx files in source directories, excluding node_modules and declaration files

* [WEB-5459] chore: updates after running codemod

---------

Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Aaron 2025-11-20 19:09:40 +07:00 committed by GitHub
parent 90866fb925
commit 83fdebf64d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1771 changed files with 17003 additions and 13856 deletions

View file

@ -24,7 +24,7 @@ type Props = {
workspaceSlug: string;
};
export const CommentCardDisplay: React.FC<Props> = observer((props) => {
export const CommentCardDisplay = observer(function CommentCardDisplay(props: Props) {
const {
activityOperations,
comment,

View file

@ -21,7 +21,7 @@ type Props = {
workspaceSlug: string;
};
export const CommentCardEditForm: React.FC<Props> = observer((props) => {
export const CommentCardEditForm = observer(function CommentCardEditForm(props: Props) {
const {
activityOperations,
comment,

View file

@ -24,7 +24,7 @@ type TCommentCard = {
projectId?: string;
};
export const CommentCard: FC<TCommentCard> = observer((props) => {
export const CommentCard = observer(function CommentCard(props: TCommentCard) {
const {
workspaceSlug,
comment,

View file

@ -26,7 +26,7 @@ type TCommentCreate = {
// services
const fileService = new FileService();
export const CommentCreate: FC<TCommentCreate> = observer((props) => {
export const CommentCreate = observer(function CommentCreate(props: TCommentCreate) {
const {
workspaceSlug,
entityId,

View file

@ -18,7 +18,7 @@ export type TProps = {
activityOperations: TCommentsOperations;
};
export const CommentReactions: FC<TProps> = observer((props) => {
export const CommentReactions = observer(function CommentReactions(props: TProps) {
const { comment, activityOperations, disabled = false } = props;
// state
const [isPickerOpen, setIsPickerOpen] = useState(false);

View file

@ -23,7 +23,7 @@ type TCommentsWrapper = {
showCopyLinkOption?: boolean;
};
export const CommentsWrapper: FC<TCommentsWrapper> = observer((props) => {
export const CommentsWrapper = observer(function CommentsWrapper(props: TCommentsWrapper) {
const {
entityId,
activityOperations,

View file

@ -22,7 +22,7 @@ type TCommentCard = {
showCopyLinkOption: boolean;
};
export const CommentQuickActions: FC<TCommentCard> = observer((props) => {
export const CommentQuickActions = observer(function CommentQuickActions(props: TCommentCard) {
const { activityOperations, comment, setEditMode, showAccessSpecifier, showCopyLinkOption } = props;
// store hooks
const { data: currentUser } = useUser();
@ -33,8 +33,8 @@ export const CommentQuickActions: FC<TCommentCard> = observer((props) => {
// translation
const { t } = useTranslation();
const MENU_ITEMS: TContextMenuItem[] = useMemo(
() => [
const MENU_ITEMS = useMemo(function MENU_ITEMS() {
return [
{
key: "edit",
action: setEditMode,
@ -72,9 +72,8 @@ export const CommentQuickActions: FC<TCommentCard> = observer((props) => {
icon: Trash2,
shouldRender: canDelete,
},
],
[activityOperations, canDelete, canEdit, comment, setEditMode, showAccessSpecifier, showCopyLinkOption]
);
];
});
return (
<CustomMenu ellipsis closeOnSelect>