michaelangeloio / does-it-throw

lsp server for finding ES statements that throw!
MIT License
90 stars 0 forks source link

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

Closed michaelangeloio closed 10 months ago

michaelangeloio commented 10 months ago

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!