zoukankan      html  css  js  c++  java
  • eslint配置调整

     phpstrom编辑器为例:可以在eslintrc.js中对代码的格式进行一些配置 解决代码格式不符合规则的报错

    module.exports = {
        root: true,
        env: {
            node: true
        },
        'extends': [
            'plugin:vue/essential',
            '@vue/standard'
        ],
        rules: {
            'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
            'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
            'indent': 'off',
            'space-unary-ops': 'off',             //关闭多余的空格检验
            'no-trailing-spaces': 'off',          //关闭无用的空格检测
            'semi': 'off',                        //关闭分号检测
            'space-before-function-paren': 'off',   //关闭function前的空格
            'no-multiple-empty-lines': 'off',
            'no-tabs': 'off',
        },
        parserOptions: {
            parser: 'babel-eslint'
        }
    }

     为了代码的规范化项目开发完后,要把添加的这些属于自己编辑习惯的配置注释掉或者删除掉(上面代码中红色的部分)然后在命令行执行 npm run lint 对代码格式进行初始化(前提是在package.json中有对 lint 进行配置)

    "scripts": {
        "dev": "node build/dev-server.js",
        "start": "npm run dev",
        "build": "node build/build.js",
        "lint": "eslint --fix --ext .js,.vue src"
      }, 
  • 相关阅读:
    kali 所有版本
    kali有关问题及kali2018.2安装
    python2
    burpsuite 破解教程
    python生成个性二维码
    万能密码
    python 1
    python
    python 第三方库安装
    Androidstdio 简单界面设计 登陆系统
  • 原文地址:https://www.cnblogs.com/rickyctbur/p/11824337.html
Copyright © 2011-2022 走看看