stylelint-logical-spec
v6.0.0
Published
Enforce usage of logical properties and values in CSS
Maintainers
Readme
stylelint-logical-spec
A stylelint plugin to enforce the use of logical properties and values instead of physical ones.
[!NOTE] This project is a fork of
Jordan-Hall/stylelint-use-logical-spec(originally inspired bycsstools/stylelint-use-logical).Why this fork exists:
- Modernization: Full migration to TypeScript for better type safety and developer experience.
- Compatibility: Support for Stylelint 16 and 17+.
- Standardization: Converted to a native ES Module (ESM) and modernized testing infrastructure.
Installation
npm install stylelint-logical-spec --save-devUsage
Add it to your stylelint configuration:
{
"plugins": ["stylelint-logical-spec"],
"rules": {
"liberty/use-logical-spec": true
}
}Rules
liberty/use-logical-spec
Enforces logical properties and values like margin-block-start instead of physical ones like margin-top.
Options
direction:ltr(default) orrtl. Controls the mapping of physical properties to logical ones.except: An array of properties or regex patterns to ignore.
{
"rules": {
"liberty/use-logical-spec": [true, { "direction": "rtl", "except": ["top"] }]
}
}Supports auto-fixing with --fix.
