Skip to content

Commit ffec133

Browse files
docs(eslint): resolve conflict with typescript-eslint/only-throw-error rule (#4934)
Co-authored-by: Sean Cassiere <[email protected]>
1 parent 63c6df8 commit ffec133

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/router/eslint/eslint-plugin-router.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,32 @@ Alternatively, add `@tanstack/eslint-plugin-router` to the plugins section, and
103103
The following rules are available in the TanStack Router ESLint Plugin:
104104

105105
- [@tanstack/router/create-route-property-order](../create-route-property-order.md)
106+
107+
## Conflicts with other ESLint plugins
108+
109+
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.
110+
111+
### `typescript-eslint`
112+
113+
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.
114+
115+
To make sure it that it does not conflict with TanStack Router, you should add `redirect` to the allowed as a throwable objects.
116+
117+
```json
118+
{
119+
"rules": {
120+
"@typescript-eslint/only-throw-error": [
121+
"error",
122+
{
123+
"allow": [
124+
{
125+
"from": "package",
126+
"package": "@tanstack/router-core",
127+
"name": "Redirect"
128+
}
129+
]
130+
}
131+
]
132+
}
133+
}
134+
```

0 commit comments

Comments
 (0)