@@ -11,6 +11,7 @@ use std::path::Path;
11
11
use std:: str;
12
12
13
13
use deno_ast:: MediaType ;
14
+ use deno_lint:: linter:: LintFileOptions ;
14
15
use deno_lint:: linter:: LinterBuilder ;
15
16
use deno_lint:: rules:: { get_all_rules, get_recommended_rules} ;
16
17
use ignore:: overrides:: OverrideBuilder ;
@@ -56,7 +57,6 @@ fn lint(
56
57
} ,
57
58
None => get_recommended_rules ( ) ,
58
59
} )
59
- . media_type ( get_media_type ( Path :: new ( file_name. as_str ( ) ) ) )
60
60
. ignore_diagnostic_directive ( "eslint-disable-next-line" )
61
61
. build ( ) ;
62
62
@@ -71,7 +71,11 @@ fn lint(
71
71
} ;
72
72
73
73
let ( s, file_diagnostics) = linter
74
- . lint ( file_name. clone ( ) , source_string. to_owned ( ) )
74
+ . lint_file ( LintFileOptions {
75
+ media_type : get_media_type ( Path :: new ( file_name. as_str ( ) ) ) ,
76
+ filename : file_name. clone ( ) ,
77
+ source_code : source_string. to_owned ( ) ,
78
+ } )
75
79
. map_err ( |e| {
76
80
Error :: new (
77
81
Status :: GenericFailure ,
@@ -171,17 +175,18 @@ fn denolint(__dirname: String, config_path: String) -> Result<bool> {
171
175
172
176
let linter = LinterBuilder :: default ( )
173
177
. rules ( rules. clone ( ) )
174
- . media_type ( get_media_type ( p) )
175
178
. ignore_file_directive ( "eslint-disable" )
176
179
. ignore_diagnostic_directive ( "eslint-disable-next-line" )
177
180
. build ( ) ;
178
181
let ( s, file_diagnostics) = linter
179
- . lint (
180
- p. to_str ( )
182
+ . lint_file ( LintFileOptions {
183
+ source_code : file_content,
184
+ filename : p
185
+ . to_str ( )
181
186
. ok_or_else ( || Error :: from_reason ( format ! ( "Convert path to string failed: {:?}" , & p) ) ) ?
182
187
. to_owned ( ) ,
183
- file_content . clone ( ) ,
184
- )
188
+ media_type : get_media_type ( p ) ,
189
+ } )
185
190
. map_err ( |e| {
186
191
Error :: new (
187
192
Status :: GenericFailure ,
0 commit comments