requireCamelCaseOrUpperCaseIdentifiers

Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES

Types: Boolean or String or Object

Values:

  • true
  • "ignoreProperties" allows an exception for object property names. Deprecated, Please use the Object value
  • Object:
    • ignoreProperties: boolean that allows an exception for object property names
    • strict: boolean that forces the first character to not be capitalized
    • allowedPrefixes: array of String, RegExp, or ESTree RegExpLiteral values permitted as prefixes
    • allowedSuffixes: array of String, RegExp, or ESTree RegExpLiteral values permitted as suffixes
    • allExcept: array of String, RegExp, or ESTree RegExpLiteral values permitted as exceptions

JSHint: camelcase

Example

"requireCamelCaseOrUpperCaseIdentifiers": true

"requireCamelCaseOrUpperCaseIdentifiers": {"ignoreProperties": true, "strict": true}

"requireCamelCaseOrUpperCaseIdentifiers": {"allowedPrefixes": ["opt_", /pfx\d+_/]}

"requireCamelCaseOrUpperCaseIdentifiers": {"allowedSuffixes": ["_dCel", {regex: {pattern: "_[kMG]?Hz"}}]}

"requireCamelCaseOrUpperCaseIdentifiers": {"allExcept": ["var_args", {regex: {pattern: "^ignore", flags: "i"}}]}
Valid for mode true
var camelCase = 0;
var CamelCase = 1;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
Invalid for mode true
var lower_case = 1;
var Mixed_case = 2;
var mixed_Case = 3;
Valid for mode ignoreProperties
var camelCase = 0;
var CamelCase = 1;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
var obj.snake_case = 5;
var camelCase = { snake_case: 6 };
Invalid for mode ignoreProperties
var lower_case = 1;
var Mixed_case = 2;
var mixed_Case = 3;
var snake_case = { snake_case: 6 };
Valid for mode strict
var camelCase = 0;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
var obj.snake_case = 5;
var camelCase = { snake_case: 6 };
Invalid for mode strict
var Mixed_case = 2;
var Snake_case = { snake_case: 6 };
var snake_case = { SnakeCase: 6 };
Valid for { allowedPrefix: ["opt_", /pfx\d+_/] }
var camelCase = 0;
var CamelCase = 1;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
var opt_camelCase = 5;
var pfx32_camelCase = 6;
Invalid for { allowedPrefix: ["opt_", /pfx\d+/] }
var lower_case = 1;
var Mixed_case = 2;
var mixed_Case = 3;
var req_camelCase = 4;
var pfx_CamelCase = 5;
Valid for { allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }
var camelCase = 0;
var CamelCase = 1;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
var camelCase_dCel = 5;
var _camelCase_MHz = 6;
Invalid for { allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }
var lower_case = 1;
var Mixed_case = 2;
var mixed_Case = 3;
var camelCase_cCel = 4;
var CamelCase_THz = 5;
Valid for { allExcept: ["var_args", {regex:{pattern:"^ignore",flags:"i"}}] }
var camelCase = 0;
var CamelCase = 1;
var _camelCase = 2;
var camelCase_ = 3;
var UPPER_CASE = 4;
var var_args = 5;
var ignoreThis_Please = 6;
var iGnOrEeThis_Too = 7;
Invalid for { allExcept: ["var_args", {regex:{pattern:"^ignore",flags:"i"}}] }
var lower_case = 1;
var Mixed_case = 2;
var mixed_Case = 3;
var var_arg = 4;
var signore_per_favore = 5;
Rule source
Test source