乱码乱a∨中文字幕,在线免费激情视频,亚洲欧美久久夜夜潮,国产在线网址

  1. <sub id="hjl7n"></sub>

    1. <sub id="hjl7n"></sub>

      <legend id="hjl7n"></legend>

      當(dāng)前位置:首頁 >  站長 >  編程技術(shù) >  正文

      vscode配置setting.json文件實現(xiàn)eslint自動格式代碼

       2020-11-09 11:01  來源: 腳本之家   我來投稿 撤稿糾錯

        阿里云優(yōu)惠券 先領(lǐng)券再下單

      這篇文章主要介紹了vscode配置setting.json文件實現(xiàn)eslint自動格式代碼,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

      一、ESlint+Vetur 實現(xiàn)ESlint代碼規(guī)范

      二、重點----舊版本(舊版本配置在setting.json 會出現(xiàn)警告)

       

      {
      “eslint.autoFixOnSave”: true,
      “eslint.validate”: [
      “javascript”,
      {
      “language”: “vue”,
      “autoFix”: true
      },
      {
      “language”: “html”,
      “autoFix”: true
      }
      ]
      }

      三、新版配置----新版本

      {
      “editor.codeActionsOnSave”: {
      “source.fixAll.eslint”: true
      },
      “eslint.probe”: [“javascript”, “vue”, “html”]
      }

      以下是對自己vscode-settings.json 做一個記錄(僅供參考)

      {
      //設(shè)置文字大小
      "editor.fontSize": 18,

      //設(shè)置文字行高
      "editor.lineHeight": 24,

      //開啟行數(shù)提示
      "editor.lineNumbers": "on",

      // 在輸入時顯示含有參數(shù)文檔和類型信息的小面板。
      "editor.parameterHints.enabled": true,

      // 調(diào)整窗口的縮放級別
      "window.zoomLevel": 0,

      // 文件目錄
      "workbench.iconTheme": "vscode-icons",

      // 設(shè)置字體
      "editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",

      // 自動換行
      "editor.wordWrap": "on",

      // 自定義vscode面板顏色
      "workbench.colorCustomizations": {
      "tab.activeBackground": "#253046", // 活動選項卡的背景色
      "activityBar.background": "#253046", //活動欄背景色
      "sideBar.background": "#253046", //側(cè)邊欄背景色
      "activityBar.foreground": "#23f8c8", //活動欄前景色(例如用于圖標)
      "editor.background": "#292a2c" //編輯器背景顏色
      // "editor.foreground":"#ff0000", //編輯器默認前景色
      // "editor.findMatchBackground":"#23f8c8", //當(dāng)前搜索匹配項的顏色
      // "editor.findMatchHighlightBackground":"#ff0000", //其他搜索匹配項的顏色
      // "editor.lineHighlightBackground":"#ff0000", //光標所在行高亮文本的背景顏色
      // "editor.selectionBackground":"#ff0000", //編輯器所選內(nèi)容的顏色
      // "editor.selectionHighlightBackground":"#ff0000", //與所選內(nèi)容具有相同內(nèi)容的區(qū)域顏色
      // "editor.rangeHighlightBackground":"#ff0000", //突出顯示范圍的背景顏色,例如 "Quick Open" 和“查找”功能
      // "editorBracketMatch.background":"#ff0000", //匹配括號的背景色
      // "editorCursor.foreground":"#ff0000", //編輯器光標顏色
      // "editorGutter.background":"#ff0000", //編輯器導(dǎo)航線的背景色,導(dǎo)航線包括邊緣符號和行號
      // "editorLineNumber.foreground":"#ff0000", //編輯器行號顏色
      // "sideBar.foreground":"#ff0000", //側(cè)邊欄前景色
      // "sideBarSectionHeader.background":"#ff0000", //側(cè)邊欄節(jié)標題的背景顏色
      // "statusBar.background":"#ff0000", //標準狀態(tài)欄背景色
      // "statusBar.noFolderBackground":"#ff0000", //沒有打開文件夾時狀態(tài)欄的背景色
      // "statusBar.debuggingBackground":"#ff0000", //調(diào)試程序時狀態(tài)欄的背景色
      // "tab.activeForeground":"#ff0000", //活動組中活動選項卡的前景色
      // "tab.inactiveBackground":"#ff0000", //非活動選項卡的背景色
      // "tab.inactiveForeground":"#ff0000" // 活動組中非活動選項卡的前景色
      },
      // vscode默認啟用了根據(jù)文件類型自動設(shè)置tabsize的選項
      "editor.detectIndentation": false,

      // 重新設(shè)定tabsize
      "editor.tabSize": 2,

      // #每次保存的時候自動格式化
      "editor.formatOnSave": true,

      // #讓函數(shù)(名)和后面的括號之間加個空格
      "javascript.format.insertSpaceBeforeFunctionParenthesis": true,

      // #這個按用戶自身習(xí)慣選擇
      "vetur.format.defaultFormatter.html": "js-beautify-html",

      // #讓vue中的js按編輯器自帶的ts格式進行格式化
      "vetur.format.defaultFormatter.js": "vscode-typescript",

      // 保存時運行的代碼ESLint操作類型。
      "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
      },

      // 添加emmet支持vue文件
      "emmet.includeLanguages": {
      "wxml": "html",
      "vue": "html"
      },

      // 兩個選擇器中是否換行
      "minapp-vscode.disableAutoConfig": true,

      //快速預(yù)覽(右側(cè))
      "editor.minimap.enabled": true,

      // tab 代碼補全
      "files.associations": {
      "*.wpy": "vue",
      "*.vue": "vue",
      "*.cjson": "jsonc",
      "*.wxss": "css",
      "*.wxs": "javascript"
      },

      // 用來配置如何使用ESLint CLI引擎API啟動ESLint。 默認為空選項
      "eslint.options": {
      "extensions": [".js", ".vue"]
      },

      // 在onSave還是onType時執(zhí)行l(wèi)inter。默認為onType。
      "eslint.run": "onSave",

      // 啟用ESLint作為已驗證文件的格式化程序。
      "eslint.format.enable": true,

      // 語言標識符的數(shù)組,為此ESLint擴展應(yīng)被激活,并應(yīng)嘗試驗證文件。
      "eslint.probe": ["javascript", "javascriptreact", "vue-html", "vue", "html"],

      //關(guān)閉rg.exe進程 用cnpm導(dǎo)致會出現(xiàn)rg.exe占用內(nèi)存很高
      "search.followSymlinks": false,

      // 給js-beautify-html設(shè)置屬性隔斷
      "vetur.format.defaultFormatterOptions": {
      "js-beautify-html": {
      "wrap_attributes": "force-aligned",
      "max_preserve_newlines": 0
      }
      },

      // style默認偏移一個indent
      "vetur.format.styleInitialIndent": true,

      // 定義匿名函數(shù)的函數(shù)關(guān)鍵字后面的空格處理。
      "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,

      // 定義函數(shù)參數(shù)括號前的空格處理方式。
      "typescript.format.insertSpaceBeforeFunctionParenthesis": true,

      // 新版本消息
      "vsicons.dontShowNewVersionMessage": true,

      // 控制資源管理器是否在把文件刪除到廢紙簍時進行確認。
      "explorer.confirmDelete": true,

      // 使用eslint-plugin-vue驗證<template>中的vue-html
      "vetur.validation.template": false,

      // 指定用在工作臺中的顏色主題。
      "workbench.colorTheme": "One Dark Pro"
      }

      總結(jié)

      到此這篇關(guān)于vscode配置setting.json文件實現(xiàn)eslint自動格式代碼的文章就介紹到這了,更多相關(guān)vscode 配置eslint自動格式化內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

      文章轉(zhuǎn)自腳本之家,原文鏈接:https://www.jb51.net/article/193431.htm

      申請創(chuàng)業(yè)報道,分享創(chuàng)業(yè)好點子。點擊此處,共同探討創(chuàng)業(yè)新機遇!

      相關(guān)文章

      熱門排行

      信息推薦