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

Object descructuring wrong formatted #680

Open
manni497 opened this issue Oct 31, 2024 · 0 comments
Open

Object descructuring wrong formatted #680

manni497 opened this issue Oct 31, 2024 · 0 comments

Comments

@manni497
Copy link

Hello,

I started using dprint and I noticed a strange behaviour when descructuring objects.

dprint-plugin-typescript version: 0.93.1

I leave you two examples:

  const { activeTestLabelsTypeIds, setTestsBookPlanningFilter, testsBookPlanningFilter, setSelectedTestIds, isTestsBooksLoading } = useTestsBookPlanningContext();
 
  const { pagination, sorting, setPagination, setSorting, expanded, setExpanded } = useReactDataTableState<TModel, TestsBookPlanningFilter>({
    initialPagination: { pageSize: isDashboard ? MAX_DASHBOARD_TABLES_ITEMS : pageSize },
    initialSorting: orderBy ? { id: orderBy, desc } : undefined,
  });

When the line exceeds the print width, I would expect that the descructured properties are splitted in multiple lines like

cconst {
  activeTestLabelsTypeIds,
  setTestsBookPlanningFilter,
  testsBookPlanningFilter,
  setSelectedTestIds,
  isTestsBooksLoading,
} = useTestsBookPlanningContext();

const {
  pagination,
  sorting,
  setPagination,
  setSorting,
  expanded,
  setExpanded,
} = useReactDataTableState<TModel, TestsBookPlanningFilter>({
  initialPagination: { pageSize: isDashboard ? MAX_DASHBOARD_TABLES_ITEMS : pageSize },
  initialSorting: orderBy ? { id: orderBy, desc } : undefined,
});

For actual output, you can see this playground

Is this configurable in some way? If not, could it be added?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant