有没有办法只在播放JS文件时运行NPM脚本?具体来说,在import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.DataFrame({'Month': ['January','February','March','April','May','June','July','August','September','October','November','December',
'January','February','March','April','May','June','July','August','September','October','November','December'],
'Year': [2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,
2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,],
'hPM2.5': [18,17,21,14,7,7,8,7,9,11,23,5,
18,17,21,14,7,7,8,7,9,11,23,5]})
cats = ['January','February','March','April','May','June',
'July','August','September','October','November','December']
df['Month'] = df['Month'].astype('category',
ordered=True,
categories=cats)
df2 = df.pivot("Month", "Year", "hPM2.5")
sns.heatmap(df2, annot=True)
git hook之后(使用Husky)。我的pre-commit
中有以下脚本:
package.json
如果有JS文件暂存,我希望只能运行"scripts": {
...
"test": "jest",
"precommit": "npm test",
...
},
。我怎样才能做到这一点?
答案 0 :(得分:1)
你见过这个吗?
https://github.com/okonet/lint-staged
您可以这样配置:
将
"lint-staged": { "*.js": "eslint" }
添加到package.json