-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: object-shorthand auto-fix removes comments #18441
Comments
aladdin-add
added
accepted
There is consensus among the team that this change meets the criteria for inclusion
repro:yes
and removed
repro:needed
labels
May 11, 2024
Thanks, marking accepted. PRs are welcome! |
Maybe it's related to this place. eslint/lib/rules/object-shorthand.js Lines 259 to 262 in 069aa68
|
@shulaoda Yes, but this particular part of code is handling function expressions only. The identifiers are handled here: eslint/lib/rules/object-shorthand.js Lines 493 to 516 in 069aa68
I can make a PR later this weekend. |
KubaJastrz
added a commit
to KubaJastrz/eslint
that referenced
this issue
May 11, 2024
1 task
mdjermanovic
added
the
autofix
This change is related to ESLint's autofixing capabilities
label
May 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Node version: any
npm version: any
Local ESLint version: 9.2.0
Global ESLint version: 9.2.0
Operating System: any
What parser are you using?
Default (Espree)
What did you do?
Run autofix on this:
What did you expect to happen?
All comments to stay:
What actually happened?
First comment got deleted:
Link to Minimal Reproducible Example
https://eslint.org/play/#eyJ0ZXh0IjoiLyogZXNsaW50IG9iamVjdC1zaG9ydGhhbmQ6IFtcImVycm9yXCJdICovXG5cbmxldCBiO1xuXG5jb25zdCBhID0ge1xuICBiOiAvKiBhc2QgKi8gYiwgICAvKiA8LS0gY2xpY2sgRklYIGhlcmUgKi9cblxuICBjOiAvKiBhc2QgKi8gZnVuY3Rpb24gKCkge30gICAgLyogPC0tIG5vIEZJWCBhdmFpbGFibGUgaGVyZSAqL1xufTtcblxuYTsiLCJvcHRpb25zIjp7InJ1bGVzIjp7fSwibGFuZ3VhZ2VPcHRpb25zIjp7InBhcnNlck9wdGlvbnMiOnsiZWNtYUZlYXR1cmVzIjp7fX19fX0=
Participation
Additional comments
I'm working on oxc-project/oxc#3211 and noticed this oversight in unit tests.
These cases are covered by eslint:
But these aren't:
The text was updated successfully, but these errors were encountered: