例如,我在.rb和.js文件中进行了匹配。
例如**/*.{js,rb}
例如,还希望在Gemfile
和Rakefile
上进行匹配。
解决方案是递归使用{}
,例如
"lint-staged": {
"{Gemfile,Rakefile,**/*.{js,rb,rake,ru}}": [
"./node_modules/prettier/bin-prettier.js --write"
],
"**/*.js": [
"node_modules/eslint/bin/eslint.js"
],
"{Gemfile,Rakefile,**/*.{rb,rake,ru}}": [
"bundle exec rubocop -a"
]
}