eslint不允许使用4个空格进行缩进

时间:2018-04-20 15:58:13

标签: vue.js eslint

我为我的项目安装了eslint和eslint-plugin-vue。 当我在浏览器中加载项目时,我在控制台中收到以下警告:

  

http://eslint.org/docs/rules/indent预计缩进2个空格但发现4个     SRC \ _nav.js:2:1

这是我的_nav.js:

export default {
    items: [{  /*this is line 2 - indented with 4 spaces*/

我试图告诉lint我想要使用4个空格,但我仍然收到警告。我对.vue文件有同样的问题。

这是我的.eslintrc.js:

module.exports = {
    root: true,
    parserOptions: {
        parser: 'babel-eslint'
    },
    env: {
        browser: 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": ["error", 4],
        "vue/html-indent": ["error", 4],
        "vue/script-indent": ["error", 4],
    }
}

0 个答案:

没有答案