Newer Version Available

This content describes an older version of this product. View Latest

Custom “House Style” Rules

Customize the JavaScript style rules that force:lightning:lint applies to your code.

It’s common that different organizations or projects will adopt different JavaScript rules. Aura component validations help you work with Aura component APIs, not enforce Salesforce coding conventions. To that end, the validation rules are divided into two sets, security rules and style rules. The security rules can’t be modified, but you can modify or add to the style rules.

Use the --config argument to provide a custom rules configuration file. A custom rules configuration file allows you to define your own code style rules, which affect the style rules used by force:lightning:lint.

If failure of a custom rule generates a warning, the warning doesn’t appear in the default output. To see warnings, use the --verbose flag.

Note

The default style rules are provided below. Copy the rules to a new file, and modify them to match your preferred style rules. Alternatively, you can use your existing ESLint rule configuration file directly. For example:

Not all ESLint rules can be added or modified using --config. Only rules that we consider benign are usable. And again, you can’t override the security rules.

Note

Default Style Rules

Here are the default style rules used by force:lightning:lint.