eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

Docs: `no-unreachable` is not necessarily handled by TypeScript #18378

Closed benj-dobs closed 5 days ago

benj-dobs commented 3 weeks ago

Docs page(s)

https://eslint.org/docs/latest/rules/no-unreachable#handled_by_typescript

What documentation issue do you want to solve?

The docs currently say:

It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check.

This is only true if you have "allowUnreachableCode": false in your tsconfig.json. The default behaviour is just to surface an editor warning.

https://www.typescriptlang.org/tsconfig#allowUnreachableCode

What do you think is the correct solution?

If you are using TypeScript, the allowUnreachableCode compiler option offers an alternative to this rule.

Participation

Additional comments

No response

nzakas commented 3 weeks ago

Always happy to make the documentation clearer. Please feel free to open a PR.

nzakas commented 1 week ago

@benj-dobs are you planning on submitting a PR for this?

benj-dobs commented 1 week ago

Yep - I've been a bit busy but I should get to it this week (assuming nobody else takes it)