Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore plugin: allow for finegrained ignoring of specific AST nodes (without their children) #5045

Open
nicojs opened this issue Sep 29, 2024 · 0 comments
Labels
🚀 Feature request New feature request hacktoberfest https://hacktoberfest.digitalocean.com/

Comments

@nicojs
Copy link
Member

nicojs commented Sep 29, 2024

Is your feature request related to a problem? Please describe.

The current ignore plugin specification allows you to ignore specific AST nodes. It also includes ignoring all descendants of that node. This is elegant when you want to ignore logger.log(...) for example, but not for the use case of the Angular Ignorer.

image

In this example, we would actually only want to ignore the mutant on line 9 and the mutant on line 10, but because mutants on line 11-19 are on nodes which are descendants the node on line 9, we automatically also ignore all of them.

Describe the solution you'd like
I think returning a string from shouldIgnore can keep working as it is, but we should also allow to return an object with a 'mode'.

interface IgnoreDescription {
  message: string;
  mode: 'descendants' | 'self';
}

interface Ignorer {
  shouldIgnore(path: NodePath): string | undefined | IgnoreDescription;
}

Describe alternatives you've considered
I don't think there are other solutions. Leaving descendant nodes unmutated is not ellegant.

@nicojs nicojs added 🚀 Feature request New feature request hacktoberfest https://hacktoberfest.digitalocean.com/ labels Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request hacktoberfest https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

No branches or pull requests

1 participant