vscode的eslint的配置

eslint是为了让代码写的更加规范而出来的东西,为了让自己养成一个良好的编程习惯。自己花了一点时间学习怎么配置,也走了点弯路,真的是一不小心就会出错,一把心酸史,。下面是自己vscode配置eslint的方法

1、先安装eslint插件

2、npm install eslint

3、shift+Alt+F(按下组合键,瞬间按照eslint规则格式化代码)

4、一些其他配置(用于vue编程环境),需安装vetur、prettier插件(从别人那儿看来的,前三步就能解决eslint报错问题,这边主要是一些vue编程相关的配置)

{
    "editor.fontSize": 18,
    "window.zoomLevel": -1,
    "fileheader.Author": "Hansen",
    "fileheader.LastModifiedBy": "Hansen",
    "emmet.syntaxProfiles": {
        "vue-html": "html",
        "vue": "html",
    },
    "eslint.autoFixOnSave": true,
    "prettier.eslintIntegration": true,
    // "files.associations": {
    //     "*.ejs":"html",
    //     "*.vue":"html",
    // },
    "editor.tabSize": 2,
    // 以下为stylus配置
    "stylusSupremacy.insertColons": true, // 是否插入冒号
    "stylusSupremacy.insertSemicolons": false, // 是否插入分好
    "stylusSupremacy.insertBraces": false, // 是否插入大括号
    "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行
    "stylusSupremacy.insertNewLineAroundBlocks": false,
    "files.autoSave": "off", // 两个选择器中是否换行
    "eslint.codeAction.disableRuleComment": {
        "enable": true,
        "location": "separateLine"
    },
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue"
    ],
    "eslint.options": {
        "plugins": [
            "html"
        ]
    },
    "workbench.settings.useSplitJSON": true,
    "search.followSymlinks": false,
    "git.enabled": false,
    "git.autorefresh": false,
}
发布了62 篇原创文章 · 获赞 11 · 访问量 8613

猜你喜欢

转载自blog.csdn.net/qq_38588845/article/details/103950460