@@ -51,27 +51,35 @@ fn get_eslint_version() -> Option<String> {
5151 get_eslint_version_inner ( false ) . or_else ( || get_eslint_version_inner ( true ) )
5252}
5353
54- const ESLINT_VERSION : & str = "8.6.0" ;
55-
56- pub fn check ( librustdoc_path : & Path , tools_path : & Path , bad : & mut bool ) {
54+ pub fn check ( librustdoc_path : & Path , tools_path : & Path , src_path : & Path , bad : & mut bool ) {
55+ let eslint_version_path =
56+ src_path. join ( "ci/docker/host-x86_64/mingw-check-tidy/eslint.version" ) ;
57+ let eslint_version = match std:: fs:: read_to_string ( & eslint_version_path) {
58+ Ok ( version) => version. trim ( ) . to_string ( ) ,
59+ Err ( error) => {
60+ * bad = true ;
61+ eprintln ! ( "failed to read `{}`: {error:?}" , eslint_version_path. display( ) ) ;
62+ return ;
63+ }
64+ } ;
5765 match get_eslint_version ( ) {
5866 Some ( version) => {
59- if version != ESLINT_VERSION {
67+ if version != eslint_version {
6068 * bad = true ;
6169 eprintln ! (
6270 "⚠️ Installed version of eslint (`{version}`) is different than the \
63- one used in the CI (`{ESLINT_VERSION }`)",
71+ one used in the CI (`{eslint_version }`)",
6472 ) ;
6573 eprintln ! (
6674 "You can install this version using `npm update eslint` or by using \
67- `npm install eslint@{ESLINT_VERSION }`",
75+ `npm install eslint@{eslint_version }`",
6876 ) ;
6977 return ;
7078 }
7179 }
7280 None => {
7381 eprintln ! ( "`eslint` doesn't seem to be installed. Skipping tidy check for JS files." ) ;
74- eprintln ! ( "You can install it using `npm install eslint@{ESLINT_VERSION }`" ) ;
82+ eprintln ! ( "You can install it using `npm install eslint@{eslint_version }`" ) ;
7583 return ;
7684 }
7785 }
0 commit comments