Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7e189a0

Browse files
authored
Rollup merge of #146041 - lolbinarycat:tidy-escheck-bless, r=Kobzol
tidy: --bless now makes escheck run with --fix this mirrors how other extra-check tools work. unsure if this also needs to be done for tsc and es-check.
2 parents 9edce86 + ef94abd commit 7e189a0

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

‎src/tools/tidy/src/extra_checks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn check_impl(
303303
}
304304

305305
if js_lint {
306-
rustdoc_js::lint(outdir, librustdoc_path, tools_path)?;
306+
rustdoc_js::lint(outdir, librustdoc_path, tools_path, bless)?;
307307
rustdoc_js::es_check(outdir, librustdoc_path)?;
308308
}
309309

‎src/tools/tidy/src/extra_checks/rustdoc_js.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ fn rustdoc_js_files(librustdoc_path: &Path) -> Vec<PathBuf> {
4040
return files;
4141
}
4242

43-
fn run_eslint(outdir: &Path, args: &[PathBuf], config_folder: PathBuf) -> Result<(), super::Error> {
44-
let mut child = spawn_cmd(
45-
Command::new(node_module_bin(outdir, "eslint"))
46-
.arg("-c")
47-
.arg(config_folder.join(".eslintrc.js"))
48-
.args(args),
49-
)?;
43+
fn run_eslint(
44+
outdir: &Path,
45+
args: &[PathBuf],
46+
config_folder: PathBuf,
47+
bless: bool,
48+
) -> Result<(), super::Error> {
49+
let mut cmd = Command::new(node_module_bin(outdir, "eslint"));
50+
if bless {
51+
cmd.arg("--fix");
52+
}
53+
cmd.arg("-c").arg(config_folder.join(".eslintrc.js")).args(args);
54+
let mut child = spawn_cmd(&mut cmd)?;
5055
match child.wait() {
5156
Ok(exit_status) => {
5257
if exit_status.success() {
@@ -62,16 +67,23 @@ pub(super) fn lint(
6267
outdir: &Path,
6368
librustdoc_path: &Path,
6469
tools_path: &Path,
70+
bless: bool,
6571
) -> Result<(), super::Error> {
6672
let files_to_check = rustdoc_js_files(librustdoc_path);
6773
println!("Running eslint on rustdoc JS files");
68-
run_eslint(outdir, &files_to_check, librustdoc_path.join("html/static"))?;
74+
run_eslint(outdir, &files_to_check, librustdoc_path.join("html/static"), bless)?;
6975

70-
run_eslint(outdir, &[tools_path.join("rustdoc-js/tester.js")], tools_path.join("rustdoc-js"))?;
76+
run_eslint(
77+
outdir,
78+
&[tools_path.join("rustdoc-js/tester.js")],
79+
tools_path.join("rustdoc-js"),
80+
bless,
81+
)?;
7182
run_eslint(
7283
outdir,
7384
&[tools_path.join("rustdoc-gui/tester.js")],
7485
tools_path.join("rustdoc-gui"),
86+
bless,
7587
)?;
7688
Ok(())
7789
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /