1、vscode代码保存时自动格式化成 ESLint风格(支持VUE)   :   http://www.ptbird.cn/vscode-autosave-eslint-support-vue.html

   另,vscode中非webpack等一些构建工具项目,也可以使用eslint风格。但是需要额外安装eslint包,生成.eslintrc.*文件:  https://segmentfault.com/a/1190000009077086(亲测有效)

npm install eslint --save-dev

    项目目录下创建一个 .eslintrc.* 的配置文件或 使用命令行(./node_modules/.bin/eslint --init,推荐这种方法)生成这个文件。具体规则可以自己根据需要定制的  https://www.cnblogs.com/yesu/p/7852527.html。 

VsCode编辑器
module.exports = {
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "sourceType": "module"
    },
    "rules": {
        "indent": [
            "error",
            4
        ],
        "linebreak-style": [
            "error",
            "windows"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "never"
        ]
    }
};
View Code

相关文章:

  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2020-03-27
  • 2022-12-23
  • 2021-11-30
  • 2021-07-24
  • 2021-12-02
猜你喜欢
  • 2021-07-10
  • 2022-12-23
  • 2021-08-27
  • 2021-12-08
  • 2021-12-19
  • 2021-06-15
相关资源
相似解决方案