Git Product home page Git Product logo

eslint-config-lwc's Introduction

@salesforce/eslint-config-lwc

Opinionated ESLint configurations for Lightning Web Components (LWC) projects.

Installation

npm install --save-dev @salesforce/eslint-config-lwc @lwc/eslint-plugin-lwc @salesforce/eslint-plugin-lightning eslint-plugin-import eslint-plugin-jest

Note that @lwc/eslint-plugin-lwc, @salesforce/eslint-plugin-lightning, eslint-plugin-import, and eslint-plugin-jest are peer dependencies of @salesforce/eslint-config-lwc.

Usage

Add the appropriate configuration to the extends field in your configuration.

Example of .eslintrc:

{
    "extends": ["@salesforce/eslint-config-lwc/recommended"]
}

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

Configurations

This package exposes 4 configurations for your usage.

@salesforce/eslint-config-lwc/base configuration

Goal: Prevent common pitfalls with LWC, and enforce other Salesforce platform restrictions.

Rules: LWC specific rules only.

@salesforce/eslint-config-lwc/recommended configuration

Goal: Prevent common Javascript pitfalls and enforce all best practices.

Rules: @salesforce/eslint-config-lwc/base rules + Most of the base Potential errors rules + Some of the Best Practices rules + LWC Best Practices.

@salesforce/eslint-config-lwc/extended configuration

Goal: Restrict usage of some Javascript language features known to be slow after the COMPAT transformation. LWC runs in COMPAT mode on older browsers (eg. IE11). To support new Javascript syntax and language features on older browser the LWC compiler transforms LWC modules. This linting configuration targets patterns known to be slow in COMPAT mode.

Rules: @salesforce/eslint-config-lwc/recommended rules + restrict usage of some slow patterns in COMPAT.

@salesforce/eslint-config-lwc/i18n configuration

Goal: Promote usage of @salesforce/i18n-service over 3rd parties, promote internationalization (I18N) best practices.

Rules: I18N specific rules only.

Usage:

Add the i18n configuration to the extends field in your .eslintrc configuration file, for example:

{
    "extends": ["@salesforce/eslint-config-lwc/recommended", "@salesforce/eslint-config-lwc/i18n"]
}

eslint-config-lwc's People

Contributors

apapko avatar apoblock avatar commanderq avatar dependabot[bot] avatar diervo avatar divmain avatar dme722 avatar ekashida avatar jagadeeshmaddila avatar jbleylesf avatar jodarove avatar jye-sf avatar lavkumar06 avatar mlodz-salesforce avatar nolanlawson avatar pmdartus avatar ravijayaramappa avatar rui-rayqiu avatar seckardt avatar smithgp avatar snyk-bot avatar svc-scm avatar yijian-wang avatar yungcheng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.