From 68012dd674e30a63b48691c2d962479cd33f8d78 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Tue, 12 Aug 2025 10:22:23 +0200 Subject: [PATCH 1/4] docs: solve conflict with @typescript-eslint/only-throw-error rule --- docs/router/eslint/eslint-plugin-router.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/router/eslint/eslint-plugin-router.md b/docs/router/eslint/eslint-plugin-router.md index 54036cb304d..32d96e676cd 100644 --- a/docs/router/eslint/eslint-plugin-router.md +++ b/docs/router/eslint/eslint-plugin-router.md @@ -103,3 +103,25 @@ Alternatively, add `@tanstack/eslint-plugin-router` to the plugins section, and The following rules are available in the TanStack Router ESLint Plugin: - [@tanstack/router/create-route-property-order](../create-route-property-order.md) + +## Conflicts with other ESLint plugins + +If you are using other ESLint plugins you might need to adapt some rules to work well with Tanstack Router. + +### `typescript-eslint` + +The [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/), enabled by default in the `recommended-type-checked` and `strict-type-checked` rule sets, disallows throwing non-Error values as exceptions, which is considered a good practice. To make it work well with Tanstack Router, you should add redirect to the allowed thrown objects: + +```json +rules: { + "@typescript-eslint/only-throw-error": ["error", { + "allow": [ + { + "from": "package", + "package": "@tanstack/router-core", + "name": "Redirect" + } + ] + }] +} +``` From 1a4d018d10e314f06b690c73be58ed2fb834d57d Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Tue, 12 Aug 2025 10:25:07 +0200 Subject: [PATCH 2/4] formatting --- docs/router/eslint/eslint-plugin-router.md | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/router/eslint/eslint-plugin-router.md b/docs/router/eslint/eslint-plugin-router.md index 32d96e676cd..2f62e84eb98 100644 --- a/docs/router/eslint/eslint-plugin-router.md +++ b/docs/router/eslint/eslint-plugin-router.md @@ -106,22 +106,24 @@ The following rules are available in the TanStack Router ESLint Plugin: ## Conflicts with other ESLint plugins -If you are using other ESLint plugins you might need to adapt some rules to work well with Tanstack Router. +If you are using other ESLint plugins you might need to adapt some rules to work well with TanStack Router. ### `typescript-eslint` -The [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/), enabled by default in the `recommended-type-checked` and `strict-type-checked` rule sets, disallows throwing non-Error values as exceptions, which is considered a good practice. To make it work well with Tanstack Router, you should add redirect to the allowed thrown objects: +The [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/), enabled by default in the `recommended-type-checked` and `strict-type-checked` rule sets, disallows throwing non-Error values as exceptions, which is considered a good practice. To make it work well with TanStack Router, you should add redirect to the allowed thrown objects: ```json -rules: { - "@typescript-eslint/only-throw-error": ["error", { - "allow": [ - { - "from": "package", - "package": "@tanstack/router-core", - "name": "Redirect" - } - ] - }] +{ + rules: { + "@typescript-eslint/only-throw-error": ["error", { + "allow": [ + { + "from": "package", + "package": "@tanstack/router-core", + "name": "Redirect" + } + ] + }] + } } ``` From 8ee2f6616c5ede5cdd79f6ecefa9080afdf51785 Mon Sep 17 00:00:00 2001 From: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com> Date: Wed, 13 Aug 2025 13:51:24 +1200 Subject: [PATCH 3/4] docs(eslint): apply code review @seancassiere suggestions --- docs/router/eslint/eslint-plugin-router.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/router/eslint/eslint-plugin-router.md b/docs/router/eslint/eslint-plugin-router.md index 2f62e84eb98..8157fb063ff 100644 --- a/docs/router/eslint/eslint-plugin-router.md +++ b/docs/router/eslint/eslint-plugin-router.md @@ -106,11 +106,13 @@ The following rules are available in the TanStack Router ESLint Plugin: ## Conflicts with other ESLint plugins -If you are using other ESLint plugins you might need to adapt some rules to work well with TanStack Router. +If you have other ESLint plugins installed, they may rules that conflict with this plugin. If so, you'll need to make some tweaks to allow these plugins to work together. ### `typescript-eslint` -The [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/), enabled by default in the `recommended-type-checked` and `strict-type-checked` rule sets, disallows throwing non-Error values as exceptions, which is considered a good practice. To make it work well with TanStack Router, you should add redirect to the allowed thrown objects: +The [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/) rule, enabled by default in the `recommended-type-checked` and `strict-type-checked` rulesets, disallows the throwing of non-Error values as exceptions, which is considered a good practice. + +To make sure it that it does not conflict with TanStack Router, you should add `redirect` to the allowed as a throwable objects. ```json { From e655c144f57a8a4a053d4aa829829302928fa0bf Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 01:52:40 +0000 Subject: [PATCH 4/4] ci: apply automated fixes --- docs/router/eslint/eslint-plugin-router.md | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/router/eslint/eslint-plugin-router.md b/docs/router/eslint/eslint-plugin-router.md index 8157fb063ff..562a5e744b1 100644 --- a/docs/router/eslint/eslint-plugin-router.md +++ b/docs/router/eslint/eslint-plugin-router.md @@ -116,16 +116,19 @@ To make sure it that it does not conflict with TanStack Router, you should add ` ```json { - rules: { - "@typescript-eslint/only-throw-error": ["error", { - "allow": [ - { - "from": "package", - "package": "@tanstack/router-core", - "name": "Redirect" - } - ] - }] + "rules": { + "@typescript-eslint/only-throw-error": [ + "error", + { + "allow": [ + { + "from": "package", + "package": "@tanstack/router-core", + "name": "Redirect" + } + ] + } + ] } } ```