ESlint 保存自动格式化代码

简介: 第一步:在VScode下载ESlint插件,找到右下角设置图标点击扩展设置。

第一步:在VScode下载ESlint插件,找到右下角设置图标点击扩展设置。

image.jpeg


第二步:选择打开 右上角的json配置文件



第三步:引入代码

{
    "emmet.triggerExpansionOnTab": true,
    "editor.fontSize": 18,
    "editor.tabSize": 2,
    "update.showReleaseNotes": false,
    "prettier.printWidth": 150,
    "workbench.editor.untitled.hint": "hidden",
    "prettier.arrowParens": "avoid",
    "prettier.vueIndentScriptAndStyle": true,
    "terminal.integrated.tabs.enabled": true,
    "git.enableSmartCommit": true,
    "explorer.confirmDelete": false,
    "editor.acceptSuggestionOnEnter": "smart",
    "workbench.enableExperiments": false,
    "security.workspace.trust.enabled": false,
    "path-intellisense.mappings": {
     "@": "${workspaceRoot}/src"
    },
    "prettier.jsxSingleQuote": true,
    "prettier.semi": false,
    "explorer.compactFolders": false,
    "explorer.incrementalNaming": "smart",
    "eslint.alwaysShowStatus": true,
    "editor.codeActionsOnSave": {
     "source.fixAll.eslint": true
    },
    "eslint.useESLintClass": true,
    "editor.detectIndentation": false,
    "editor.formatOnSave": true,
    "eslint.format.enable": true,
    "gitlens.advanced.messages": {
     "suppressGitMissingWarning": true
    },
    "editor.suggestSelection": "recentlyUsed",
    "editor.minimap.enabled": false,
    "editor.unicodeHighlight.allowedCharacters": {
     ":": true
    },
    "prettier.singleQuote": true,
    "update.enableWindowsBackgroundUpdates": false,
    "update.mode": "start",
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.guides.bracketPairs": "active",
    "workbench.startupEditor": "none",
    "eslint.run": "onSave",
    "workbench.editor.splitInGroupLayout": "vertical",
    "[vue]": {
     "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
     "editor.defaultFormatter": "dbaeumer.vscode-eslint"
    },
    "eslint.probe": [
     "javascript",
     "javascriptreact",
     "typescript",
     "typescriptreact",
     "html",
     "vue",
     "markdown",
     "Vue",
     "VUE"
    ],
    "files.associations": {
     "*.vue": "vue"
    },
}
相关文章
启用 ESLint 后 解决格式化文档自动添加分号和双引号问题
启用 ESLint 后 解决格式化文档自动添加分号和双引号问题
1047 0
启用 ESLint 后 解决格式化文档自动添加分号和双引号问题
|
30天前
|
JSON JavaScript 前端开发
成功解决:正则表达式在vscode中会自动格式化一部分
这篇文章讨论了在Visual Studio Code中编写正则表达式时遇到的问题,即正则表达式因自动格式化而变形,并提供了使用双反斜杠、确保在字符串中定义正则表达式、检查文件类型等解决方法来避免这一问题。
成功解决:正则表达式在vscode中会自动格式化一部分
|
1月前
vscode——Prettier插件保存自动格式化
vscode——Prettier插件保存自动格式化
39 0
|
2月前
webstorm【实用教程】代码自动格式,格式化时清除空行,修改使用代码模板
webstorm【实用教程】代码自动格式,格式化时清除空行,修改使用代码模板
176 2
|
2月前
|
前端开发 JavaScript 开发工具
vscode教程(含使用技巧、保存时自动格式化文件等设置)
vscode教程(含使用技巧、保存时自动格式化文件等设置)
181 0
|
4月前
IDEA常用配置之代码自动格式化删除无用导入
IDEA常用配置之代码自动格式化删除无用导入
273 1
|
Java Android开发
eclipse保存自动组织导入、删除不必要的导入、格式化代码
eclipse保存自动组织导入、删除不必要的导入、格式化代码
Vscode如何配置自己的eslint实现自动格式化代码
Vscode如何配置自己的eslint实现自动格式化代码
Goland 开启文件保存自动进行格式化 的两种方式
Goland 开启文件保存自动进行格式化 的两种方式
Goland 开启文件保存自动进行格式化 的两种方式