disallowQuotedKeysInObjects

Disallows quoted keys in object if possible.

Types: Boolean, String or Object

Values:

  • true for strict mode
  • "allButReserved" (deprecated use "allExcept": ["reserved"])
  • Object:
    • "allExcept" array of exceptions:
      • "reserved" allows ES3+ reserved words to remain quoted which is helpful when using this option with JSHint's es3 flag.

Example

"disallowQuotedKeysInObjects": true
Valid for mode true
var x = { a: { default: 1 } };
Valid for mode {"allExcept": ["reserved"]}
var x = {a: 1, 'default': 2};
Invalid
var x = {'a': 1};
Rule source
Test source