• vscode eslint 自动保存


    vscode安装插件Prettier - JavaScript formatter和vetur

    File -> Preference -> Settings(如果装了中文插件包应该是 文件 -> 选项 -> 用户),搜索 eslint,点击 Edit in setting.json

    最新版本只需添加

    {
    "editor.codeActionsOnSave": {
            "source.fixAll.eslint": true,
        },
    
    }

    添加后 ,Ctrl+s保存会自动按照你的项目建的eslintrc.js文件的规则修复

    我的eslintrc.js内容:

    module.exports = {
        settings: {
            "import/resolver": {
                webpack: {
                    config: './build/webpack.base.conf.js'
                }
            }
        },
        "env": {
            "browser": true,
            "es6": true
        },
        "extends": [
            "plugin:vue/base",
            "airbnb-base",
        ],
        "globals": {
        },
        "parserOptions": {
            "parser": "babel-eslint",
            // "ecmaVersion": 2018,
            // "sourceType": "module",
        },
        plugins: [
            "vue",
        ],
        "rules": {
            "no-unused-vars": "warn",
            "import/extensions": "warn",
            "import/no-extraneous-dependencies": [2, { "devDependencies": true }],
            "import/no-unresolved": [2, { "ignore": ["antd-mobile"] }],
            "no-param-reassign": "warn",
            "max-len": ["error", { "code": 120 }],
            "vue/no-parsing-error": "warn",
            "arrow-parens": "off",
            "consistent-return": "off",
            "no-else-return": "off",
            "prefer-destructuring": "off",
            "strict": "off",
            "linebreak-style": "off",
            "prefer-template": "off",
            "no-unreachable": "off",
        }
    };

     

  • 相关阅读:
    js当地天气调用
    js 3D旋转效果
    js 格林威治时间转正常格式并兼容ios
    vue中使用百度地图,悬浮窗搜索功能
    js 百度地图定位
    高德地图坐标与百度地图坐标相互转换
    js高德地图手机定位
    数据循环处理重组2
    数据循环处理重组1
    百度地图搜索框在弹框中不显示
  • 原文地址:https://www.cnblogs.com/yck123/p/12366909.html
Copyright © 2020-2023  润新知