Skip to content

Instantly share code, notes, and snippets.

@heycqing
Created January 19, 2021 07:41
Show Gist options
  • Select an option

  • Save heycqing/55de00e510408fd8d75d1e70436b59c0 to your computer and use it in GitHub Desktop.

Select an option

Save heycqing/55de00e510408fd8d75d1e70436b59c0 to your computer and use it in GitHub Desktop.
在package.json文件中添加针对文件类型的格式化和校验
"lint": "eslint --ext .js --ext .vue src/",
"lint-fix": "eslint --fix --ext .js --ext .vue src/",
"prettier-fix": "prettier --write 'src/**/*.json' 'src/**/*.md' ",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*{.vue,.js}": [
"prettier --write",
"eslint --fix",
"git add"
],
"src/**/*{.json,.md,.mdx}": [
"prettier --write",
"git add"
],
"src/**/*{.less,.scss,.sass,.css}": [
"prettier --write",
"git add"
]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment