Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Latest commit

 

History

History
74 lines (62 loc) · 1.83 KB

spaceInParensRule.md

File metadata and controls

74 lines (62 loc) · 1.83 KB

space-in-parens (ESLint: space-in-parens)

rule_source test_source

require or disallow spaces inside parentheses

Rationale

This rule will enforce consistency of spacing directly inside of parentheses, by disallowing or requiring one or more spaces to the right of (and to the left of). In either case, () will still be allowed.

Config

There are two options for this rule:

  • "never" (default) enforces zero spaces inside of parentheses
  • "always" enforces a space inside of parentheses

Depending on your coding conventions, you can choose either option by specifying it in your configuration.

Examples

"space-in-parens": [true, "always"]
"space-in-parens": [true, "never"]
"space-in-parens": [true, "always", { "exceptions": [ "{}", "[]", "()", "empty" ] }]

Schema

{
  "type": "array",
  "items": [
    {
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "object",
      "properties": {
        "exceptions": {
          "type": "array",
          "items": [
            {
              "enum": [
                "{}",
                "[]",
                "()",
                "empty"
              ]
            }
          ],
          "uniqueItems": true
        }
      },
      "additionalProperties": false
    }
  ],
  "minItems": 0,
  "maxItems": 2
}