File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 144144# target when running tests, otherwise this can be omitted.
145145# nodejs = "node"
146146
147+ # The eslint executable to use. Note that this is only used for linting js files
148+ # during the test phase. It can be omitted.
149+ # eslint = "eslint"
150+
147151# Python interpreter to use for various tasks throughout the build, notably
148152# rustdoc tests, the lldb python interpreter, and some dist bits and pieces.
149153# Note that Python 2 is currently required.
Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ pub struct Config {
136136 pub libdir : Option < PathBuf > ,
137137 pub mandir : Option < PathBuf > ,
138138 pub codegen_tests : bool ,
139+ pub eslint : Option < PathBuf > ,
139140 pub nodejs : Option < PathBuf > ,
140141 pub gdb : Option < PathBuf > ,
141142 pub python : Option < PathBuf > ,
@@ -202,6 +203,7 @@ struct Build {
202203 gdb : Option < String > ,
203204 locked_deps : Option < bool > ,
204205 vendor : Option < bool > ,
206+ eslint : Option < String > ,
205207 nodejs : Option < String > ,
206208 python : Option < String > ,
207209 full_bootstrap : Option < bool > ,
@@ -444,6 +446,7 @@ impl Config {
444446 } ;
445447
446448
449+ config. eslint = build. eslint . map ( PathBuf :: from) ;
447450 config. nodejs = build. nodejs . map ( PathBuf :: from) ;
448451 config. gdb = build. gdb . map ( PathBuf :: from) ;
449452 config. python = build. python . map ( PathBuf :: from) ;
Original file line number Diff line number Diff line change @@ -609,6 +609,14 @@ impl Step for RustdocJS {
609609 "No nodejs found, skipping \" src/test/rustdoc-js\" tests"
610610 ) ;
611611 }
612+
613+ if let Some ( ref eslint) = builder. config . eslint {
614+ let mut command = Command :: new ( eslint) ;
615+ command. args ( & [ "src/librustdoc/html/static" ] ) ;
616+ builder. run ( & mut command) ;
617+ } else {
618+ builder. info ( "No eslint found, skipping js linting" ) ;
619+ }
612620 }
613621}
614622
You can’t perform that action at this time.
0 commit comments