@@ -8,10 +8,7 @@ use std::env;
8
8
use std:: fs;
9
9
use std:: path;
10
10
use std:: str;
11
- use std:: sync:: Arc ;
12
11
13
- use deno_ast:: swc:: parser:: { Syntax , TsConfig } ;
14
- use deno_lint:: ast_parser:: get_default_ts_config;
15
12
use deno_lint:: linter:: LinterBuilder ;
16
13
use deno_lint:: rules:: { get_all_rules, get_recommended_rules} ;
17
14
use ignore:: types:: TypesBuilder ;
@@ -50,7 +47,6 @@ fn lint(ctx: CallContext) -> Result<JsObject> {
50
47
} else {
51
48
get_recommended_rules ( )
52
49
} )
53
- . syntax ( get_default_ts_config ( ) )
54
50
. ignore_diagnostic_directive ( "eslint-disable-next-line" )
55
51
. build ( ) ;
56
52
@@ -99,9 +95,9 @@ fn lint_command(ctx: CallContext) -> Result<JsBoolean> {
99
95
100
96
let ( rules, cfg_ignore_files) = if config_existed {
101
97
let cfg = config:: load_from_json ( path:: Path :: new ( & config_path) ) ?;
102
- ( cfg. get_rules ( ) , cfg. ignore )
98
+ ( cfg. get_rules ( ) , cfg. files . exclude )
103
99
} else {
104
- ( get_recommended_rules ( ) , None )
100
+ ( get_recommended_rules ( ) , vec ! [ ] )
105
101
} ;
106
102
107
103
let mut eslint_ignore_file = cwd. clone ( ) ;
@@ -112,12 +108,6 @@ fn lint_command(ctx: CallContext) -> Result<JsBoolean> {
112
108
113
109
denolint_ignore_file. push ( ".denolintignore" ) ;
114
110
115
- if let Some ( ignore_files) = cfg_ignore_files {
116
- for i in ignore_files {
117
- denolint_ignore_file. push ( i) ;
118
- }
119
- }
120
-
121
111
let mut type_builder = TypesBuilder :: new ( ) ;
122
112
123
113
type_builder
@@ -151,33 +141,22 @@ fn lint_command(ctx: CallContext) -> Result<JsBoolean> {
151
141
Err ( _) => __dirname. as_str ( ) ?,
152
142
} ,
153
143
} ;
154
-
155
- for entry in WalkBuilder :: new ( cwd )
144
+ let mut dir_walker = WalkBuilder :: new ( cwd ) ;
145
+ dir_walker
156
146
. add_custom_ignore_filename ( ignore_file_path)
157
147
. types ( types)
158
- . follow_links ( true )
159
- . build ( )
160
- . filter_map ( |v| v. ok ( ) )
161
- {
148
+ . follow_links ( true ) ;
149
+ for i in cfg_ignore_files {
150
+ dir_walker. add_custom_ignore_filename ( i) ;
151
+ }
152
+ for entry in dir_walker. build ( ) . filter_map ( |v| v. ok ( ) ) {
162
153
let p = entry. path ( ) ;
163
154
if !p. is_dir ( ) {
164
155
let file_content = fs:: read_to_string ( & p)
165
156
. map_err ( |e| Error :: from_reason ( format ! ( "Read file {:?} failed: {}" , p, e) ) ) ?;
166
157
167
- let ts_config = TsConfig {
168
- dynamic_import : true ,
169
- decorators : true ,
170
- tsx : p
171
- . extension ( )
172
- . and_then ( |ext| ext. to_str ( ) )
173
- . map ( |ext| ext == "tsx" )
174
- . unwrap_or ( false ) ,
175
- ..Default :: default ( )
176
- } ;
177
- let syntax = Syntax :: Typescript ( ts_config) ;
178
158
let linter = LinterBuilder :: default ( )
179
- . rules ( Arc :: clone ( & rules) )
180
- . syntax ( syntax)
159
+ . rules ( rules. clone ( ) )
181
160
. ignore_file_directive ( "eslint-disable" )
182
161
. ignore_diagnostic_directive ( "eslint-disable-next-line" )
183
162
. build ( ) ;
0 commit comments