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

chore(lint): enable '@typescript-eslint/only-throw-error' #11260

Merged
merged 9 commits into from
Aug 15, 2024

Conversation

Josh-Walker-GM
Copy link
Collaborator

Enables @typescript-eslint/only-throw-error rule and addresses the resulting errors.

Also updates the eslint tsconfig to handle test files.

@Josh-Walker-GM Josh-Walker-GM added release:chore This PR is a chore (means nothing for users) changesets-ok Override the changesets check labels Aug 15, 2024
@Josh-Walker-GM Josh-Walker-GM added this to the chore milestone Aug 15, 2024
@Josh-Walker-GM Josh-Walker-GM self-assigned this Aug 15, 2024
@Josh-Walker-GM Josh-Walker-GM marked this pull request as draft August 15, 2024 03:52
Comment on lines +21 to +24
const { RedwoodError, EmailValidationError } = require('@redwoodjs/api') as {
RedwoodError: typeof RedwoodErrorType
EmailValidationError: typeof EmailValidationErrorType
}
Copy link
Collaborator Author

@Josh-Walker-GM Josh-Walker-GM Aug 15, 2024

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.

@Josh-Walker-GM Josh-Walker-GM marked this pull request as ready for review August 15, 2024 04:25
@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.compilerOption.json",
"exclude": ["dist", "node_modules", "**/__mocks__"]
"exclude": ["dist", "node_modules", "**/__mocks__"],
"include": ["**/*"]
Copy link
Collaborator Author

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')
Copy link
Collaborator Author

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.

@Josh-Walker-GM Josh-Walker-GM merged commit d8baa1c into main Aug 15, 2024
46 checks passed
@Josh-Walker-GM Josh-Walker-GM deleted the jgmw/chore-lint-only-throw-error branch August 15, 2024 14:57
@Josh-Walker-GM Josh-Walker-GM modified the milestones: chore, v8.0.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changesets-ok Override the changesets check release:chore This PR is a chore (means nothing for users)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants