@@ -51,27 +51,35 @@ fn get_eslint_version() -> Option<String> {
51
51
get_eslint_version_inner ( false ) . or_else ( || get_eslint_version_inner ( true ) )
52
52
}
53
53
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
+ } ;
57
65
match get_eslint_version ( ) {
58
66
Some ( version) => {
59
- if version != ESLINT_VERSION {
67
+ if version != eslint_version {
60
68
* bad = true ;
61
69
eprintln ! (
62
70
"⚠️ 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 }`)",
64
72
) ;
65
73
eprintln ! (
66
74
"You can install this version using `npm update eslint` or by using \
67
- `npm install eslint@{ESLINT_VERSION }`",
75
+ `npm install eslint@{eslint_version }`",
68
76
) ;
69
77
return ;
70
78
}
71
79
}
72
80
None => {
73
81
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 }`" ) ;
75
83
return ;
76
84
}
77
85
}
0 commit comments