Skip to content

yml/flow-mapping-curly-spacing

enforce consistent spacing inside braces

  • ⚙️ This rule is included in configs.standard.
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces consistent spacing inside braces of flow mappings.

Now loading...

🔧 Options

yaml
yml/flow-mapping-curly-spacing:
  - error
  - always # or "never"
  - arraysInObjects: false
    objectsInObjects: false
    emptyObjects: ignore

This rule has two options, a string option and an object option.

  • First option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})
  • Second option:

    • "arraysInObjects" control spacing inside of braces of mappings beginning and/or ending with a sequence element.
      • true requires spacing inside of braces of mappings beginning and/or ending with a sequence element (applies when the first option is set to never)
      • false disallows spacing inside of braces of mappings beginning and/or ending with a sequence element (applies when the first option is set to always)
    • "objectsInObjects" control spacing inside of braces of mappings beginning and/or ending with a mapping element.
      • true requires spacing inside of braces of mappings beginning and/or ending with a mapping element (applies when the first option is set to never)
      • false disallows spacing inside of braces of mappings beginning and/or ending with a mapping element (applies when the first option is set to always)
    • "emptyObjects" control spacing within empty mappings.
      • "ignore"(default) do not check spacing in empty mappings.
      • "always" require a space in empty mappings.
      • "never" disallow spaces in empty mappings.

These options are almost identical to those of the @stylistic/object-curly-spacing rule. See the @stylistic/object-curly-spacing options for details.

🚀 Version

This rule was introduced in eslint-plugin-yml v0.1.0

🔍 Implementation

Taken with ❤️ from ESLint core