objectCurlySpacingRule.md

July 20, 2018 ยท View on GitHub

object-curly-spacing (ESLint: object-curly-spacing)

rule_source test_source

require or disallow padding inside curly braces

Config

This rule takes one optional argument, an object which may include any of the following properties:

  • "arraysInObjects" (default true if rule is set to "always", otherwise default false) When set to true, this option requires a space inside of braces ending with an array literal. When set to false, this option requires no space inside of braces ending with an array literal.
  • "objectsInObjects" (default true if rule is set to "always", otherwise default false) When set to true, this option requires a space inside of braces ending with an object literal, or object destructuring. When set to false, this option requires no space inside of braces ending with an object literal, or object destructuring.

Examples

"object-curly-spacing": [true, "always"]
"object-curly-spacing": [true, "never"]
"object-curly-spacing": [true, "always", {"arraysInObjects": false, "objectsInObjects": false}]

Schema

{
  "type": "array",
  "items": [
    {
      "type": "object",
      "properties": {
        "arraysInObjects": {
          "type": "boolean"
        },
        "objectsInObjects": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    }
  ],
  "maxLength": 1
}