All Projects → salesforce → Eslint Plugin Lwc

salesforce / Eslint Plugin Lwc

Licence: mit
Official ESLint rules for LWC

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Eslint Plugin Lwc

Eslint Plugin Vue I18n
🌐 ESLint plugin for Vue I18n
Stars: ✭ 50 (-1.96%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Testing Library
ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library
Stars: ✭ 384 (+652.94%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Vue
Official ESLint plugin for Vue.js
Stars: ✭ 3,592 (+6943.14%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Functional
ESLint rules to disable mutation and promote fp in JavaScript and TypeScript.
Stars: ✭ 282 (+452.94%)
Mutual labels:  eslint, eslint-plugin
Xo
❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
Stars: ✭ 6,277 (+12207.84%)
Mutual labels:  eslint, eslint-plugin
Eslint Config Auto
Automatically configure ESLint based on project dependencies
Stars: ✭ 302 (+492.16%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Typescript
TypeScript plugin for ESLint
Stars: ✭ 342 (+570.59%)
Mutual labels:  eslint, eslint-plugin
eslint-config-get-off-my-lawn
A highly opinionated, sharable config of ESLint rules to produce beautiful, readable JavaScript.
Stars: ✭ 44 (-13.73%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Simple Import Sort
Easy autofixable import sorting.
Stars: ✭ 493 (+866.67%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Sonarjs
SonarJS rules for ESLint
Stars: ✭ 458 (+798.04%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Proper Arrows
ESLint rules to ensure proper arrow function definitions
Stars: ✭ 271 (+431.37%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Node
Additional ESLint's rules for Node.js
Stars: ✭ 740 (+1350.98%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.
Stars: ✭ 19 (-62.75%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Import
ESLint plugin with rules that help validate proper imports.
Stars: ✭ 3,722 (+7198.04%)
Mutual labels:  eslint-plugin, eslint
eslint-plugin-ember-best-practices
Static analysis tools for enforcing best practices in Ember
Stars: ✭ 77 (+50.98%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Html
An ESLint plugin to extract and lint scripts from HTML files.
Stars: ✭ 333 (+552.94%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-sql
SQL linting rules for ESLint.
Stars: ✭ 56 (+9.8%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin
Enforcing best practices for Effector
Stars: ✭ 69 (+35.29%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Babel
An ESlint rule plugin companion to babel-eslint
Stars: ✭ 391 (+666.67%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Jest
ESLint plugin for Jest
Stars: ✭ 699 (+1270.59%)
Mutual labels:  eslint, eslint-plugin

@lwc/eslint-plugin-lwc

Official ESLint rules for Lightning Web Components (LWC).

Installation

$ npm install eslint babel-eslint @lwc/eslint-plugin-lwc --save-dev

Usage

Add lwc to the plugins section of your configuration. Then configure the desired rules in the rules sections. Some of the syntax used in Lightning Web Components is not yet stage 4 (eg. decorators), and the out-of-the-box parser from ESLint doesn't support this syntax yet. In order to parse the LWC files properly, set the parser field to babel-eslint.

Example of .eslintrc:

{
    "parser": "babel-eslint",
    "plugins": ["@lwc/eslint-plugin-lwc"],
    "rules": {
        "@lwc/lwc/no-deprecated": "error",
        "@lwc/lwc/valid-api": "error",
        "@lwc/lwc/no-document-query": "error"
    }
}

For more details about configuration please refer to the dedicated section in the ESLint documentation: https://eslint.org/docs/user-guide/configuring

Configurations

To choose from three configuration settings, install the eslint-config-lwc sharable configuration package.

Rules

LWC

Rule ID Description Fixable
lwc/consistent-component-name ensure component class name matches file name 🔧
lwc/no-api-reassignments prevent public property reassignments
lwc/no-deprecated disallow usage of deprecated LWC APIs
lwc/no-document-query disallow DOM query at the document level
lwc/no-attributes-during-construction disallow setting attributes during construction
lwc/no-leading-uppercase-api-name ensure public property doesn't start with an upper-case character
lwc/no-unexpected-wire-adapter-usages enforce wire adapters to be used with wire decorator
lwc/no-unknown-wire-adapters disallow usage of unknown wire adapters
lwc/valid-api validate api decorator usage
lwc/valid-track validate track decorator usage
lwc/valid-wire validate wire decorator usage

Best practices

Rule ID Description Fixable
lwc/no-async-operation restrict usage of async operations
lwc/no-dupe-class-members disallow duplicate class members
lwc/no-inner-html disallow usage of innerHTML
lwc/no-leaky-event-listeners prevent event listeners from leaking memory
lwc/prefer-custom-event suggest usage of CustomEvent over Event constructor

Compat performance

Older browsers like IE11 run LWC in compatibility mode. For more information about browser performance, please refer to Supported Browsers in the Lightning Web Components Developer Guide.

Rule ID Description Fixable
lwc/no-async-await disallow usage of the async-await syntax
lwc/no-for-of disallow usage of the for-of syntax
lwc/no-rest-parameter disallow usage of the rest parameter syntax
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].