eslint-plugin-lit

lit-html support for ESLint

MIT 44 个版本
安装
npm install eslint-plugin-lit
yarn add eslint-plugin-lit
pnpm add eslint-plugin-lit
bun add eslint-plugin-lit
README

eslint-plugin-lit

npm version Build Status Coverage Status

ESLint plugin for Lit.

Install

Assuming you already have ESLint installed, run:

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

# yarn
yarn add eslint-plugin-lit --dev

Usage

Then extend the recommended eslint config:

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

Or if you're using (flat) config files, add to your eslint.config.js:

import {configs} from 'eslint-plugin-lit';

export default [
  configs['flat/recommended'],

  // or if you want to specify `files`, or other options
  {
    ...configs['flat/recommended'],
    files: ['test/**/*.js']
  }
];

You can also specify settings that will be shared across all the plugin rules.

{
  settings: {
    lit: {
      elementBaseClasses: ['ClassExtendingLitElement'] // Recognize `ClassExtendingLitElement` as a sub-class of LitElement
    }
  }
}

Custom Configuration

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

{
  "plugins": [
    // ...
    "lit"
  ],
  "rules": {
    // ...
    "lit/no-legacy-template-syntax": "error",
    "lit/no-template-arrow": "warn"
  }
}

List of supported rules

Shareable configurations

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

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

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

Usage with eslint-plugin-wc

We highly recommend you also depend on eslint-plugin-wc as it will provide additional rules for web components in general:

npm i -D eslint-plugin-wc

Then extend the recommended eslint config:

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

License

MIT

版本列表
2.3.1 2026-05-11
2.2.1 2026-02-09
2.1.1 2025-04-16
2.1.0 2025-04-16
2.0.0 2025-03-18
1.15.0 2024-09-07
1.14.0 2024-05-29
1.13.0 2024-05-14
1.12.0 2024-05-07
1.11.0 2023-12-17
1.10.1 2023-10-24
1.10.0 2023-10-24
1.9.1 2023-08-08
1.9.0 2023-08-08
1.8.3 2023-04-18
1.8.2 2023-01-13
1.8.1 2023-01-13
1.8.0 2023-01-11
1.7.2 2022-12-18
1.7.1 2022-12-12
1.7.0 2022-12-05
1.6.2-wc.0 2022-11-26
1.6.1 2021-10-19
1.6.0 2021-10-05
1.5.1 2021-06-09
1.5.0 2021-06-07
1.4.1 2021-05-15
1.4.0 2021-05-10
1.3.0 2020-12-13
1.2.4 2020-10-24
1.2.2 2020-07-25
1.2.0 2019-08-13
1.1.1 2019-06-29
1.1.0 2019-06-24
1.0.0 2019-05-08
0.6.0 2019-02-18
0.5.0 2019-01-21
0.4.1 2018-10-08
0.4.0 2018-10-06
0.3.0 2018-09-25
0.2.1 2018-09-20
0.2.0 2018-09-19
0.1.0 2018-09-09
0.0.5 2018-08-18