1.0.4 • Published 6 years ago

yoho-lint v1.0.4

Weekly downloads
5
License
ISC
Repository
-
Last release
6 years ago

前端代码检查库

安装

npm install yoho-lint

配置

在package.json中配置config字段

example:

"config": {
    "lintJs": [
      {
        "title": "JS",
        "path": [
          "."
        ]
      }
    ],
    "lintCss": [
      {
        "title": "CSS",
        "path": [
          "public/scss/**/*.css",
          "public/**/*.vue"
        ]
      }
    ]
  }

lintJs数组中可以定义多个检查项,每个项目可以设置标题和路径path,路径支持string和array

lintCss同上

使用

在package.json的scripts中定义执行命令行:

"scripts": {
    "lint-js": "lint-js",
    "lint-css": "lint-css",
    "lint-all": "lint-all",
    "precommit": "lint-commit"
  },

lint-js在配置的文件范围内对js和vue文件检查

lint-css在配置的文件范围内对css和vue文件检查

lint-all相当于同时执行了lint-js和lint-css

lint-commit git commit的hook检查提交文件的js css语法