-
Notifications
You must be signed in to change notification settings - Fork 3
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
Code formatting #51
Comments
@ann-kilzer would like to hear your opinion since both of us will be working on this project a lot so let me know if you have preferences 👀 Also, if it's alright with you, I'd like to pick this up 🤚 |
Since eslint has added formatting and stylistic rules, I don't like using prettier. It's another tool to manage and complicates the build steps. We have some formatting in place. Are there any gaps you notice? |
I format on save which adds semicolons orz I don't think eslint have any power over it (or it doesn't care). |
Sample of my dev experience, notice it adds semicolons on line 1 and 2 Screen.Recording.2024-07-06.at.22.36.27.mov |
We may have different people with different developer environments working on the project, and so we have to find a way to align our tooling. I like EditorConfig for a lot of this, and I'll update the eslint rules to have a semi rule. I can look into import order too The video you share above may be a result of the Prettier plugin. You should disable for this workspace: https://stackoverflow.com/a/75471109/1860768 |
The eslint plugins we use at work for import sort order are:
Just sharing for reference! Those two work really well |
@sirbully Thanks for sharing! 🤩 I will have to take more time to look at perfectionist in detail. simple-import-sort looks interesting and straightforward. If we want something more configurable, I notice https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md . What do you think? One note with MUI is we should encourage full imports |
Hey @ann-kilzer, did a little more digging into this. We moved away from Upon checking, I also checked Perfectionist should be super easy to setup! We just need to decide how we want to organize or imports (and exports if you care about that, but from what I noticed we usually export default, so we don't have to setup sorting for exports). No worries about MUI since the importing plugin only checks after the |
Sample setup, docs here: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#sort-imports
|
@sirbully Interesting, thanks for looking into it. It looks like it might be helpful in a larger software project, at the same time, I'd like to keep this codebase lean in terms of features and maintenance. I notice eslint has a built-in import sorting rule: https://eslint.org/docs/latest/rules/sort-imports Would you think this rule would suffice? Or do you find the grouping to be helpful? |
@ann-kilzer I personally prefer the grouped sorting as it helps with code readability and I feel that a clear import pattern as early as now contributes to the maintainability of our project in the long term. We will only need to set this up once so it won't have a lot of overhead and will be as lean as possible 🙇♀️ |
Cool, let's give it a try then |
I notice while working on the coverage issue that we haven't streamlined formatting our code. I'd like to recommend Prettier 🙌 It would also be nice to enforce and automatically handle sort order of our imports.
The text was updated successfully, but these errors were encountered: