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

feat: user can now discard warnings with ignore statements #118

Merged
merged 5 commits into from
Jan 6, 2024

Conversation

michaelangeloio
Copy link
Owner

@michaelangeloio michaelangeloio commented Jan 6, 2024

Ignoring Throw Statement Warnings

You can ignore throw statement warnings by adding the following comment to the line above the throw statement:

const someThrow = () => {
  // @does-it-throw-ignore
  throw new Error("This will not be reported");
};

Any calls to functions/methods that throw that are marked with the @it-throws or @does-it-throw-ignore comment will also be ignored as a result. For example:

const someThrow = () => {
  // @it-throws
  throw new Error("This will not be reported");
};

const callToThrow = () => {
  someThrow(); // This will not be reported
};

You can configure the string to match with the following vscode/LSP settings:

Option Description Default
ignoreStatements A list/array of statements to ignore. ["@it-throws", "@does-it-throw-ignore"]

Let me know if you have any feedback!

@michaelangeloio michaelangeloio changed the title feat: new feature for does-it-throw ignore statements feat: user can now ignore does-it-throw with ignore statements Jan 6, 2024
@michaelangeloio michaelangeloio changed the title feat: user can now ignore does-it-throw with ignore statements feat: user can now ignore warnings with ignore statements Jan 6, 2024
@michaelangeloio michaelangeloio changed the title feat: user can now ignore warnings with ignore statements feat: user can now discard warnings with ignore statements Jan 6, 2024
@michaelangeloio michaelangeloio merged commit 3f8957c into main Jan 6, 2024
4 checks passed
@michaelangeloio michaelangeloio deleted the throw-ignore-feature branch January 6, 2024 20:02
@github-actions github-actions bot mentioned this pull request Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant