// http://eslint.org/docs/user-guide/configuring
const path = require('path');

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module',
  },
  env: {
    browser: true,
  },
  extends: [
    'airbnb-base',
    'plugin:vue/recommended',
    // "plugin:vue-a11y/base", // currently errors out on form labels
  ],
  plugins: [
    'vue'
  ],
  // check if imports actually resolve
  settings: {
    'import/resolver': {
      // matches aliases from build/rollup-plugins.js
      alias: {
        map: [
          ['srcdir', resolve('src')],
          ['cssdir', resolve('src/css')],
          ['assetsdir', resolve('src/assets')],
          ['componentsdir', resolve('src/components')],
          ['compositionsdir', resolve('src/compositions')],
          ['mixinsdir', resolve('src/mixins')],
        ],
        extensions: ['.vue', '.json', '.js']
      },
    },
  },
  // add custom rules or overrides here
  rules: {
    // don't require .vue extension when importing
    'import/extensions': ['error', 'always', {
      js: 'never',
      vue: 'never',
      ts: 'never',
    }],
    // allow optionalDependencies
    'import/no-extraneous-dependencies': ['error', {
      'optionalDependencies': ['test/unit/index.js']
    }],
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'vue/require-default-prop': 0,
    'vue/attributes-order': 0,
    'vue/no-multiple-template-root': 0,
    'max-len': ['error', {
      'code': 100,
      'ignoreComments': true,
      'ignoreTrailingComments': true
    }],
    'vue/multiline-html-element-content-newline': 0
  }
}

// http://eslint.org/docs/user-guide/configuring
const path = require('path');

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  root: true,
  parser: 'vue-eslint-parser',
  parserOptions: {
    sourceType: 'module',
  },
  env: {
    browser: true,
  },
  extends: [
    'airbnb-base',
    'plugin:vue/recommended',
    // "plugin:vue-a11y/base", // currently errors out on form labels
  ],
  plugins: [
    'vue',
  ],
  // check if imports actually resolve
  settings: {
    'import/resolver': {
      // matches aliases from build/rollup-plugins.js
      alias: {
        map: [
          ['srcdir', resolve('src')],
          ['cssdir', resolve('src/css')],
          ['assetsdir', resolve('src/assets')],
          ['componentsdir', resolve('src/components')],
          ['compositionsdir', resolve('src/compositions')],
          ['mixinsdir', resolve('src/mixins')],
        ],
        extensions: ['.vue', '.json', '.js'],
      },
    },
  },
  // add custom rules or overrides here
  rules: {
    // require .vue extension when importing for vite
    'import/extensions': ['error', 'always', {
      js: 'never',
      vue: 'always',
      ts: 'never',
    }],
    // allow optionalDependencies
    'import/no-extraneous-dependencies': ['error', {
      optionalDependencies: ['test/unit/index.js'],
    }],
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'vue/require-default-prop': 0,
    'vue/attributes-order': 0,
    'vue/no-multiple-template-root': 0,
    'max-len': ['error', {
      code: 100,
      ignoreComments: true,
      ignoreTrailingComments: true,
    }],
    'vue/multiline-html-element-content-newline': 0,
  }
}

add vue eslint parser, correct lint errors in config