-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Enforce JS formatting standards to improve readability and encourage collaboration #2096
Comments
There are plenty of formatters, linters, and standards to choose from. I haven't done a deep dive into what's available, but standardJS looks really nice. Here are some highlights:
|
We should also consider prettier. From @ianguerin:
|
Prettier also plays nicely with eslint with projects like eslint-config-prettier that ensure there are not conflicting rules with having both configured. Eslint seems to be more extensible, it lets you define your own rules, so you can enforce things like property name ordering, or import ordering, the possibilities are great. |
I've explored ways to minimize merge conflicts for projects that have extended MetacatUI. Here's the approach I tested: Setup:
Test 1: Merging both branches
Test 2: Applying prettier before merging
This indicates that proactive formatting could mitigate the impact of such changes on extended versions of MetacatUI. Since merge conflicts are somewhat inevitable when integrating updates, the additional formatting conflicts should be manageable. We could guide users on pre-formatting their code before merging the latest updates. Additionally, we could consider releasing linting changes separately from other updates in order make it easier for users to format their code and resolve conflicts independently of features/bug fixes. Otherwise, we could provide the exact commit hash for the formatting config, enabling users to cherry-pick this commit and apply prettier themselves. @vchendrix @helbashandy @yvanlebras - Given your experiences with extending MetacatUI, I’d love to hear your feedback on this approach! |
- Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096
- Initial prettier formatting run Issue #2096
- Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096
- Initial prettier formatting run Issue #2096
globally defined packages are specified in eslint config Issue #2096
globally defined packages are specified in eslint config Issue #2096
globally defined packages are specified in eslint config Issue #2096
- Run workflow on PRs only to avoid duplicated actions - Combine all checks into one workflow Issue #2096
- Run workflow on PRs only to avoid duplicated actions - Combine all checks into one workflow Issue #2096
- Reformat & cleanup the doc as well Issue #2096
- Reformat & cleanup the doc as well Issue #2096
- Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096
globally defined packages are specified in eslint config Issue #2096
Released in 2.29.1 |
- Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096
- Initial prettier formatting run Issue #2096
globally defined packages are specified in eslint config Issue #2096
- Run workflow on PRs only to avoid duplicated actions - Combine all checks into one workflow Issue #2096
- Reformat & cleanup the doc as well Issue #2096
- Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096
- Initial prettier formatting run Issue #2096
globally defined packages are specified in eslint config Issue #2096
Describe the feature you'd like
Select a code formatting standard, and enforce it using a shared JS formatter tool / linter. Reformat all JS files in MetacatUI to align with this standard. Consider also implementing a pre-commit hook to prevent unstyled code from being committed.
Is your feature request related to a problem? Please describe.
Code in MetacatUI uses a combination of tabs and spaces for indenting, and has many other stylistic inconsistencies. The result is that the code tends to be difficult to read, understand, and update. I believe these challenges are a barrier to onboarding new developers and discourage contributions from external developers.
Additional context
Given that this will cause major merge conflicts for users who have extended MetacatUI, and that any code that doesn't follow the new standard will not be valid, this should be considered a breaking change. This was discussed as part of the the 3.0.0 release.
The text was updated successfully, but these errors were encountered: