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

prefer-ternary autofix drops comments #1498

Open
Nantris opened this issue Aug 24, 2021 · 0 comments
Open

prefer-ternary autofix drops comments #1498

Nantris opened this issue Aug 24, 2021 · 0 comments

Comments

@Nantris
Copy link

Nantris commented Aug 24, 2021

Before:

if (!bool) {
  yield call(
    setOnTop,
    false
  );
} else {
  yield call(
    setOnTop,
    true,
    'normal'
  ); // To see why we include, 'normal,' see here: https://github.com/....
}

After:

yield !bool
  ? call(setOnTop, false)
  : call(
    setOnTop,
      true,
      'normal'
    );

Looks so much better, but the comment is gone!

Affected rule: unicorn/prefer-ternary

@Nantris Nantris added the bug label Aug 24, 2021
@fregante fregante changed the title Comment is destroyed when autofixing via 'unicorn/prefer-ternary' prefer-ternary autofix drops comments Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants