# @salesforce/eslint-plugin-lightning

> Collection of ESLint rules for Salesforce Lightning platform

Latest version **2.0.0** (published 2025-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @salesforce/eslint-plugin-lightning
pnpm add @salesforce/eslint-plugin-lightning
yarn add @salesforce/eslint-plugin-lightning
bun add @salesforce/eslint-plugin-lightning
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-04-11 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 0 |
| Unpacked size | 15.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | demianbrecht, jye-sf, jburnie, kevinv11n, byao, pmdartus, jcourtner, dferro, duane.chew, ekashida, ravi.jayaramappa, mjrust, apapko, jleen-sfdc, jqian, cwallsf, dhagberg-sf, khawkins, mbettio, amphro, ire-npm-team-user, damilareolowoniyi, jodarove, sfdctaka, fernomac, jimjag, ivarley, jbartolotta-sfdc, dhersam, mmadialagan, dbreese-salesforce, ashokrudraraju, salesforce-releases, iamaziz, packagellama, hkii, adirasanam, nolanlawson, jasonschroeder-sfdc, danielshox, dme722, maward, jmsjtu, mobify, dlouvton, lwc-admin, abirchfieldsfdc |
| Keywords | eslint, eslint-plugin, salesforce, lightning |

## Links

- npm: https://www.npmjs.com/package/@salesforce/eslint-plugin-lightning
- Repository: https://github.com/salesforce/eslint-plugin-lightning
- Homepage: https://github.com/salesforce/eslint-plugin-lightning#readme
- Issues: https://github.com/salesforce/eslint-plugin-lightning/issues
- npm.io page: https://npm.io/package/@salesforce/eslint-plugin-lightning

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-04-11
- 1.0.1 (eslint-v8) — 2025-01-18
- 2.0.0-beta.1 (beta) — 2025-01-07
- 1.0.0 — 2021-11-16
- 0.1.1 — 2021-06-04
- 0.1.0 — 2021-05-11

## README

# @salesforce/eslint-plugin-lightning

> Collection of ESLint rules for Salesforce Lightning platform.

## Installation

```sh
$ 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](http://eslint.org/docs/user-guide/configuring#configuring-plugins) for details.

```js
// 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 ID                                                                                | Description                                                             | Fixable |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------- |
| [lightning/no-aura-localization-service](./docs/rules/no-aura-localization-service.md) | prevent usage of `$A.localizationService`                               |         |
| [lightning/no-moment](./docs/rules/no-moment.md)                                       | prevent usage of `moment` library                                       |         |
| [lightning/prefer-i18n-service](./docs/rules/prefer-i18n-service.md)                   | suggest usage of `@salesforce/i18n-service` over direct calls to `Intl` |         |

### Apex rules

| Rule ID                                                                                | Description                                            | Fixable |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------- |
| [lightning/valid-apex-method-invocation](./docs/rules/valid-apex-method-invocation.md) | enforce invoking Apex methods with the right arguments |         |

---
_Source: https://npm.io/package/@salesforce/eslint-plugin-lightning · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
