1. react專案
配置 package.json
需要安裝 npm i @babel/plugin-proposal-decorators
可能需要重啟專案
{
"babel": {
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
],
"presets": [
"react-app"
]
}
}
2. 配置vscode setting.json檔案消除警告
// 去除裝飾器警告
"problems.decorations.enabled": false,
3.新增.eslintrc檔案 消除eslint 警告
實際測試,只要新增 "parser": "babel-eslint",就可以消除,其餘不加不影響
{
"extends": "standard",
"parser": "babel-eslint",
"plugins": [
"html"
]
}