@untitled-engineer/eslint-plugin-wc
TypeScript icon, indicating that this package has built-in type declarations

1.3.0-dev • Public • Published
Eslint + WebComponents

eslint-plugin-wc

npm version Build Status Coverage Status License: MIT

ESLint plugin for Web Components.

Install

Assuming you already have ESLint installed, run:

# npm
npm install eslint-plugin-wc --save-dev

# yarn
yarn add eslint-plugin-wc --dev

Usage

Then extend the recommended eslint config:

{
  "extends": [
    // ...
    "plugin:wc/recommended"
  ]
}

You should also specify settings that will be shared across all the plugin rules. (More about eslint shared settings)

{
  "settings": {
    "wc": {
      "elementBaseClasses": ["LitElement"] // Recognize `LitElement` as a Custom Element base class
    }
  }
}

Custom Configuration

If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:

{
  "plugins": [
    // ...
    "wc"
  ],
  "rules": {
    // ...
    "wc/no-invalid-element-name": "error",
    "wc/no-typos": "warn"
  }
}

Supported Rules

Possible Errors (Recommended)

Best Practice

Shareable configurations

Recommended

This plugin exports a recommended configuration that enforces WebComponent good practices.

To enable this configuration use the extends property in your .eslintrc config file:

{
  "extends": ["eslint:recommended", "plugin:wc/recommended"]
}

Best Practices

This plugin exports a best-practice configuration that enforces WebComponent best practices.

To enable this configuration use the extends property in your .eslintrc config file:

{
  "extends": ["eslint:recommended", "plugin:wc/best-practice"]
}

Note: These configurations will enable sourceType: 'module' in parser options.

License

eslint-plugin-wc is licensed under the MIT License.

Package Sidebar

Install

npm i @untitled-engineer/eslint-plugin-wc

Weekly Downloads

0

Version

1.3.0-dev

License

MIT

Unpacked Size

56.7 kB

Total Files

38

Last publish

Collaborators

  • untitled.engineer