Skip to content

Permit throw new Redirect w/ @typescript-eslint's strict config #234

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/shy-dryers-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@tanstack/eslint-config': minor
'@tanstack/config': minor
---

Permit `throw new Redirect` with @typescript-eslint's strict config
9 changes: 9 additions & 0 deletions packages/eslint-config/src/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ export const typescriptRules = {
'@typescript-eslint/no-unsafe-function-type': 'error',
/** Disallow using confusing built-in primitive class wrappers */
'@typescript-eslint/no-wrapper-object-types': 'error',
/** Permit `throw new Redirect` w/ @typescript-eslint's strict config */
'@typescript-eslint/only-throw-error': [
'warn', // Since this is meant for users of @typescript-eslint's strict config, I'm setting this to be an eslint "warning" instead of "error" - The goal is to be less aggressive, and get the PR merged – although one could argue this belongs in a new `@tanstack/ts-eslint-strict-config`, it's hard for me to justify that if it's literally just ONE rule.
{
allow: ['Redirect', 'NotFoundError'],
allowThrowingAny: false,
allowThrowingUnknown: false,
},
],
/** Enforce the use of as const over literal type */
'@typescript-eslint/prefer-as-const': 'error',
/** Prefer for-of loop over the standard for loop */
Expand Down