GitXplorerGitXplorer
h

prettier-plugin-vertical-align

public
5 stars
3 forks
0 issues

Commits

List of commits on branch main.
Verified
5ae0806140083106212a0a33c3318c465149a3bc

Merge pull request #1 from huggingface/fix-crash

ccoyotte508 committed 3 months ago
Unverified
ef8833147daf4f93a12c4a09a51d7d18cd6279cc

fix crash

ccoyotte508 committed 3 months ago
Unverified
1eec3b9c8a8bd058825ddf5b0a49f3fdd5e539f6

Handle class modifiers: private, readonly, static, ...

ccoyotte508 committed 3 months ago
Unverified
059cde74333556ab5ca09afc51951b230bf48d95

✨ Handle class properties without type annotation

ccoyotte508 committed 3 months ago
Unverified
ab0bf41f1e2762135f87f5aa20f4ec3960810fb2

✨ Align classes too

ccoyotte508 committed 3 months ago
Verified
f8e615170d77fdb715f0332ceee96f1caea7e1c2

Update README.md

ccoyotte508 committed 3 months ago

README

The README file for this repository.

prettier-plugin-vertical-align

Align object properties and interface members vertically for JS/TS code.

Example

// input
const a = {
  x: 1,
  bcd: 2,
}

interface Foo {
  x: number
  bcd: number
}

becomes

// output
const a = {
  x:   1,
  bcd: 2,
};

interface Foo {
  x:   number;
  bcd: number;
}

Installation

Add plugins: ["@huggingface/prettier-plugin-vertical-align"] to your .prettierrc file.

Configuration

alignInGroups

Aligns properties in groups. Default is "never". You can set it to "always" to always align properties in groups in your .prettierrc.

{
  "alignInGroups": "always"
}

If enabled, it will create groups inside an object, based on blank lines or multiline values. For example:

const x = {
	group1:  "a",
	group1b: "b",

	group2:     "a",
	// some comment between two lines
	group2bbbb: "b",

	group3:   "a",
	group3bb: { 
		x: 1,
	},
	group4: "b", // new group due to multiline value above 
};