
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@simonsmith/stylelint-component-custom-property
Advanced tools
Stylelint plugin that validates CSS custom properties in CSS modules to ensure they follow a component-based naming convention.
Stylelint plugin that validates CSS custom properties in CSS modules to ensure they follow a component-based naming convention.
When working with CSS modules, components often expose custom properties as a public API that can be overridden by parent components. This plugin validates that these public custom properties follow a consistent naming convention based on the component name.
For example, if your CSS module is named Button.module.css:
.button {
/* Public API - validated */
background-color: var(--Button-primary-color, #007bff);
/* Private properties - not validated */
--internal-state: active;
}
This convention helps with:
npm install --save-dev @simonsmith/stylelint-component-custom-property
yarn add --dev @simonsmith/stylelint-component-custom-property
pnpm add --save-dev @simonsmith/stylelint-component-custom-property
Add the plugin to your stylelint configuration:
{
"plugins": ["@simonsmith/stylelint-component-custom-property"],
"rules": {
"@simonsmith/stylelint-component-custom-property": true
}
}
The rule accepts different validation types:
Validates only that custom properties match the component name from the filename:
{
"plugins": ["@simonsmith/stylelint-component-custom-property"],
"rules": {
"@simonsmith/stylelint-component-custom-property": true
}
}
Validates SUIT CSS naming conventions:
{
"plugins": ["@simonsmith/stylelint-component-custom-property"],
"rules": {
"@simonsmith/stylelint-component-custom-property": {
"validationType": "suitcss"
}
}
}
Due to the potential ambiguity of the validation pattern in SUIT CSS this option prefers to lean on being more relaxed rather than incorrectly flagging properties as invalid. See the unit tests for what it covers currently
Use your own regular expression for suffix validation:
{
"plugins": ["@simonsmith/stylelint-component-custom-property"],
"rules": {
"@simonsmith/stylelint-component-custom-property": {
"validationType": /^-[a-z][a-zA-Z]*$/
}
}
}
{
"rules": {
"@simonsmith/stylelint-component-custom-property": false
}
}
The plugin:
.module.css--ComponentName-The plugin validates custom properties only when they're used as public API declarations.
Custom properties used in var() functions with fallback values are treated as component API declarations:
.container {
gap: var(--Button-spacing, 1rem);
width: var(--Button-max-width, 320px);
}
Direct custom property assignments are considered private implementation details:
.button {
--internal-state: hover;
--computed-size: calc(100% - 2rem);
}
Custom properties used without fallbacks are considered consumption of existing properties:
.button {
color: var(--theme-primary);
margin: var(--Button-spacing);
}
Button.module.css
.button {
/* Public API declarations - validated */
background-color: var(--Button-primary-color, #007bff);
padding: var(--Button-padding, 0.5rem 1rem);
/* Private properties - not validated */
--internal-state: default;
--computed-width: calc(100% - 2rem);
/* Consuming existing properties - not validated */
margin: var(--global-spacing);
font-family: var(--theme-font);
}
/* Overriding child component APIs - not validated */
.button-container {
--Icon-size: 16px;
--Tooltip-background: var(--Button-primary-color);
}
Button.module.css
.button {
/* Wrong prefix in API declaration */
background: var(--wrong-color, red);
/* No prefix in API declaration */
padding: var(--spacing, 1rem);
}
The plugin supports stylelint's --fix option and will automatically correct invalid custom property prefixes in API declarations:
stylelint "**/*.module.css" --fix
MIT
FAQs
Stylelint plugin that validates CSS custom properties in CSS modules to ensure they follow a component-based naming convention.
We found that @simonsmith/stylelint-component-custom-property demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.