module.exports = {
  root: true,
  env: {
    node: true,
    browser: true,
    es6: true
  },
  extends: [
    "airbnb-base",
    "plugin:vue/recommended",
    "eslint:recommended",
  ],
  rules: {
    'no-console': 'off',
    
    'no-debugger': 'off',
    
    'no-use-before-define': 'off',
    
    // require trailing commas in multiline object literals
    'comma-dangle': ['error', {
      arrays: 'always-multiline',
      objects: 'always-multiline',
      imports: 'always-multiline',
      exports: 'always-multiline',
      functions: 'always-multiline',
    }],

    // disallow redundant `return await`
    // https://eslint.org/docs/rules/no-return-await#disallows-unnecessary-return-await-no-return-await
    'no-return-await': 'off',

    // Disallow Reassignment of Function Parameters
    // https://eslint.org/docs/rules/no-param-reassign#disallow-reassignment-of-function-parameters-no-param-reassign
    'no-param-reassign': 'off',

    // require return statements to either always or never specify values
    // https://eslint.org/docs/rules/consistent-return#require-return-statements-to-either-always-or-never-specify-values-consistent-return
    'consistent-return': 'off',
    
    'no-return-assign': 'off',

    // disallow bitwise operators
    // https://eslint.org/docs/rules/no-bitwise#disallow-bitwise-operators-no-bitwise
    'no-bitwise': 'off',

    // Disallow Unused Expressions
    // https://eslint.org/docs/rules/no-unused-expressions#disallow-unused-expressions-no-unused-expressions
    'no-unused-expressions': 'off',

    // require or disallow padding within blocks
    // https://eslint.org/docs/rules/padded-blocks#require-or-disallow-padding-within-blocks-padded-blocks
    'padded-blocks': 'off',
    
    'no-plusplus': 'off',
    
    'no-shadow': 'off',
  
    // Ensure consistent use of file extension within the import path
    // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/extensions.md
    'import/extensions': 'off',
  
    // Ensures an imported module can be resolved to a module on the local filesystem, as defined by standard Node require.resolve behavior.
    // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-unresolved.md
    'import/no-unresolved': 'off',
  
    // specify the maximum length of a line in your program
    // https://eslint.org/docs/rules/max-len
    'max-len': ['error', 140, 2, {
      ignoreUrls: true,
      ignoreComments: false,
      ignoreRegExpLiterals: true,
      ignoreStrings: true,
      ignoreTemplateLiterals: true,
    }],

    // Enforce line breaks after opening and before closing block-level tags
    'vue/block-tag-newline': 'error',

    // Enforce the maximum number of attributes per line
    'vue/max-attributes-per-line': ['error', {
      'singleline': {
        'max': 2,
        'allowFirstLine': true,
      },
      'multiline': {
        'max': 1,
        'allowFirstLine': false,
      },
    }],

    // 替换eslint max-len
    'vue/max-len': ['error', {
      code: 160,
      template: 160,
      tabWidth: 4,
    }],
    // vue template script indent
    'vue/html-indent': ['error', 2],
    'vue/script-indent': ['error', 2, {
      baseIndent: 1,
    }],
    // Require template literals instead of string concatenation
    'vue/prefer-template': 'warn',
    // require spaces around operators
    'space-infix-ops': 'error',
    'vue/space-infix-ops': 'error',
    // Require or disallow spaces before/after unary operators
    'space-unary-ops': ['error', {
      words: true,
      nonwords: false,
      overrides: {
      },
    }],
    'vue/space-unary-ops': ['error', {
      words: true,
      nonwords: false,
      overrides: {
      },
    }],
    // require or disallow spaces inside parentheses
    'space-in-parens': ['error', 'never'],
    'vue/space-in-parens': ['error', 'never'],
    // require padding inside curly braces
    'object-curly-spacing': ['error', 'always'],
    'vue/object-curly-spacing': ['error', 'always'],
    // enforce line breaks between braces
    // https://eslint.org/docs/rules/object-curly-newline
    'object-curly-newline': ['error', {
      ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
      ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
      ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
      ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
    }],
    'vue/object-curly-newline': ['error', {
      ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
      ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
      ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
      ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
    }],
    // enforce "same line" or "multiple line" on object properties.
    // https://eslint.org/docs/rules/object-property-newline
    'object-property-newline': ['error', {
      allowAllPropertiesOnSameLine: true,
    }],
    'vue/object-property-newline': ['error', {
      allowAllPropertiesOnSameLine: true,
    }],
  },
  overrides: [
    {
      files: ['*.vue'],
      rules: {
        'indent': 'off',
        'max-len': 'off'
      }
    },
  ],
};
