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

Adopt prettier #1077

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

Adopt prettier #1077

wants to merge 1 commit into from

Conversation

obedm503
Copy link
Contributor

I'm making progress on #951 again but have hit a tricky wall. The code style is inconsistent and I don't know what style to follow. The project should adopt a formatting tool to enforce a consistent style to simplify external contributions. A possible solution is to adopt prettier.

The prettier config that best matches the current style is this:

{
  "semi": false,
  "singleQuote": true,
  "trailingComma": "all",
  "printWidth": 100
}

Another possible option to enable is arrowParens to either always require them or to avoid them. I'd recommend sticking to the default (always) but I know the current style sometimes avoids them.

This PR adds prettier, the prettier config, and the format npm script. I did not commit the changes resulting from running prettier to keep it focused. I can do that in a separate PR or you can just run the format script yourself.

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (2a78229) to head (c2e157c).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1077   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           55        55           
  Lines         1519      1519           
  Branches       347       347           
=========================================
  Hits          1519      1519           

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

@maxnowack
Copy link
Owner

Thanks for the PR! Currently those formatting things are handled by eslint (try to run npm run lint or use IDE plugins).

However, I want to move away from eslint anyway or at least with a much simpler configuration. The current configuration is grown historically and I just copy&paste it everytime I create a new project. eslint-config-airbnb is also not really state of the art anymore. There are also promising alternatives like oxlint.

Maybe we should go with prettier and oxlint to replace the current eslint setup. I'm also open to adopting new rules or changing existing ones, if the alternative is more standardized in the ecosystem.

I'm not sure how to proceed with this. I'm pretty busy at the moment and not sure when I'll have the time to adopt oxlint. If it's possible it would be great to have all formatting/linting changes in one commit and not separated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants