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

Migrate default exports to named ones #2644

Merged
merged 1 commit into from
Aug 9, 2024
Merged

Conversation

connor-baer
Copy link
Member

@connor-baer connor-baer commented Aug 9, 2024

Purpose

Default exports cannot be easily discovered inside an editor: They cannot be suggested by the editor when the user tries to import a name.

Also, default exports don’t encourage consistency over a code base: the module that imports the default export must choose a name. It is likely that different modules use different names.

Moreover, default exports encourage exporting an object that acts as a namespace. This is a legacy pattern used to mimic CommonJS modules.

See https://biomejs.dev/linter/rules/no-default-export/

Approach and changes

  • Migrate all default exports to named ones

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

Default exports cannot be easily discovered inside an editor: They cannot be suggested by the editor when the user tries to import a name.

Also, default exports don’t encourage consistency over a code base: the module that imports the default export must choose a name. It is likely that different modules use different names.

Moreover, default exports encourage exporting an object that acts as a namespace. This is a legacy pattern used to mimic CommonJS modules.

See https://biomejs.dev/linter/rules/no-default-export/
Copy link

changeset-bot bot commented Aug 9, 2024

⚠️ No Changeset found

Latest commit: 7b9afdf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oss-circuit-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2024 10:56am

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 17 lines in your changes missing coverage. Please review.

Project coverage is 86.59%. Comparing base (aa44b07) to head (7b9afdf).

Files Patch % Lines
...cuit-ui/components/Step/examples/MultiStepForm.tsx 0.00% 8 Missing ⚠️
...uit-ui/components/Step/examples/CarouselSlider.tsx 0.00% 4 Missing ⚠️
...cuit-ui/components/Step/examples/YesOrNoSlider.tsx 0.00% 4 Missing ⚠️
...-ui/components/legacy/Tooltip/TooltipContainer.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2644   +/-   ##
=======================================
  Coverage   86.58%   86.59%           
=======================================
  Files         209      209           
  Lines       11907    11884   -23     
  Branches     1499     1499           
=======================================
- Hits        10310    10291   -19     
+ Misses       1544     1540    -4     
  Partials       53       53           
Files Coverage Δ
packages/circuit-ui/components/Anchor/Anchor.tsx 100.00% <100.00%> (ø)
packages/circuit-ui/components/Button/base.tsx 84.34% <100.00%> (ø)
.../circuit-ui/components/ButtonGroup/ButtonGroup.tsx 77.77% <100.00%> (ø)
...ckages/circuit-ui/components/Calendar/Calendar.tsx 93.52% <100.00%> (-0.04%) ⬇️
...it-ui/components/Card/components/Header/Header.tsx 100.00% <100.00%> (ø)
...ckages/circuit-ui/components/Carousel/Carousel.tsx 99.15% <100.00%> (ø)
...ents/Carousel/components/SlideImage/SlideImage.tsx 100.00% <100.00%> (ø)
...i/components/Carousel/components/Status/Status.tsx 100.00% <100.00%> (ø)
...ckages/circuit-ui/components/Checkbox/Checkbox.tsx 92.22% <100.00%> (ø)
...cuit-ui/components/CurrencyInput/CurrencyInput.tsx 98.91% <100.00%> (ø)
... and 53 more

@connor-baer connor-baer merged commit 168829d into main Aug 9, 2024
14 checks passed
@connor-baer connor-baer deleted the chore/no-default-export branch August 9, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant