https://github.com/sbeator/sort-js-object-keys
This is a VS code extension to alphabetically sort the keys in selected js objects keys in your code.
https://github.com/sbeator/sort-js-object-keys
sort sort-objects
Last synced: about 1 year ago
JSON representation
This is a VS code extension to alphabetically sort the keys in selected js objects keys in your code.
- Host: GitHub
- URL: https://github.com/sbeator/sort-js-object-keys
- Owner: SBeator
- Created: 2017-05-17T14:04:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T08:11:27.000Z (about 7 years ago)
- Last Synced: 2025-04-01T15:21:45.342Z (about 1 year ago)
- Topics: sort, sort-objects
- Language: JavaScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=zengxingxin.sort-js-object-keys
- Size: 925 KB
- Stars: 25
- Watchers: 1
- Forks: 8
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Sort JS Object Keys README
This is a VS code extension to alphabetically sort the keys in _selected_ js objects keys in your code.
It supports:
- The latest ECMAScript version enabled by default (ES2017).
- Typescript.
- Comment attachment.
## Usage

1. Select a js object in your source
Note: it uses full lines so ensure the selected lines are a valid js object, start from the "{" and end from the "}"
1. Run the extension command
* Sort JS object keys
Keybinding: `Alt+S`
* Sort JS object keys (Reverse)
## Reference
Use [@babel/parser](https://babeljs.io/docs/en/next/babel-parser.html) to parse the code, and sort the parsed code, then use [@babel/generator](https://babeljs.io/docs/en/next/babel-generator.html) to genertate the code back to document