mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(cli): use a single walker for all paths
This commit is contained in:
parent
5135118bc8
commit
89542be81e
2 changed files with 14 additions and 8 deletions
|
|
@ -65,12 +65,10 @@ impl LintRunner {
|
|||
let fix = options.fix;
|
||||
rayon::join(
|
||||
move || {
|
||||
options.paths.iter().flat_map(|path| Walk::new(path, options).iter()).for_each(
|
||||
|path| {
|
||||
*number_of_files += 1;
|
||||
tx_path.send(path).unwrap();
|
||||
},
|
||||
)
|
||||
Walk::new(options).iter().for_each(|path| {
|
||||
*number_of_files += 1;
|
||||
tx_path.send(path).unwrap();
|
||||
});
|
||||
},
|
||||
move || {
|
||||
while let Ok(path) = rx_path.recv() {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,16 @@ pub struct Walk {
|
|||
}
|
||||
|
||||
impl Walk {
|
||||
pub fn new<P: AsRef<Path>>(path: P, options: &LintOptions) -> Self {
|
||||
let mut inner = WalkBuilder::new(path);
|
||||
#[must_use]
|
||||
pub fn new(options: &LintOptions) -> Self {
|
||||
let mut inner = WalkBuilder::new(&options.paths[0]);
|
||||
|
||||
if let Some(paths) = options.paths.get(1..) {
|
||||
for path in paths {
|
||||
inner.add(path);
|
||||
}
|
||||
}
|
||||
|
||||
if !options.no_ignore {
|
||||
inner.add_custom_ignore_filename(&options.ignore_path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue