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

chore!: add biome instead of prettier for formatting #303

Open
wants to merge 21 commits into
base: refactor/react-redux
Choose a base branch
from

Conversation

curtisy1
Copy link

This also sets up the preliminary work needed to use biome as a linter instead of eslint by running lint:biome

Motivation

Biome is an alternative to Prettier and ESLint, written in Rust. The main advantage of it besides speed is that it gives very useful error messages when using it as a linter, for example

src/Components/Functions/path/normalizeSlash.ts:8:5 lint/style/noParameterAssign ━━━━━━━━━━━━━━━━━━━

  ✖ Reassigning a function parameter is confusing.
  
     6 │ const NormalizeSlash = (path: string): string => {
     7 │     if (path === "\\" || path === "/") return "/";
   > 8 │     path = path.replace(/\\/g, "/");
       │     ^^^^
     9 │ 
    10 │     if (path.length === 2 && /.:/.test(path)) return `${path}/`;
  
  ℹ The parameter is declared here:
  
    4 │  * @returns {string}
    5 │  */
  > 6 │ const NormalizeSlash = (path: string): string => {
      │                         ^^^^^^^^^^^^
    7 │     if (path === "\\" || path === "/") return "/";
    8 │     path = path.replace(/\\/g, "/");
  
  ℹ Use a local variable instead.

This makes it easier for newcomers to understand what's happening and fix issues accordingly. It also aligns nicely with Rust's error messages

Changes

Added a biome.json files with the default ruleset and applied the prettier config on top.
After that I ran yarn format on the code base to make biome format the whole code according to prettier specification

Additional Comments

Leaving this in Draft mode for now because I plan on using Biome as a linter as well, at least for everything that is not type-checking

Copy link

vercel bot commented Apr 14, 2024

@curtisy1 is attempting to deploy a commit to the Justin Maximillian Kimlim's projects Team on Vercel.

A member of the Team first needs to authorize it.

curtisy1 added 21 commits April 14, 2024 23:04
This also sets up the preliminary work needed to use biome as a linter instead of eslint by running lint:biome
This replaces unicode regex mechanism for diacritics
These should gradually be investigated and fixed without negatively impacting productivity
@curtisy1 curtisy1 marked this pull request as ready for review April 14, 2024 21:08
@curtisy1
Copy link
Author

I fixed most of the lint rules Biome provides. Some are too tedious to fix on a small note but they can be easily added and fixed gradually (and should be!)

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.

1 participant