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

Include jsdoc when reodering elements #8

Open
tomquist opened this issue Jan 27, 2025 · 0 comments · May be fixed by #9
Open

Include jsdoc when reodering elements #8

tomquist opened this issue Jan 27, 2025 · 0 comments · May be fixed by #9

Comments

@tomquist
Copy link
Contributor

When array elements of object keys have jsdoc (or comments) they stay at the old position. Example:

// @sort
[
  "c",
  /**
   * Comment
   */
  "b",
];

...gets reordered to

// @sort
[
  "b",
  /**
   * Comment
   */
  "c",
];

Same for object keys:

// @sort-keys
const x = {
  /**
   * Comment
   */
  b: 2,
  a: 1,
}

gets reordered to

// @sort-keys
const x = {
  /**
   * Comment
   */
  a: 1,
  b: 2,
}

The expected outcome would be to move jsdocs (and ideally non-jsdoc comments) with the value/key.

tomquist added a commit to tomquist/eslint-plugin-annotation that referenced this issue Jan 27, 2025
@tomquist tomquist linked a pull request Jan 27, 2025 that will close this issue
tomquist added a commit to tomquist/eslint-plugin-annotation that referenced this issue Jan 27, 2025
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.

1 participant