---
title: object-properties-newline
description: Enforce multiline objects when they have two or more properties.
---

- Rule ID: `tai-kun/object-properties-newline`
- Auto-fix: Yes

Inserts a line break after `{` when an object literal or JSON object has two or more properties and the first property starts on the same line as the brace.

## Configuration [#configuration]

Add the rule to `lint.rules` in `vite.config.ts` to enable it.

```ts
"tai-kun/object-properties-newline": "error",
```

## Examples [#examples]

### Invalid [#invalid]

```ts
const value = { a: 1, b: 2 };
```

### Valid [#valid]

```ts
const value = {
  a: 1,
  b: 2,
};
```

## Notes [#notes]

- Sortable objects are skipped because `sort-object-properties` also makes them multiline.
- Use it together with Oxfmt's `objectWrap: "preserve"`. JSON is formatted with the same setting.
- Objects with one property are ignored.
- JSON (`JSONObjectExpression`) is also covered. Each nested object is checked.

## Related rules [#related-rules]

- [`sort-object-properties`](/vp-lint-plugins/en/rules/sort-object-properties)
