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

Adding oxlint, removing eslint, adding husky pre-commit #2012

Merged
merged 11 commits into from
Feb 11, 2025
Merged

Conversation

45930
Copy link
Contributor

@45930 45930 commented Feb 6, 2025

  • Replace eslint with oxlint
    • We already don't actually use eslint, so giving the faster newer library a chance, we can roll this back later if we want
    • Starting with a handful of rules turned off, specifically ones that we currently break, and may want to continue breaking
  • Add a CI workflow that enforces new files (diffed against main) follow the oxlint, as well as prettier rules
  • Add a pre-commit flow to automatically fix style and linter errors
    • This is off by default, and checks for husky.optin=true in your git config

@mitschabaude
Copy link
Contributor

isn't running lint:fix on every commit a bit too proactive? in my experience linter errors have plenty of false positives

where does the desire for linting come from?
IMHO TS serves as a pretty good linter to catch simple mistakes, and you don't really want a linter for anything else

@45930
Copy link
Contributor Author

45930 commented Feb 6, 2025

o1js is full of inconsistent styling, which isn't the end of the world, but does cause a lot of noise in PRs. We also have seen more formatting requests in PRs lately, so we are discussing enforcing a more uniform style.

There are 2 questions:

  1. Should we bother enforcing any style?
  2. If yes, how strictly should we enforce it?

My answers are 1: yes 2: not strictly. The pre-commit hook can easily be skipped, but it just reminds the developer to think about it.

@mitschabaude
Copy link
Contributor

@45930 if it's about code style, isn't prettier enough though?

on first glance oxlint seems to be a mix of:

  • stuff that TS already does
  • stuff that prettier already does
  • catching dumb mistakes of using the language in a wrong way

maybe it's worth it for the third point, let's see. I'll complain if it gets annoying :D

@45930
Copy link
Contributor Author

45930 commented Feb 6, 2025

catching dumb mistakes of using the language in a wrong way

I think the biggest things are unused imports and function arguments, which are really low stakes, but just kind of look sloppy. I think you're fair to question the value of this if if also reduces velocity. Let's see what others think.

@45930
Copy link
Contributor Author

45930 commented Feb 6, 2025

@mitschabaude FYI this will be the next iteration based on internal chat:

  • pre-commit to be made opt-in since many people don't like it
  • CI rule to check changed files against prettier and oxlint rules
    • Add a tag to skip this check when needed
    • Keep oxlint rules limited

The CI rule is expected to be annoying at first, but it encourages developers to either use the pre-commit hook, or set up their devenv to format code correctly using whatever tools they prefer. As for oxlint, just don't make any dumb mistakes

@mitschabaude
Copy link
Contributor

The CI rule is expected to be annoying at first, but it encourages developers to either use the pre-commit hook, or set up their devenv to format code correctly using whatever tools they prefer. As for oxlint, just don't make any dumb mistakes

sounds good to me! thanks

@45930 45930 marked this pull request as ready for review February 6, 2025 21:03
@45930 45930 requested a review from a team as a code owner February 6, 2025 21:03
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

please update the npm-deps-hash

Copy link
Member

@Trivo25 Trivo25 left a comment

Choose a reason for hiding this comment

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

nice!

@45930
Copy link
Contributor Author

45930 commented Feb 11, 2025

@Geometer1729 do you know how to dismiss the github actions bot stale review? I think it's blocking merging of this PR.

@45930 45930 merged commit d59955a into main Feb 11, 2025
31 of 32 checks passed
@45930 45930 deleted the 2025-02-oxlint branch February 11, 2025 15:10
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.

3 participants