import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginPrettier from 'eslint-plugin-prettier';

/** @type {import('eslint').Linter.Config[]} */
export default [
    { files: ['**/*.{js,mjs,cjs,ts}'] },
    pluginJs.configs.recommended,
    ...tseslint.configs.recommended,
    {
        languageOptions: {
            globals: {
                ...globals.browser,
                ...globals.node,
                ...globals.es2016,
                wx: true,
                App: true,
                Page: true,
                getCurrentPages: true,
                getApp: true,
                Component: true,
                requirePlugin: true,
                requireMiniProgram: true,
            },
        },
        rules: {
            // code: 200,
            semi: 'error',
            'prefer-const': 'error',
            '@typescript-eslint/no-require-imports': 'off',
            '@typescript-eslint/no-explicit-any': 'warn',
        },
        plugins: { pluginPrettier },
    },
];
