Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Improve prefer-immediate-return: keep comments when fixing #198

Closed
amankkg opened this issue Mar 18, 2021 · 0 comments · Fixed by #249
Closed

Improve prefer-immediate-return: keep comments when fixing #198

amankkg opened this issue Mar 18, 2021 · 0 comments · Fixed by #249
Assignees
Milestone

Comments

@amankkg
Copy link

amankkg commented Mar 18, 2021

I want to report a bug.

Reproducer

// minimal reproducer if relevant
const format = (n: string) => {
  // const n = digits(string)
  // const fmt = new l.AsYouType()
  const input = fmt.input(n)

  // if (!input) return 'foo'

  return input
}

Expected behavior

Rule fix is applied. Commented blocks remain inside a function.

Actual behavior

const format = (n: string) => {
  // const n = digits(string)
  // const fmt = new l.AsYouType()
  return fmt.input(n)
}

eslint-plugin-sonarjs version: 0.5.0

eslint version: 6.8.0

Node.js version: 12

Rule key: sonarjs/prefer-immediate-return

@vilchik-elena vilchik-elena added this to the 0.9.0 milestone Jun 28, 2021
@vilchik-elena vilchik-elena self-assigned this Jul 1, 2021
@vilchik-elena vilchik-elena changed the title sonarjs/prefer-immediate-return removes user comments completely Fix prefer-immediate-return: keep comments when fixing Jul 1, 2021
@vilchik-elena vilchik-elena changed the title Fix prefer-immediate-return: keep comments when fixing Improve prefer-immediate-return: keep comments when fixing Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants