-
Notifications
You must be signed in to change notification settings - Fork 991
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
chore(lint): enable '@typescript-eslint/only-throw-error' #11260
Conversation
const { RedwoodError, EmailValidationError } = require('@redwoodjs/api') as { | ||
RedwoodError: typeof RedwoodErrorType | ||
EmailValidationError: typeof EmailValidationErrorType | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty ugly. Highlights the need to switch over to vitest where this would probably be a non-issue.
@@ -1,4 +1,5 @@ | |||
{ | |||
"extends": "./tsconfig.compilerOption.json", | |||
"exclude": ["dist", "node_modules", "**/__mocks__"] | |||
"exclude": ["dist", "node_modules", "**/__mocks__"], | |||
"include": ["**/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again just sort of iterating on this config. Likely not perfect.
if (error) { | ||
throw error | ||
} | ||
throw new Error('Unreachable code: FailureComponent without a Failure') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing undefined
would still have been an error that we'd have seen/heard of. I doubt anyone else has added something like Unreachable code:
to our codebase before so it should be fairly easy to spot if this change results in an issue.
Enables
@typescript-eslint/only-throw-error
rule and addresses the resulting errors.Also updates the eslint tsconfig to handle test files.