diff --git a/.changeset/shy-dryers-itch.md b/.changeset/shy-dryers-itch.md new file mode 100644 index 0000000..8b54f67 --- /dev/null +++ b/.changeset/shy-dryers-itch.md @@ -0,0 +1,6 @@ +--- +'@tanstack/eslint-config': minor +'@tanstack/config': minor +--- + +Permit `throw new Redirect` with @typescript-eslint's strict config diff --git a/packages/eslint-config/src/typescript.js b/packages/eslint-config/src/typescript.js index c966ac0..c692602 100644 --- a/packages/eslint-config/src/typescript.js +++ b/packages/eslint-config/src/typescript.js @@ -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 */