-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add eslint as part of tidy
run
#141705
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
Add eslint as part of tidy
run
#141705
Conversation
@@ -65,7 +65,4 @@ ENV SCRIPT \ | |||
python3 ../x.py test collect-license-metadata && \ | |||
# Runs checks to ensure that there are no issues in our JS code. | |||
es-check es2019 ../src/librustdoc/html/static/js/*.js && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels weird to run eslint locally, but not tsc
/es-check
. Is there a reason for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is kinda odd, and i wouldn't mind fixing it, but we are at least fully compatible with the latest version of tsc
, which is why i only complained about eslint.
my main concern is what happens if there is a too new version installed globally, as well as the correct version installed via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I like the implementation. There's just one problem with it - the checks won't be executed on CI at all now, unless I'm mistaken xD We only run tidy
on a single job (mingw-check-tidy
), which only runs on PR CI, not on full merge builds (I know, it's a mess), and that job doesn't have npm/nodejs installed, AFAIK, so effectively the tests won't be executed anywhere right now.
I think that we should just run the tidy job also on full merges, I'll ask on Zulip.
src/tools/tidy/src/rustdoc_js.rs
Outdated
|
||
const ESLINT_VERSION: &str = "8.6.0"; | ||
|
||
pub fn check(librustdoc_path: &Path, tools_path: &Path, bad: &mut bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It really feels like we should add a npm lockfile to tidy
, same as we have requirements.txt
. But that can be done later.
Anyway, that discussion is a bit orthogonal to this PR. In any case, we need to make sure that npm is available on the |
Added the installation of eslint into |
This comment has been minimized.
This comment has been minimized.
7c85dae
to
b1723fc
Compare
Thank you, looks great! You can r=me once CI is green. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8461db4
to
8645ef7
Compare
@bors r=Kobzol rollup |
Rollup of 11 pull requests Successful merges: - #137574 (Make `std/src/num` mirror `core/src/num`) - #141384 (Enable review queue tracking) - #141448 (A variety of improvements to the codegen backends) - #141636 (avoid some usages of `&mut P<T>` in AST visitors) - #141676 (float: Disable `total_cmp` sNaN tests for `f16`) - #141705 (Add eslint as part of `tidy` run) - #141715 (Add `loongarch64` with `d` feature to `f32::midpoint` fast path) - #141723 (Provide secrets to try builds with new bors) - #141728 (Fix false documentation of FnCtxt::diverges) - #141729 (resolve target-libdir directly from rustc) - #141732 (creader: Remove extraenous String::clone) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - #137574 (Make `std/src/num` mirror `core/src/num`) - #141384 (Enable review queue tracking) - #141448 (A variety of improvements to the codegen backends) - #141636 (avoid some usages of `&mut P<T>` in AST visitors) - #141676 (float: Disable `total_cmp` sNaN tests for `f16`) - #141705 (Add eslint as part of `tidy` run) - #141715 (Add `loongarch64` with `d` feature to `f32::midpoint` fast path) - #141723 (Provide secrets to try builds with new bors) - #141728 (Fix false documentation of FnCtxt::diverges) - #141729 (resolve target-libdir directly from rustc) - #141732 (creader: Remove extraenous String::clone) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #141705 - GuillaumeGomez:eslint-tidy, r=Kobzol Add eslint as part of `tidy` run Rustdoc uses `eslint` to run lints on the JS files. Currently you need to run it by hand since it's not part of any `x.py` command. This PR makes it part of `test tidy`. However, to prevent having all rust developers to install `npm` and `eslint`, I made it optional: if `eslint` is not installed, then the check is simply skipped (but will tell that it is being skipped). The second commit removes the manual checks from the docker file since `eslint` is run as part of tidy. cc `@lolbinarycat,` [#t-rustdoc > eslint seems to only be run in CI](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/eslint.20seems.20to.20only.20be.20run.20in.20CI/with/520761477)
Rustdoc uses
eslint
to run lints on the JS files. Currently you need to run it by hand since it's not part of anyx.py
command. This PR makes it part oftest tidy
. However, to prevent having all rust developers to installnpm
andeslint
, I made it optional: ifeslint
is not installed, then the check is simply skipped (but will tell that it is being skipped).The second commit removes the manual checks from the docker file since
eslint
is run as part of tidy.cc @lolbinarycat, #t-rustdoc > eslint seems to only be run in CI