{"id":25218,"library":"ember-template-lint-plugin-css-modules","title":"ember-template-lint-plugin-css-modules","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/simplabs/ember-template-lint-plugin-css-modules","tags":["javascript"],"install":[{"cmd":"npm install ember-template-lint-plugin-css-modules","lang":"bash","label":"npm"},{"cmd":"yarn add ember-template-lint-plugin-css-modules","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-template-lint-plugin-css-modules","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin is designed to work with ember-template-lint >=4.2.0","package":"ember-template-lint","optional":false}],"imports":[{"note":"The plugin is referenced by package name in .template-lintrc.js; no direct import needed.","wrong":"plugins: ['ember-template-lint-plugin-css-modules/index']","symbol":"plugin","correct":"plugins: ['ember-template-lint-plugin-css-modules']"},{"note":"Rule names must be prefixed with 'css-modules/' to namespace them correctly.","wrong":"rules: { 'no-class': true }","symbol":"rules","correct":"rules: { 'css-modules/no-class': true }"},{"note":"Since v1.0.0, the package is ESM-only; require() will fail.","wrong":"const plugin = require('ember-template-lint-plugin-css-modules');","symbol":"default import (ESM)","correct":"import plugin from 'ember-template-lint-plugin-css-modules';"}],"quickstart":{"code":"// .template-lintrc.js - ESM (requires Node ES module)\nimport plugin from 'ember-template-lint-plugin-css-modules';\n\nexport default {\n  plugins: ['ember-template-lint-plugin-css-modules'],\n  rules: {\n    'css-modules/no-class': true,\n    'css-modules/static-local-class': true,\n  },\n};","lang":"javascript","description":"Shows how to configure ember-template-lint with the plugin and both available rules."},"warnings":[{"fix":"Use import syntax or dynamic import if using CommonJS project (e.g., 'const plugin = await import(...)').","message":"v1.0.0 ships as ES Module only. CommonJS require() will throw.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to a supported major version (12.22+, 14.17+, 16+).","message":"Node.js <12.22.0 or between 13.x and 15.x may not be supported.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade ember-template-lint to v4.2.0 or higher.","message":"ember-template-lint v3 is not supported; peer dependency requires ^4.2.0","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use 'css-modules/no-class' instead of 'no-class'.","message":"Rules must be prefixed with 'css-modules/' in .template-lintrc.js","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Convert project to ESM or use dynamic import: const plugin = (await import('ember-template-lint-plugin-css-modules')).default;","cause":"CommonJS project trying to require the ESM-only plugin (v1.0.0+)","error":"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..."},{"fix":"Run 'npm install --save-dev ember-template-lint-plugin-css-modules' and ensure ember-template-lint ^4.2.0 is installed.","cause":"Plugin not installed or peer dependency ember-template-lint missing","error":"Cannot find module 'ember-template-lint-plugin-css-modules'"},{"fix":"Change rule key to 'css-modules/no-class' in your .template-lintrc.js.","cause":"Rule specified without the 'css-modules/' prefix","error":"Validation error: Invalid rule name 'no-class' in config. Did you mean 'css-modules/no-class'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}