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

Look into speeding up lint scripts #16226

Open
jtpio opened this issue Apr 23, 2024 · 4 comments
Open

Look into speeding up lint scripts #16226

jtpio opened this issue Apr 23, 2024 · 4 comments

Comments

@jtpio
Copy link
Member

jtpio commented Apr 23, 2024

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

jupyterlab/package.json

Lines 72 to 76 in 8819549

"eslint": "eslint --ext .js,.jsx,.ts,.tsx --cache --fix .",
"eslint:check": "eslint --ext .js,.jsx,.ts,.tsx --cache .",
"eslint:check:typed": "eslint --config .eslintrc.typecheck.js --ext .js,.jsx,.ts,.tsx --cache .",
"eslint:files": "eslint --fix",
"eslint:typed": "eslint --config .eslintrc.typecheck.js --cache --ext .js,.jsx,.ts,.tsx --fix .",

jupyterlab/package.json

Lines 85 to 87 in 8819549

"prettier": "prettier --list-different --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:files": "prettier --write",

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 (#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.

@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Apr 23, 2024
@jtpio
Copy link
Member Author

jtpio commented Apr 23, 2024

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

image

@krassowski
Copy link
Member

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
Copy link
Member Author

jtpio commented Apr 23, 2024

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: biomejs/biome#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
Copy link
Member Author

jtpio commented Apr 23, 2024

Any other large open source projects that recently migrated?

I asked on their Discord

From the reply on the Biome Discord:

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

3 participants