Skip to main content

camelcase

Enforce camelCase naming convention for variables and properties.
Rule Type: Suggestion
Fixable: No

Rule Details

This rule enforces camelCase naming: variableName instead of variable_name. It ignores:
  • Leading and trailing underscores
  • ALL_CAPS constants
  • Destructured property names (with option)
  • Import names (with option)

Examples

Incorrect Code

Correct Code

Options

properties

  • "always" (default) - Check property names
  • "never" - Don’t check property names

ignoreDestructuring

Default: false When true, don’t check destructured identifiers:
This only affects the destructuring itself, not later uses of the variable.

ignoreImports

Default: false When true, don’t check ES2015 imports:

ignoreGlobals

Default: false When true, don’t check global variables:

allow

Type: string[] Array of property names to allow (supports regex):

Configuration Examples

Common Patterns

API Responses

Database Columns

Environment Variables

React Legacy Methods

When Not to Use It

Disable this rule if:
  • Your style guide uses snake_case
  • You’re working with APIs that use snake_case
  • Your team hasn’t agreed on naming conventions

TypeScript

For TypeScript, you might also want:
  • @typescript-eslint/naming-convention - More powerful naming rules