jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
13.81k stars 3.12k forks source link

Look into speeding up lint scripts #16226

Open jtpio opened 2 weeks ago

jtpio commented 2 weeks ago

We are currently using ESLint and Prettier to lint files on the JupyterLab code base:

https://github.com/jupyterlab/jupyterlab/blob/8819549495cd11470b4db7464d1d59c53cfce787/package.json#L72-L76

https://github.com/jupyterlab/jupyterlab/blob/8819549495cd11470b4db7464d1d59c53cfce787/package.json#L85-L87

These tools were originally chosen as they are very popular within the web development ecosystem.

However the lint scripts tend to take a few seconds to complete on the JupyterLab code base. Also since the JupyterLab code base is likely to grow over time with the addition of new packages, it's not clear the situation will actually improve in the future.

Similar to ruff, which is now used for linting Python code (https://github.com/jupyterlab/jupyterlab/pull/13562), there is an ongoing trend in the JS / TS ecosystem to also move to Rust-based tools for performing these kinds of tasks. The two main projects currently seem to be:

Also Biome has some utility scripts to migrate from ESLint and prettier:

It could be interesting to look into adopting one of those tools for JupyterLab development, if that can help improve the overall contributing experience.

jtpio commented 2 weeks ago

For reference the "Run test lint" step of the Lint workflow took ~90s to complete, looking at the latest commit (8819549495cd11470b4db7464d1d59c53cfce787):

image

krassowski commented 2 weeks ago

Yes, it also takes too long for precommit, I often get frustrated and need to context switch when committing. I think this is mostly eslint not prettier.

I wonder how smooth the transition would be. Any other large open source projects that recently migrated?

jtpio commented 2 weeks ago

Maybe it's still a bit early to fully switch.

I asked on their Discord. They also have a discussion listing a few projects using it: https://github.com/biomejs/biome/discussions/1582

Otherwise yes, it could be interesting to have a draft PR so we can try that more concretely, and see if it also improves the pre-commit workflow.

jtpio commented 2 weeks ago

Any other large open source projects that recently migrated?

I asked on their Discord

From the reply on the Biome Discord: