报错如下:
[error] No files matching the pattern were found: "src/**/*.js".
[error] No files matching the pattern were found: "src/**/*.jsx".
[error] No files matching the pattern were found: "src/**/*.json".
[error] No files matching the pattern were found: "src/**/*.less".
[error] No files matching the pattern were found: "src/**/*.md".
这是由于本地没有匹配到这些类型的文件,解决方法如下:
prettier2.0版本升级前(可正常使用,不会报错)
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject",
"prettier": "prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,less,md}"
},
prettier2.0版本升级后(需要额外添加引号)
"prettier": "prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,less,md}"
更换为:
"prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,less,md}\""