import globals from 'globals'
import pluginVue from 'eslint-plugin-vue'

import path from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import pluginJs from '@eslint/js'

import autoImport from './.eslintrc-auto-import.json' assert {type: 'json'}

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended })

export default [
  {
    languageOptions: {
      globals: {
        ...globals.browser,
        ...globals.node,
        ...autoImport.globals
      }
    }
  },
  ...compat.extends('standard'),
  ...pluginVue.configs['flat/recommended'],
  {
    rules: {
      'import/export': 0,
      'no-unused-vars': 0,
      'vue/multi-word-component-names': 0
    }
  }
]
