1.2.0 • Published 2 years ago

@houheaven/stylelint-config-helper v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@houheaven/stylelint-config-helper

Stylelint 规则助手
主要功能是处理 css、less 中的语法校验、代码格式化

特点

  • 内置了 stylelint 全部规则,并对其规则进行了优化
  • 默认支持 CSS 文件,可直接修改规则
  • 默认支持 Less 文件,可直接修改规则,无需配置(依赖于 postcss-less
  • 默认支持 Vue 文件,可直接修改规则,无需配置(依赖于 postcss-html
  • 默认支持 html 文件,可直接修改规则,无需配置(依赖于 postcss-html

安装

npm install --dev @houheaven/stylelint-config-helper

用法

在 Stylelint 配置文件中的 "extends" 数组里添加 "@houheaven/stylelint-config-helper"

// .stylelintrc.js

module.exports = {
  extends: [
    // ... 其他配置
    "@houheaven/stylelint-config-helper"
  ]
};

修改 Stylelint 规则

在 Stylelint 配置文件中的 "rules" 里添加规则。

// .stylelintrc.js

module.exports = {
  rules: {
    "indentation": "2",
    "linebreaks": "unix",
    "color-hex-case": "lower",
    "color-hex-length": "short",
    "number-leading-zero": "always",
    "unit-no-unknown": [true, {
      ignoreUnits: ["rpx"],
    }],
  }
};

更多

功能依赖: