import globals from 'globals';
import pluginJs from '@eslint/js';
import pluginPrettier from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
    {
        files: ['**/*.js'],
        languageOptions: { sourceType: 'commonjs', globals: globals.node },
    },
    pluginJs.configs.recommended,
    {
        rules: {
            'prettier/prettier': ['error', { endOfLine: 'auto' }], // Treat Prettier issues as ESLint errors
            'no-console': 'warn', // Warn on console.log
            eqeqeq: 'warn', // Require === instead of ==
            'no-unused-vars': 'warn',
        },
        plugins: { prettier: pluginPrettier },
    },
    prettierConfig, // Disables ESLint rules that conflict with Prettier
];
