Registry / testing / eslint-plugin-wc

eslint-plugin-wc

JSON →
library3.1.0jsnpmunverified

ESLint plugin enforcing best practices for Web Components, compatible with custom elements and libraries like LitElement. Current stable version 3.1.0, maintained actively. Requires ESLint >=8.40.0 and ships TypeScript types. Key differentiator: dedicated Web Components lint rules covering lifecycle callbacks, naming conventions, and shadow DOM correctness. ESM-only since v3.0.0; provides both legacy .eslintrc and flat config support.

npm install eslint-plugin-wc
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-WC
E
eslint-plugin-wc
testingjavascriptv3.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin (default)
import plugin from 'eslint-plugin-wc'
const plugin = require('eslint-plugin-wc')
ESM-only since v3.0.0; default export is the plugin object
configs
import { configs } from 'eslint-plugin-wc'
const { configs } = require('eslint-plugin-wc')
Named export for flat configs; requires ESM import. Use configs['flat/recommended'] for flat config.
rules
import { rules } from 'eslint-plugin-wc'
Named export containing all rule definitions, useful for custom rule inspection.

Minimal configuration to enable recommended Web Components linting with both legacy .eslintrc and flat config formats.

// Install: npm install eslint-plugin-wc --save-dev // .eslintrc.json { "plugins": ["wc"], "extends": ["plugin:wc/recommended"], "rules": { "wc/no-constructor-attributes": "error", "wc/attach-shadow-constructor": "warn" }, "settings": { "wc": { "elementBaseClasses": ["LitElement"] } } } // or flat config (eslint.config.js) import plugin from 'eslint-plugin-wc'; export default [ plugin.configs['flat/recommended'], { rules: { 'wc/no-constructor-attributes': 'error', 'wc/attach-shadow-constructor': 'warn' }, settings: { wc: { elementBaseClasses: ['LitElement'] } } } ];
Debug
Known issues
breakingESM-only since v3.0.0: require() will fail.
fix
Use import statements or update to dynamic import().
affects: >=3.0.0
breakingRequires ESLint >=8.40.0; older versions not supported.
fix
Update ESLint to version 8.40.0 or later.
affects: >=3.0.0
deprecatedThe `rules` object export may be considered internal; prefer using the plugin default or configs.
fix
Use default import or configs export for configuration.
affects: >=3.0.0
gotchaFlat config users must reference `configs['flat/recommended']`; the `recommended` config is not the same object.
fix
Use `configs['flat/recommended']` in eslint.config.js.
affects: >=3.0.0
gotchaSome rules require `settings.wc.elementBaseClasses` to recognize base classes like LitElement.
fix
Add settings.wc.elementBaseClasses in your ESLint config.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using require() on an ESM-only package (v3+).
fix
Switch to import statement or use dynamic import().
ESLint couldn't find the plugin 'eslint-plugin-wc'.
Plugin not installed or not in node_modules.
fix
Run npm install eslint-plugin-wc --save-dev.
Configuration for rule 'wc/no-constructor-attributes' is invalid.
Invalid rule options passed.
fix
Check rule documentation for valid option schema; options are typically an empty array or specific format.
Cannot read properties of undefined (reading 'recommended')
Wrong import path for flat config.
fix
Use import { configs } from 'eslint-plugin-wc' and access configs['flat/recommended'].
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency, required >=8.40.0
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-wc — npm install eslint-plugin-wc · libregistry