**
安装 Visual Studio Code ESLint 插件
**
打开 Visual Studio Code ,首先使用快捷键 Ctrl + Shift + P 调出VsCode的控制台,然后输入下面的命令安装ESLint插件:
ext install ESLint
使用 NPM 安装 ESLint
为了方便我们通过ESLint命令行工具来帮助我们生成ESLint相关的配置,我们需要进行全局安装:
npm install eslint -g
配置 visual Studio Code 找到settings
找到settings.json 放入一下代码
{ //
"vetur.validation.template": false,
"editor.fontSize": 16,//Fira Code
"editor.fontFamily": "Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.formatOnType": true,
"editor.renderWhitespace": "all",
"editor.wordSeparators": "`~!@#$%^&*()=+[{]}\|;:'\",.<>",
"extensions.autoUpdate": true,
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html",
// "javascript": "jsx",
"javascript": "html"
},
"emmet.includeLanguages": {
"vue-html": "html",
"vue": "html",
"javascript": "javascriptreact",
"wxml": "html"
},
"emmet.triggerExpansionOnTab": true,
"terminal.external.windowsExec": "C:\#Alan\Software\cmder\Cmder.exe",
"eslint.validate": [
"javascript",
"javascriptreact",
"vue-html",
{
"language": "vue",
"autoFix": true
},
"html",
"vue"
],
// 需要 npm install -g eslint-plugin-vue
"eslint.options": {
"extensions": [
".js",
".vue"
]
},
"files.associations": {
"*.vue": "vue",
"*.js": "javascript",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript",
// "*.wpy": "vue"
},
"editor.cursorBlinking": "smooth",
"sync.gist": "fdb18e3ec92c75bb841502887ff811ad",
"sync.autoDownload": false,
"sync.autoUpload": false,
"sync.forceDownload": false,
"sync.quietSync": false,
"editor.renderIndentGuides": false,
"search.exclude": {
"**de_modules": true,
"**/bower_components": true,
"**/dist": true
},
"vetur.format.styleInitialIndent": true,
"vetur.format.scriptInitialIndent": true,
"eslint.autoFixOnSave": true,
"window.zoomLevel": 0,
"sync.askGistName": false,
"fileheader.Author": "Alan-Yih",
"workbench.startupEditor": "newUntitledFile",
"liveServer.settings.donotShowInfoMsg": true,
"git.confirmSync": false,
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"workbench.colorCustomizations": {},
// "materialTheme.cache.workbench.settings": {
// "accentPrevious": "Purple",
// "themeColours": "Default"
// },
"python.disablePromptForFeatures": [
"pylint"
],
"python.linting.flake8Enabled": true