Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify usage of no-unreachable with TypeScript #18445

Merged
merged 1 commit into from
May 13, 2024

Conversation

benj-dobs
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Closes: #18378

What changes did you make? (Give an overview)

I've updated the documentation for no-unreachable to clarify that TypeScript will only consider unreachable code an error if configured to do so.

I checked whether there are any differences in behaviour between TypeScript an ESLint. The only one I found was in this case:

function foo() {
  try {
    return;
  } catch (err) {
    return err;
  }
}

ESLint reports this catch block as unreachable, but TypeScript does not. I did not think this was worth documenting.

Is there anything you'd like reviewers to focus on?

I've included a link to the TypeScript documentation; let me know if you would prefer not to have it.

Copy link

linux-foundation-easycla bot commented May 12, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@eslint-github-bot
Copy link

Hi @benj-dobs!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

Copy link

netlify bot commented May 12, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit d48fc4a
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/664100feecd2d900089574de

@eslint-github-bot
Copy link

Hi @benj-dobs!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@benj-dobs benj-dobs changed the title Improve documentation for no-unreachable with TypeScript docs: Clarify usage of no-unreachable with TypeScript May 12, 2024
@eslint-github-bot eslint-github-bot bot added the documentation Relates to ESLint's documentation label May 12, 2024
@benj-dobs benj-dobs force-pushed the no-unreachable-typescript-docs branch from 375289f to c3335d6 Compare May 12, 2024 17:47
@benj-dobs benj-dobs force-pushed the no-unreachable-typescript-docs branch from c3335d6 to d48fc4a Compare May 12, 2024 17:48
@benj-dobs benj-dobs marked this pull request as ready for review May 12, 2024 18:01
@benj-dobs benj-dobs requested a review from a team as a code owner May 12, 2024 18:01
@mdjermanovic mdjermanovic added rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels May 13, 2024
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit d23574c into eslint:main May 13, 2024
20 checks passed
@benj-dobs benj-dobs deleted the no-unreachable-typescript-docs branch May 13, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: no-unreachable is not necessarily handled by TypeScript
2 participants