eslint 習慣格式

// https://eslint.org/docs/user-guide/configuring

module.exports = {
    root: true,
    parserOptions: {
        parser: 'babel-eslint'
    },
    env: {
        browser: true,
        "jquery": true
    },
    extends: [
        // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
        // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
        'plugin:vue/essential',
        // https://github.com/standard/standard/blob/master/docs/RULES-en.md
        'standard'
    ],
    // required to lint *.vue files
    plugins: [
        'vue'
    ],
    // add your custom rules here
    rules: {
        // allow async-await
        'generator-star-spacing': 'off',
        // allow debugger during development
        'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
        // 首行縮進
        'indent': 0,
        // 空格
        'no-tabs': 'off',
        // 必須設置分號
        // 'semi':['error','always'],
        "semi-spacing": [2, { "before": false, "after": true }],
        // 強制在 function的左括號之後使用空格
        "space-before-function-paren": 'off',
        // 沒有定義了沒有被使用到的變量
        "no-unused-vars": [0, { "vars": "all", "args": "none" }],
        // 要求使用 === 和 !==
        "eqeqeq": "off"
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章