Skip to content

eslint configuration not handling unassigned imports #775

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

Closed
roberttran-cc opened this issue Jun 16, 2023 · 1 comment
Closed

eslint configuration not handling unassigned imports #775

roberttran-cc opened this issue Jun 16, 2023 · 1 comment
Labels
maintenance Code refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)

Comments

@roberttran-cc
Copy link
Member

Little reminder:

// this is an unassigned import
import '../cc-button/cc-button.js';

Although all other imports are correctly sorted, unassigned imports are not checked and there are some disparities between components: in one component, unassigned imports are coded before all imports, in an another, they are coded after.

We use the eslint-plugin-import plugin which clearly state:

Unassigned imports are ignored, as the order they are imported in may be important.

And it seems this behavior won't be considered anytime soon by this plugin.

Maybe consider testing the sort-imports rule built in eslint, especially the membersyntaxsortorder option.

Note: the eslint-plugin-simple-import-sort dependency in our package.json is not used, we can remove it as part of this issue.

@roberttran-cc roberttran-cc added the maintenance Code refactoring, project structure, dev tooling (storybook, dev server, npm tasks...) label Jun 16, 2023
@florian-sanders-cc
Copy link
Contributor

florian-sanders-cc commented Aug 5, 2024

@roberttran-cc I didn't know about this issue but this is very clear and well documented, gg! 👏

If it's ok with you I'll close it because the import order is now handled by prettier thanks to @Galimede!

Also, the eslint-plugin-simple-import-sort is still in our deps even though we don't use it ( 🙈 ) but I've removed it from the project within the eslint flat config migration PR 👍

(feel free to reopen if you think I've missed something)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Code refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)
Projects
None yet
Development

No branches or pull requests

2 participants