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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants