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

Consider oxlint as replacement of eslint #20279

Open
4 of 38 tasks
jelly opened this issue Apr 9, 2024 · 1 comment
Open
4 of 38 tasks

Consider oxlint as replacement of eslint #20279

jelly opened this issue Apr 9, 2024 · 1 comment

Comments

@jelly
Copy link
Member

jelly commented Apr 9, 2024

oxlint is an oxidized eslint written in Rust. It is vastly faster then eslint ~ 72 ms versus 17 seconds but as of now supports less rules.

So for us to switch we need to make sure all our plugins and rules are supported, this issue should track that. Our used plugins:

  • eslint-plugin-import
    • import/export
    • import/first
    • import/no-absolute-path
    • import/no-named-default
    • import/no-webpack-loader-syntax
  • eslint-plugin-jsx-a11y
  • eslint-plugin-n
  • eslint-plugin-promise
    • no-nesting
  • eslint-plugin-react
    • jsx-boolean-value
    • jsx-closing-bracket-location
    • jsx-closing-tag-location
    • jsx-curly-brace-presence
    • jsx-curly-newline
    • jsx-curly-spacing
    • jsx-equals-spacing
    • jsx-first-prop-new-line
    • jsx-fragments
    • jsx-handler-names
    • jsx-indent
    • jsx-indent-props
    • jsx-no-bind
    • jsx-pascal-case
    • jsx-props-no-multi-spaces
    • jsx-tag-spacing
    • jsx-uses-react
    • jsx-uses-vars
    • jsx-wrap-multilines
    • no-danger-with-children
    • no-did-update-set-state
    • no-unused-prop-types
    • prop-types
    • self-closing-comp
  • eslint-plugin-react-hooks (only react-hooks/exhaustive-deps missing)
  • eslint-plugin-core
  • eslint-typescript

Apart from speed, oxlint found issues which eslint did not catch:

Another benefit is that oxlint provides a native language-server while for eslint you need an alternative extension. While for oxlint you can use the native Rust binary for example in neovim.

Listing the rules we have enabled:

npm run eslint --print-config .eslintrc.json > eslint-custom-conifg.json
# number of rules enabled
cat eslint-custom-conifg.json | jq -r '.rules | length'
# rule names
cat eslint-custom-conifg.json | jq -r '.rules | keys | join("\n")'

React to-do generated with:

npx eslint --print-config .eslintrc.json | jq -r '.rules | keys | join("\n")'  | grep --color=never react | sed 's/react\///' | sed 's/-/_/g' > rules.txt

In oxlint git

for x in $(cat ~/projects/starter-kit/rules.txt); do git grep -q $x || echo "  - [ ] $x" | sed 's/_/-/g'; done
@jelly
Copy link
Member Author

jelly commented Jul 17, 2024

From eslint-plugin-promise we use param-names which is now implemented in oxc-project/oxc#4293 and merged.

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

No branches or pull requests

1 participant