@@ -40,13 +40,18 @@ fn rustdoc_js_files(librustdoc_path: &Path) -> Vec<PathBuf> {
40
40
return files;
41
41
}
42
42
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) ?;
50
55
match child. wait ( ) {
51
56
Ok ( exit_status) => {
52
57
if exit_status. success ( ) {
@@ -62,16 +67,23 @@ pub(super) fn lint(
62
67
outdir : & Path ,
63
68
librustdoc_path : & Path ,
64
69
tools_path : & Path ,
70
+ bless : bool ,
65
71
) -> Result < ( ) , super :: Error > {
66
72
let files_to_check = rustdoc_js_files ( librustdoc_path) ;
67
73
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 ) ?;
69
75
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
+ ) ?;
71
82
run_eslint (
72
83
outdir,
73
84
& [ tools_path. join ( "rustdoc-gui/tester.js" ) ] ,
74
85
tools_path. join ( "rustdoc-gui" ) ,
86
+ bless,
75
87
) ?;
76
88
Ok ( ( ) )
77
89
}
0 commit comments