@salesforce/eslint-plugin-aura
v2.1.0
Published
ESLint plugin for Aura
Downloads
243,781
Maintainers
Readme
eslint-plugin-aura
Salesforce Lightning (Aura) specific linting rules for ESLint.
Installation
npm install --save-dev @salesforce/eslint-plugin-aura
Usage
Add this plugin to your ESLint configuration and extend your desired configuration. See ESLint documentation for details.
Example:
{
"plugins": ["@salesforce/eslint-plugin-aura"],
"extends": [
"plugin:@salesforce/eslint-plugin-aura/recommended",
"plugin:@salesforce/eslint-plugin-aura/locker"
]
}
Rules
Aura
| Rule ID | Description |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| aura/aura-api | validate Aura APIs |
| aura/getevt-markup-prefix | verify the presence of the markup://
prefix for events accessed via $A.getEvt()
|
| aura/no-deprecated-aura-error | prevent usage of $A.error
|
| aura/no-deprecated-component-creation | prevent usage of deprecated component creation methods |
| aura/no-deprecated-event-creation | prevent usage of deprecated event creation methods |
Locker
| Rule ID | Description | | ------------------------------------------------------- | ------------------------------------ | | aura/ecma-intrinsics | validate JavaScript intrinsic APIs | | aura/secure-document | validate secure document public APIs | | aura/secure-window | validate secure window public APIs |
Configurations
This package exposes 2 configurations for your usage.
@salesforce/eslint-plugin-aura/recommended
configuration
Goal: Prevent common pitfalls with Lightning component development, and enforce other Salesforce platform restrictions.
Rules:
- Many of the Best Practices rules.
- Proper usage of the
$A
global, via theaura-api
rule. - Browser compatibility rules for Salesforce supported browsers.
@salesforce/eslint-plugin-aura/locker
configuration
Goal: Prevent Lightning Locker violations.
Rules:
@salesforce/eslint-plugin-aura/recommended
rules.- Proper usage of
document
andwindow
via thesecure-document
andsecure-window
rules, respectively. - Proper usage of Javascript intrinsic APIs via the
ecma-intrinsics
rule.