Registry / testing / ember-template-lint-plugin-css-modules

ember-template-lint-plugin-css-modules

JSON →
library1.0.0jsnpmunverified

An ember-template-lint plugin for enforcing best practices with ember-css-modules. Version 1.0.0 (stable) switches to ES Modules, requires Node >=12.22.0 and ember-template-lint ^4.2.0. Provides two rules: 'no-class' (disallows all class attributes) and 'static-local-class' (requires local-class values to be static strings). Differentiates from generic linting by being tailor-made for the ember-css-modules addon, ensuring modular CSS patterns are enforced at template level.

npm install ember-template-lint-plugin-css-modules
INSTALL
IMPORT
SIG · EMBER-TEMPLATE-LIN
E
ember-template-lint-plugin-css-modules
testingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

plugin
plugins: ['ember-template-lint-plugin-css-modules']
plugins: ['ember-template-lint-plugin-css-modules/index']
The plugin is referenced by package name in .template-lintrc.js; no direct import needed.
rules
rules: { 'css-modules/no-class': true }
rules: { 'no-class': true }
Rule names must be prefixed with 'css-modules/' to namespace them correctly.
default import (ESM)
import plugin from 'ember-template-lint-plugin-css-modules';
const plugin = require('ember-template-lint-plugin-css-modules');
Since v1.0.0, the package is ESM-only; require() will fail.

Shows how to configure ember-template-lint with the plugin and both available rules.

// .template-lintrc.js - ESM (requires Node ES module) import plugin from 'ember-template-lint-plugin-css-modules'; export default { plugins: ['ember-template-lint-plugin-css-modules'], rules: { 'css-modules/no-class': true, 'css-modules/static-local-class': true, }, };
Debug
Known issues
breakingv1.0.0 ships as ES Module only. CommonJS require() will throw.
fix
Use import syntax or dynamic import if using CommonJS project (e.g., 'const plugin = await import(...)').
affects: >=1.0.0
breakingNode.js <12.22.0 or between 13.x and 15.x may not be supported.
fix
Upgrade Node.js to a supported major version (12.22+, 14.17+, 16+).
affects: >=1.0.0
deprecatedember-template-lint v3 is not supported; peer dependency requires ^4.2.0
fix
Upgrade ember-template-lint to v4.2.0 or higher.
affects: >=1.0.0
gotchaRules must be prefixed with 'css-modules/' in .template-lintrc.js
fix
Use 'css-modules/no-class' instead of 'no-class'.
affects: >=0.1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module from /path/to/ember-template-lint-plugin-css-modules/index.js not supported. Instead rename the index.js to a file of .cjs extension...
CommonJS project trying to require the ESM-only plugin (v1.0.0+)
fix
Convert project to ESM or use dynamic import: const plugin = (await import('ember-template-lint-plugin-css-modules')).default;
Cannot find module 'ember-template-lint-plugin-css-modules'
Plugin not installed or peer dependency ember-template-lint missing
fix
Run 'npm install --save-dev ember-template-lint-plugin-css-modules' and ensure ember-template-lint ^4.2.0 is installed.
Validation error: Invalid rule name 'no-class' in config. Did you mean 'css-modules/no-class'?
Rule specified without the 'css-modules/' prefix
fix
Change rule key to 'css-modules/no-class' in your .template-lintrc.js.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
ember-template-lintrequiredPeer dependency; plugin is designed to work with ember-template-lint >=4.2.0
Agent activity
2 hits · last 30 days
node
2
Resources
ember-template-lint-plugin-css-modules — npm install ember-template-lint-plugin-css-modules · libregistry