8000 Add BiomeJS for Linting and Formatting JavaScript relates to #1295 by oxdev03 · Pull Request #1299 · maybe-finance/maybe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add BiomeJS for Linting and Formatting JavaScript relates to #1295 #1299

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

Conversation

oxdev03
Copy link
Contributor
@oxdev03 oxdev03 commented Oct 13, 2024

Summary:

Why BiomeJS:

  • https://github.com/biomejs/biome
  • Biome offers a lighter and faster alternative to using ESLint and Prettier combined, providing the same functionality in a single tool.
  • Simplifies configuration by reducing the need for multiple tools and configurations.

Open Points:

  • Update the Wiki to include instructions on how to format and lint JS code using Biome.
  • Check whether the current lint rules are sufficient.

biome.json Outdated
"formatter": {
"enabled": true,
"indentStyle": "tab",
"useEditorconfig": true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently, our .editorconfig has:

indent_style = space
indent_size = 2

Will this conflict since it's using tabs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, indentStyle overrides the imported editorconfig. I removed it, so its consistent across all files.

@zachgoll
Copy link
Collaborator
zachgoll commented Oct 14, 2024

@oxdev03 thanks for the comprehensive integration here! Haven't used Biome yet, but seems like an overall good fit for the project regarding simplicity and performance.

Just jotting down the steps I took to get my local environment setup with VSCode for others:

  1. Install Biome VSC extension
  2. Add Biome as default formatter for JS in settings
{
    "[javascript]": {
      "editor.formatOnSave": true,
      "editor.defaultFormatter": "biomejs.biome",
    }
}
  1. npm install to install dev dependencies
  2. (optional) restart editor

shell: bash

- name: Lint/Format js code
run: npm run style:check
Copy link
Collaborator
@zachgoll zachgoll Oct 14, 2024

Choose a reason for hiding this comment

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

To keep this as low-overhead as possible, I think we should just enforce the linting:

run: npm run lint

The formatting is a nice addition that I'll be using locally, but don't want that to be a requirement for new contributors and also for pushing hot fixes directly to main (our internal team does this occasionally to fix tiny bugs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it, even if its not a best practice.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@oxdev03 correct, not best practice and that's 100% fine at our stage/size

@oxdev03
Copy link
Contributor Author
oxdev03 commented Oct 14, 2024
{
    "[javascript]": {
      "editor.formatOnSave": true,
      "editor.defaultFormatter": "biomejs.biome",
    }
}

yes , the contributor would also need to have nodejs installed. I added the autosave to the vscode/settings.json file to the project.

If the DevContainer is used no additional steps are required.

Copy link
Collaborator
@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for setting this up!

@zachgoll zachgoll merged commit 4ad28d6 into maybe-finance:main Oct 14, 2024
5 checks passed
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
0