stylelint-plugin-fpm
v0.0.2
Published
Stylelint custom rules for the fpm CSS convention.
Maintainers
Readme
stylelint-plugin-fpm
Custom Stylelint rules for the FPM CSS Coding Conventions.
The plugin enforces FPM-specific Class A rules, including class/file-name matching, global and JavaScript-only class handling, nesting constraints, Custom Property ownership, and responsive-rule placement.
Most projects should use
stylelint-config-fpm, which
configures this plugin together with the standard Stylelint rules used by FPM.
Installation
pnpm add -D stylelint stylelint-plugin-fpmUsage
Enable the plugin and the rules your project needs in the Stylelint configuration.
// stylelint.config.cjs
module.exports = {
plugins: ["stylelint-plugin-fpm"],
rules: {
"fpm/selector-file-prefix": true,
"fpm/no-restricted-type-selector": true,
},
};For the complete FPM ruleset, use stylelint-config-fpm instead.
Nesting and global overrides
fpm/max-selector-nesting-depth: 1 permits one selector nesting level and excludes
@media from the depth in either order. Other at-rules keep standard nesting-depth
counting. Use it instead of max-nesting-depth; fpm/no-root-media still rejects
file-root media. Ownership checks also follow nested & through media.
fpm/global-var-contract permits existing --v-* overrides on the file-named
module class or .g-* subjects in _g.css, including mode compounds. Every
selector-list branch must qualify. Base definitions belong in _v.css :root;
the rule does not check whether the central definition exists. No opt-in is needed.
