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

front: get rid of repetitive imports #10783

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Akctarus
Copy link
Contributor

closes #8715

@Akctarus Akctarus requested a review from a team as a code owner February 12, 2025 14:23
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Feb 12, 2025
@Akctarus Akctarus force-pushed the tmn/front/enhance-repetitive-imports branch 2 times, most recently from 55a28b5 to b9c3411 Compare February 12, 2025 16:06
@Akctarus Akctarus force-pushed the tmn/front/enhance-repetitive-imports branch from b9c3411 to 864e68c Compare February 12, 2025 16:11
@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 53.03030% with 31 lines in your changes missing coverage. Please review.

Project coverage is 81.80%. Comparing base (3f83ed4) to head (864e68c).

Files with missing lines Patch % Lines
...cations/operationalStudies/components/NGE/index.ts 0.00% 1 Missing and 1 partial ⚠️
...ications/stdcm/components/StdcmHelpModule/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/BootstrapSNCF/CardSNCF/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/DotsLoader/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/EyeToggle/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/HelpModal/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/IntervalsEditor/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/Map/WarpedMap/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/ReleaseInformations/index.ts 0.00% 1 Missing and 1 partial ⚠️
front/src/common/SpeedLimitByTagSelector/index.ts 0.00% 1 Missing and 1 partial ⚠️
... and 7 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10783      +/-   ##
==========================================
- Coverage   81.83%   81.80%   -0.03%     
==========================================
  Files        1081     1099      +18     
  Lines      106882   106916      +34     
  Branches      729      745      +16     
==========================================
- Hits        87469    87467       -2     
- Misses      19372    19392      +20     
- Partials       41       57      +16     
Flag Coverage Δ
editoast 74.30% <ø> (-0.03%) ⬇️
front 89.34% <53.03%> (-0.04%) ⬇️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 88.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -19,7 +19,7 @@ import OPsSVGFile from 'assets/pictures/layersicons/ops.svg';
import switchesIcon from 'assets/pictures/layersicons/switches.svg';
import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
import { Modal } from 'common/BootstrapSNCF/ModalSNCF';
import SwitchSNCF from 'common/BootstrapSNCF/SwitchSNCF/SwitchSNCF';
import { SwitchSNCF } from 'common/BootstrapSNCF/SwitchSNCF';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can default export in SwitchSNCF/index and then:

Suggested change
import { SwitchSNCF } from 'common/BootstrapSNCF/SwitchSNCF';
import SwitchSNCF from 'common/BootstrapSNCF/SwitchSNCF';

@@ -0,0 +1,3 @@
import NGE from './NGE';

export default NGE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just rename NGE.tsx to index.tsx?

Comment on lines +1 to +3
import StdcmHelpModule from './StdcmHelpModule';

export default StdcmHelpModule;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply reeport default.

Suggested change
import StdcmHelpModule from './StdcmHelpModule';
export default StdcmHelpModule;
export { default } from './StdcmHelpModule';

same for all your index.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum I'm not sure it will be a default export like this

Copy link
Contributor

@anisometropie anisometropie Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

named reexports use as:

export { default as StdcmHelpModule } from './StdcmHelpModule'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make imports easier to read by eliminating unnecessary repetition
5 participants