1.0.3 • Published 8 months ago

@gsc-basic/stylelint-config v1.0.3

Weekly downloads
-
License
UNLICENSED
Repository
gitlab
Last release
8 months ago

@gsc-basic/stylelint-config

Stylelint Config for GSC Basic Team

DO NOT use it in your own project if you don't know what it's for

说明

通过此拓展共享配置快速开始项目配置,内置支持Vue SFCLessHTML CSS的检查。

使用

Stylelint v16.9.0+ is now required.

pnpm i @gsc-basic/stylelint-config stylelint -D

// stylelint.config.mjs
export default {
  root: true,
  extends: ['@gsc-basic/stylelint-config'],
};
// package.json
{
  "scripts": {
    "lint:stylelint": "stylelint \"**/*.{vue,less,postcss,css}\" --fix"
  }
}

ignore

项目根目录添加 .stylelintignore

dist
public
__tests__
coverage

lint-staged支持

pnpm i lint-staged -D

// package.json
{
  "scripts": {
    "lint-staged": "lint-staged"
  },
  "lint-staged": {
    "*.{css,less,scss,postcss,vue}": [
      "stylelint --fix"
    ]
  }
}
# .husky/pre-commit
npm run lint-staged

echo Run pre-commit hook done.

VS code支持

安装 VS Code Stylelint 扩展

// .vscode/settings.json
{
  "stylelint.packageManager": "pnpm",
  "stylelint.validate": ["vue", "css", "less", "postcss", "scss"]
}