eslint-plugin-misc

ESLint plugin

This project is maintained by iliubinskii

object-format

ESLint plugin / object-format

Requires multiline or single-line object format.

module.exports = {
  plugins: ["misc"],
  rules: {
    "misc/object-format": [
      "error",
      {
        maxLineLength: number,
        maxObjectSize: number
      }
    ]
  }
};

| Option | Description | Default | | :—– | :———- | :—— |

maxLineLength Max line length for single-line object 80
maxObjectSize Max object size for single-line object 3

Examples of incorrect code

const obj1 = {
  a: 1,
  b: 2,
  c: 3
};
const obj2 = { a: 1, b: 2, c: 3, d: 4 };

Examples of correct code

const obj1 = { a: 1, b: 2, c: 3 };
const obj2 = {
  a: 1,
  b: 2,
  c: 3,
  d: 4
};