import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import prettier from 'eslint-config-prettier'
import importQuotes from 'eslint-plugin-import-quotes'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

const compat = new FlatCompat({
  baseDirectory: __dirname,
})

const eslintConfig = [
  ...compat.extends('next/core-web-vitals', 'next/typescript'),
  prettier,
  {
    plugins: { 'import-quotes': importQuotes },
    rules: {
      // 👇 import 使用双引号
      'import-quotes/import-quotes': ['error', 'double'],
    },
  },
]

export default eslintConfig
