11use std:: path:: { Component , Path , PathBuf } ;
22use std:: sync:: Arc ;
33
4- use globset:: Glob ;
54use ignore:: gitignore:: Gitignore ;
65use log:: { debug, warn} ;
76use rustc_hash:: { FxBuildHasher , FxHashMap } ;
@@ -164,14 +163,8 @@ impl ServerLinter {
164163 ( nested_configs, extended_paths)
165164 }
166165
166+ #[ expect( clippy:: filetype_is_file) ]
167167 fn create_ignore_glob ( root_path : & Path , oxlintrc : & Oxlintrc ) -> Vec < Gitignore > {
168- let mut builder = globset:: GlobSetBuilder :: new ( ) ;
169- // Collecting all ignore files
170- builder. add ( Glob :: new ( "**/.eslintignore" ) . unwrap ( ) ) ;
171- builder. add ( Glob :: new ( "**/.gitignore" ) . unwrap ( ) ) ;
172-
173- let ignore_file_glob_set = builder. build ( ) . unwrap ( ) ;
174-
175168 let walk = ignore:: WalkBuilder :: new ( root_path)
176169 . ignore ( true )
177170 . hidden ( false )
@@ -181,11 +174,17 @@ impl ServerLinter {
181174
182175 let mut gitignore_globs = vec ! [ ] ;
183176 for entry in walk {
177+ if !entry. file_type ( ) . is_some_and ( |v| v. is_file ( ) ) {
178+ continue ;
179+ }
184180 let ignore_file_path = entry. path ( ) ;
185- if !ignore_file_glob_set. is_match ( ignore_file_path) {
181+ if !ignore_file_path
182+ . file_name ( )
183+ . and_then ( std:: ffi:: OsStr :: to_str)
184+ . is_some_and ( |v| [ ".eslintignore" , ".gitignore" ] . contains ( & v) )
185+ {
186186 continue ;
187187 }
188-
189188 if let Some ( ignore_file_dir) = ignore_file_path. parent ( ) {
190189 let mut builder = ignore:: gitignore:: GitignoreBuilder :: new ( ignore_file_dir) ;
191190 builder. add ( ignore_file_path) ;
0 commit comments