Skip to content

allow combining include and exclude #25

Description

@bdwain

I noticed the logic for handling the include and exclude options is currently

function ignore(name, path, rules) {
  if (rules.exclude) {
    //....
  } else if (rules.include) {
    //....
  }
  return false;
}

This doesn't let you do more specific things like "include src/ and test/ but exclude src/foo" or something like that.

If you just change it to

function ignore(name, path, rules) {
  if (rules.exclude) {
    //.... same as before
  }
  if (rules.include) {
    //.... //same as before
  }
  //they didn't match either rule, so if an include pattern exists, this is ignored, otherwise it is not
  return !!rules.include;
}

i think it would allow for those new types of patterns. It would be a breaking change, since people may be relying on the current behavior of ignoring the include flag if the exclude flag exists, but I think it would be an improvement.

If you're open to the change, I'd be happy to make a PR to do it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions