Skip to content

Commit d6c95d7

Browse files
committed
Permit throw new Redirect w/ @typescript-eslint's strict config
For changeset: Ran `npm run changeset`, minor bump on @tanstack/eslint-config and @tanstack/config
1 parent 22ac3f8 commit d6c95d7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.changeset/shy-dryers-itch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@tanstack/eslint-config': minor
3+
'@tanstack/config': minor
4+
---
5+
6+
Permit `throw new Redirect` with @typescript-eslint's strict config

packages/eslint-config/src/typescript.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ export const typescriptRules = {
6161
'@typescript-eslint/no-unsafe-function-type': 'error',
6262
/** Disallow using confusing built-in primitive class wrappers */
6363
'@typescript-eslint/no-wrapper-object-types': 'error',
64+
/** Permit `throw new Redirect` w/ @typescript-eslint's strict config */
65+
'@typescript-eslint/only-throw-error': [
66+
'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.
67+
{
68+
allow: ['Redirect', 'NotFoundError'],
69+
allowThrowingAny: false,
70+
allowThrowingUnknown: false,
71+
},
72+
],
6473
/** Enforce the use of as const over literal type */
6574
'@typescript-eslint/prefer-as-const': 'error',
6675
/** Prefer for-of loop over the standard for loop */

0 commit comments

Comments
 (0)