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

[Bug]: autofix for jsx-closing-bracket-location deletes comments #3793

Open
2 tasks done
Vladyslav-Soldatenko opened this issue Aug 2, 2024 · 1 comment
Open
2 tasks done

Comments

@Vladyslav-Soldatenko
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

When using jsx-closing-bracket-location with "after-props" setting, on autofix it deletes all comments which exist before actual non-comment prop (usually it's commented props).

For example, if run eslint --fix on this file
image

it will remove all comments before src prop
image

Same goes, of course, for html tags which have both opening and closing tags
image

comments will be removed in this case as well

I often find myself commenting some props for testing, and this deleting bothers me. To avoid it, I need to move props here and there so that there's a non-commented line before closing bracket

Expected Behavior

I think the expected behavior should be to make last comment be commented with "/* .... */" and place closing bracket there as shown below. Technically it will be "after props", but will not remove comments which might be needed by developer

image

If maintainers find this issue suitable for fix, I'll try to fix it myself

eslint-plugin-react version

v7.35.0

eslint version

v8.24.0

node version

v16.17.1

@TotooriaHyperion

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants