Skip to content

Collection of ESLint rules for Salesforce Lightning platform.

License

Notifications You must be signed in to change notification settings

salesforce/eslint-plugin-lightning

@salesforce/eslint-plugin-lightning

Collection of ESLint rules for Salesforce Lightning platform.

Installation

$ npm install eslint @salesforce/eslint-plugin-lightning --save-dev

Usage

Add this plugin to your ESLint configuration and extend your desired configuration. See ESLint documentation for details.

{
    "plugin": ["@salesforce/eslint-plugin-lightning"],
    "rules": {
        "@salesforce/lightning/no-moment": "error",
        "@salesforce/lightning/prefer-i18n-service": "error"
    }
}

Rules

Internationalization rules

Rule ID Description Fixable
lightning/no-aura-localization-service prevent usage of $A.localizationService
lightning/no-moment prevent usage of moment library
lightning/prefer-i18n-service suggest usage of @salesforce/i18n-service over direct calls to Intl

Apex rules

Rule ID Description Fixable
lightning/valid-apex-method-invocation enforce invoking Apex methods with the right arguments