2.0.0 • Published 7 months ago

@salesforce/eslint-plugin-lightning v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@salesforce/eslint-plugin-lightning

Collection of ESLint rules for Salesforce Lightning platform.

Installation

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

Usage

Import this plugin to your ESLint configuration file and apply your desired configuration. See ESLint documentation for details.

// eslint.config.js
const pluginLightning = require('@salesforce/eslint-plugin-lightning');

module.exports = [
    {
        'plugins': {
            '@salesforce/lightning':  pluginLightning,
        }
        'rules': {
            '@salesforce/lightning/no-moment': 'error',
            '@salesforce/lightning/prefer-i18n-service': 'error'
        }
    }
]

Rules

Internationalization rules

Rule IDDescriptionFixable
lightning/no-aura-localization-serviceprevent usage of $A.localizationService
lightning/no-momentprevent usage of moment library
lightning/prefer-i18n-servicesuggest usage of @salesforce/i18n-service over direct calls to Intl

Apex rules

Rule IDDescriptionFixable
lightning/valid-apex-method-invocationenforce invoking Apex methods with the right arguments