An open API service indexing awesome lists of open source software.

https://github.com/tocttou/prettier-sort-destructure

A prettier parser that sorts the destructured keys in object assignments
https://github.com/tocttou/prettier-sort-destructure

destructure prettier sort

Last synced: 3 months ago
JSON representation

A prettier parser that sorts the destructured keys in object assignments

Awesome Lists containing this project

README

        

## Prettier Sort Destructure

Input:

```
var { b, d, c } = {
b: 1,
d: 2,
c: 3
};
```

Output:

```
var { b, c, d } = {
b: 1,
d: 2,
c: 3
};
```

#### Setup:

Install:
```
npm install --save-dev prettier-sort-destructure
```

Use:

via `.prettierrc`:

```
{
"overrides": [
{
"files": ["*.js", "*.jsx"],
"options": {
"parser": "node_modules/prettier-sort-destructure/index.js"
}
}
]
}
```

via CLI:

```
prettier --parser node_modules/prettier-sort-destructure/index.js <...files>
```