Skip to content

jsonc/quote-props

require quotes around object literal property names

  • ⚙️ This rule is included in "plugin:jsonc/recommended-with-json" and "plugin:jsonc/recommended-with-jsonc".
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule requires quotes around object literal property names.

Now loading...

🔧 Options

json
{
    "jsonc/quote-props": ["error",
        "always",
        {}
    ]
}

Same as quote-props rule option. See here for details.

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

String option:

  • "always" (default) ... requires quotes around all object literal property names
  • "as-needed" ... disallows quotes around object literal property names that are not strictly required
  • "consistent" ... enforces a consistent quote style; in a given object, either all of the properties should be quoted, or none of the properties should be quoted
  • "consistent-as-needed" ... requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

Object option:

See here for details.

🚀 Version

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

🔍 Implementation

Taken with ❤️ from ESLint core