-
-
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
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. |
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: