@@ -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