Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 953 Bytes

lines-between-object-properties.md

File metadata and controls

65 lines (50 loc) · 953 Bytes

Require empty lines between object properties

Configurable rule to enforce consistent empty lines between object properties.

Configuration

{
  "rules": {
    "ahaha-miniprogram/lines-between-object-properties": [
      "error",
      {
        "funcs": ["foo"], // apply to foo`s object parameter
        "props": ["p"] // apply to p`s properties, p is a property
      }
    ]
  }
}

Rule details

With ["error", { "funcs": ["foo"] }], the following codes are valid:

foo({
  p1: 1,

  p2: 2,
});

the following codes are invalid:

foo({
  p1: 1,
  p2: 2,
});

With ["error", { "props": ["p"] }], the following codes are valid:

foo({
  p: {
    p1: 1,

    f1() {},
  },
});

the following codes are invalid:

foo({
  p: {
    p1: 1,
    f1() {},
  },
});

more example see tests/lib/rules/lines-between-object-properties