Rule: prefer-inline-decorator

Ensures that declarations are on the same line as its decorator(s).

See more at https://angular.io/guide/styleguide#style-05-12.

Rationale

Placing the decorator on the same line usually makes for shorter code and still easily identifies the declarations.

Notes:
TS Only

Config

An optional object with optional getters, methods, parameter-properties, parameters, properties and setters properties.

The properties can be specifed as booleans or as objects with the property safelist containing the names of the decorators that should be ignored. Note that if a declaration is decorated with multiple decorators and at least one of them is present in safelist, this declaration is ignored.

  • getters - requires that getters are on the same line as its decorator(s). Defaults to true.
  • methods - requires that methods are on the same line as its decorator(s). Defaults to true.
  • parameter-properties - requires that parameter properties are on the same line as its decorator(s). Defaults to true.
  • parameters - requires that parameters are on the same line as its decorator(s). Defaults to true.
  • properties - requires that properties are on the same line as its decorator(s). Defaults to true.
  • setters - requires that setters are on the same line as its decorator(s). Defaults to true.
Examples
"prefer-inline-decorator": true
"prefer-inline-decorator": [true, {"methods": false}]
"prefer-inline-decorator": [
  true,
  {
    "getters": {"safelist": ["Input"]},
    "methods": true,
    "parameter-properties": false,
    "parameters": false,
    "properties": {"safelist": ["Output", "MyCustomDecorator"]},
    "setters": true
  }
]
Schema
{
  "additionalProperties": false,
  "properties": {
    "getters": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    },
    "methods": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    },
    "parameter-properties": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    },
    "parameters": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    },
    "properties": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    },
    "setters": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "properties": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": "object"
        }
      ]
    }
  },
  "type": "object"
}