Skip to content

Comments

fix(linter): friendly diagnostic messages for no-else-return#6349

Merged
graphite-app[bot] merged 1 commit intomainfrom
don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_
Oct 8, 2024
Merged

fix(linter): friendly diagnostic messages for no-else-return#6349
graphite-app[bot] merged 1 commit intomainfrom
don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_

Conversation

@DonIsaac
Copy link
Contributor

@DonIsaac DonIsaac commented Oct 7, 2024

Before

  ⚠ eslint(no-else-return): Unnecessary 'else' after 'return'.
   ╭─[no_else_return.tsx:1:48]
 1 │ function foo1() { if (true) { return x; } else { return y; } }
   ·                                                ─────────────
   ╰────
  help: Replace ` else { return y; }` with `  return y; `.

After

  ⚠ eslint(no-else-return): Unnecessary 'else' after 'return'.
   ╭─[no_else_return.tsx:1:31]
 1 │ function foo1() { if (true) { return x; } else { return y; } }
   ·                               ────┬────  ───┬──
   ·                                   │         ╰── Making this `else` block unnecessary.
   ·                                   ╰── This consequent block always returns,
   ╰────
  help: Remove the `else` block, moving its contents outside of the `if` statement.

Copy link
Contributor Author

DonIsaac commented Oct 7, 2024

@github-actions github-actions bot added the A-linter Area - Linter label Oct 7, 2024
@DonIsaac DonIsaac added the C-enhancement Category - New feature or request label Oct 7, 2024 — with Graphite App
@DonIsaac DonIsaac marked this pull request as ready for review October 7, 2024 19:00
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 7, 2024

CodSpeed Performance Report

Merging #6349 will not alter performance

Comparing don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_ (63f1622) with main (71ad5d3)

Summary

✅ 29 untouched benchmarks

@DonIsaac DonIsaac changed the base branch from don/10-07-fix_linter_no_else_return_fixer_fails_when_else_has_no_trailing_whitespace to graphite-base/6349 October 7, 2024 23:19
@DonIsaac DonIsaac force-pushed the graphite-base/6349 branch from 1ade3c3 to 71ad5d3 Compare October 7, 2024 23:24
@DonIsaac DonIsaac force-pushed the don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_ branch from 40f966f to 9991923 Compare October 7, 2024 23:24
@DonIsaac DonIsaac changed the base branch from graphite-base/6349 to main October 7, 2024 23:25
@DonIsaac DonIsaac force-pushed the don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_ branch from 9991923 to 63f1622 Compare October 7, 2024 23:25
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Oct 8, 2024
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 8, 2024

Merge activity

  • Oct 7, 9:26 PM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 7, 9:26 PM EDT: Boshen added this pull request to the Graphite merge queue.
  • Oct 7, 9:31 PM EDT: Boshen merged this pull request with the Graphite merge queue.

### Before

```
  ⚠ eslint(no-else-return): Unnecessary 'else' after 'return'.
   ╭─[no_else_return.tsx:1:48]
 1 │ function foo1() { if (true) { return x; } else { return y; } }
   ·                                                ─────────────
   ╰────
  help: Replace ` else { return y; }` with `  return y; `.
```

### After

```
  ⚠ eslint(no-else-return): Unnecessary 'else' after 'return'.
   ╭─[no_else_return.tsx:1:31]
 1 │ function foo1() { if (true) { return x; } else { return y; } }
   ·                               ────┬────  ───┬──
   ·                                   │         ╰── Making this `else` block unnecessary.
   ·                                   ╰── This consequent block always returns,
   ╰────
  help: Remove the `else` block, moving its contents outside of the `if` statement.
```
@Boshen Boshen force-pushed the don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_ branch from 63f1622 to 00df6e5 Compare October 8, 2024 01:27
@graphite-app graphite-app bot merged commit 00df6e5 into main Oct 8, 2024
@graphite-app graphite-app bot deleted the don/10-07-fix_linter_friendly_diagnostic_messages_for_no-else-return_ branch October 8, 2024 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants