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,
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值