/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
  },
  extends: [
    'eslint:recommended',
    'plugin:vue/vue3-essential',
    '@vue/eslint-config-typescript/recommended',
    '@vue/eslint-config-prettier',
  ],
  overrides: [
    {
      files: ['cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}'],
      extends: ['plugin:cypress/recommended'],
    },
    {
      // https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
      files: ['*.vue'],
      rules: {
        'no-undef': 'off',
      },
    },
    {
      files: ['*.story.vue', '*.story.controls.vue'],
      rules: {
        '@typescript-eslint/no-empty-function': 'off',
        '@typescript-eslint/no-unused-vars': 'off',
        'vue/require-v-for-key': 'off',
        'vue/no-mutating-props': 'off',
      },
    },
  ],
  rules: {
    // see https://vuejs.org/guide/extras/reactivity-transform.html
    'vue/no-setup-props-destructure': 'off',
    // TODO: discuss if we want to force this
    'vue/multi-word-component-names': 'off',
    // see https://eslint.org/docs/latest/rules/no-prototype-builtins#when-not-to-use-it
    'no-prototype-builtins': 'off',
    // as long as it is explicit, it is fine to use any
    '@typescript-eslint/no-explicit-any': 'off',
  },
}