cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
10.92k stars 1.09k forks source link

Consider oxlint as replacement of eslint #20279

Open jelly opened 4 months ago

jelly commented 4 months ago

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:

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 commented 1 month ago

From eslint-plugin-promise we use param-names which is now implemented in https://github.com/oxc-project/oxc/pull/4293 and merged.