An ESLint plugin that provides rules to verify CSS definition objects in JavaScript and TypeScript. Version 0.12.0 (released 2025-01-??) supports ESLint 10, flat config, and ships TypeScript declarations. It targets CSS-in-JS patterns like objects used in Vue, React (JSX), and styled-components style objects, offering an alternative to Stylelint for JS object styles. The plugin is actively maintained with regular releases (last few per year) and covers common CSS pitfalls such as invalid properties, property casing, and no-dupe-properties. Requires ESLint >=7.0.0 and Node.js >=12.22.0.
npm install eslint-plugin-cssVerified import paths — ran on the pinned version, not inferred.
Shows how to set up eslint-plugin-css with flat config in an ESLint v9+ project, enabling recommended rules and customizing selected rules.
Use eslint.config.js with flat config as shown in quickstart.
Use namespace import (import * as cssPlugin) instead of default import.
Access via cssPlugin.configs['flat/recommended'].
Review rule changes for ESLint 10 compatibility, especially if upgrading from earlier plugin versions.
Always prefix rule names with 'css/' inside rules object.
Run 'npm install eslint-plugin-css --save-dev' and ensure it's in node_modules.
Change 'import cssPlugin from ...' to 'import * as cssPlugin from ...'.
Use 'error' or ['error', ...options] instead of naked severity.