這裏你需要下載安裝 VScode編輯器:
- 下載安裝VScode編輯器
- 安裝eslint 和 preitter插件
安裝完可以看到底部配置項內容:
- 修改eslint配置項
修改內容爲:
右邊的內容爲:
{
"window.zoomLevel": 0,
// Controls the font size in pixels.
"editor.fontSize": 14,
// The number of spaces a tab is equal to. This setting is overridden based on the file contents when `editor.detectIndentation` is on.
"editor.tabSize": 2,
// Always show the ESlint status bar item.
"eslint.alwaysShowStatus": true,
// An array of language ids which should be validated by ESLint
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
},
"html",
"vue"
],
// Turns auto fix on save on or off.
"eslint.autoFixOnSave": true
}
因爲這個項目我使用了vue, r如果是react或者其他語言配置相似,適當修改內容。