https://github.com/debens/sort-js-object
VS Code extension for sorting JS object keys
https://github.com/debens/sort-js-object
babel formatter javascript typescript vsco vscode
Last synced: 3 months ago
JSON representation
VS Code extension for sorting JS object keys
- Host: GitHub
- URL: https://github.com/debens/sort-js-object
- Owner: Debens
- Created: 2019-09-11T14:15:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T09:56:13.000Z (almost 3 years ago)
- Last Synced: 2025-07-19T23:58:11.439Z (5 months ago)
- Topics: babel, formatter, javascript, typescript, vsco, vscode
- Language: TypeScript
- Homepage:
- Size: 7.43 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## Installation
Install through VS Code extensions. Search for `Sort JS Object`
[Visual Studio Code Market Place: Sort JS Objects](https://marketplace.visualstudio.com/items?itemName=debens.sort-js-object)
Can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
```
ext install debens.sort-js-object
```
## Usage
Highlight a valid block of JS/TS code and open the command palette using `cmd + shift + p`, search for `Sort JS` and hit enter.
### Hotkeys
- Format highlighted code: `alt + s`
## Support
All of ES6, Typescript and legacy decorators should be support. Pull requests are welcome!
## How does it work?
sort-js-object finds the highlighted text in the current editor, then using this text builds a AST using [@babel/parser](https://babeljs.io/docs/en/babel-parser), then reorder node arrays on tree using [@babel/traverse](https://babeljs.io/docs/en/babel-traverse).