@gsc-basic/stylelint-config

1.0.4 • Public • Published

@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"
  }
}

将依赖项提升到根模块目录,保证命令可以正常执行

# .npmrc
public-hoist-pattern[]=*postcss*

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"]
}

Package Sidebar

Install

npm i @gsc-basic/stylelint-config

Weekly Downloads

51

Version

1.0.4

License

UNLICENSED

Unpacked Size

5.67 kB

Total Files

4

Last publish

Collaborators

  • m1pha_lenovo
  • wangll47