vscode的settings配置

"eslint.enable": true,
  "eslint.codeAction.showDocumentation": {
    "enable": true
  },
  "eslint.validate": ["javascript", "typescript", "javascriptreact", "typescriptreact", "html", "vue"],
  "typescript.validate.enable": true,
  "javascript.validate.enable": true,
  // 这里配置eslint和stylelint和prettier的自动格式化
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true, // 开启eslint 保存自动检测
    "source.fixAll.stylelint": true // 开启 Stylelint 保存自动检测
  },
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Community Material Theme Palenight High Contrast",
  "editor.fontFamily": "mononoki",
  "liveServer.settings.donotShowInfoMsg": true,
  "git.ignoreMissingGitWarning": true,
  "typescript.updateImportsOnFileMove.enabled": "always",
  // 当按tab键的时候,会自动提示
  "emmet.triggerExpansionOnTab": true,
  "emmet.showAbbreviationSuggestions": true,
  "emmet.includeLanguages": {
    "javascript": "javascriptreact"
  },
  "js/ts.implicitProjectConfig.checkJs": true,
  "workbench.startupEditor": "none",
  "stylelint.packageManager": "yarn",
  "[scss]": {
    "editor.defaultFormatter": "stylelint.vscode-stylelint"
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "workbench.commandPalette.preserveInput": true,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.detectIndentation": false,
  "[css]": {
    "editor.defaultFormatter": "stylelint.vscode-stylelint"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  // Stylelint 校验文件
  "stylelint.validate": ["css", "scss", "vue", "html", "tsx"],
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "prettier.printWidth": 120,
  "vue3snippets.printWidth": 120,
  "vue3snippets.tabWidth": 4,
  "[xml]": {
    "editor.defaultFormatter": "redhat.vscode-xml"
  },
  "scss.lint.unknownAtRules": "ignore",
  "css.lint.unknownAtRules": "ignore",
  "[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [80],
    "editor.selectionHighlight": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": false
},
"editor.formatOnSave": true,
"eslint.format.enable": true

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!对于VS Code配置ESLint不生效的问题,我可以提供一些建议。请按照以下步骤进行排查: 1. 确保已在项目中安装了ESLint,并且在项目的根目录下存在配置文件(一般为`.eslintrc`或`.eslintrc.js`)。 2. 确认您的VS Code已安装了ESLint插件。在扩展面板中搜索并安装ESLint插件。 3. 在VS Code的设置中,找到ESLint的配置项。您可以通过按下`Ctrl + ,`(Windows/Linux)或`Cmd + ,`(Mac)打开设置面板,然后搜索"eslint"来找到相关配置。 4. 在ESLint配置项中,确保已选中"自动修复"(autoFix)选项。这将使VS Code自动应用ESLint规则并修复一些常见问题。 5. 如果您的项目使用了特定的ESLint规则集(如Airbnb或Standard等),请确保已在VS Code的设置中指定正确的规则集。在`.eslintrc`文件中,您可以配置"extends"属性来指定所使用的规则集。 6. 如果您的项目有多个工作区文件夹,请确保在VS Code的设置中已正确配置ESLint的工作区设置。您可以在工作区文件夹的`.vscode/settings.json`文件中配置ESLint相关设置。 7. 尝试重启VS Code,然后打开您的项目,看看ESLint是否开始生效。 如果上述步骤都没有解决问题,您可以进一步检查以下可能的原因: - 您的项目中可能存在ESLint配置错误。请确保`.eslintrc`文件中的规则和插件设置正确,并符合您项目的需求。 - 如果您的项目使用了多个ESLint配置文件,请确保这些配置文件之间没有冲突,并且在VS Code的设置中正确指定了配置文件路径。 - 某些其他VS Code插件可能会干扰ESLint的工作。您可以尝试禁用其他插件,然后逐个启用以确定是否与其他插件冲突。 希望这些提示能够帮助您解决问题!如有更多疑问,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值