import globals from 'globals';

import pluginJs from '@eslint/js';

import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';

import { fixupConfigRules } from '@eslint/compat';

import jsdoc from 'eslint-plugin-jsdoc';

import unicorn from 'eslint-plugin-unicorn';

export default [
  { files: ['core/**/*.{js,jsx,ts,tsx}'] },
  { languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...fixupConfigRules(pluginReactConfig),
  {
    plugins: {
      jsdoc,
      unicorn
    },
    rules: {
      'no-unused-vars': 'error',
      'no-console': 'warn',
      'no-cond-assign': 'error',
      'no-const-assign': 'error',
      'no-duplicate-imports': 'error',
      'func-names': 'off',
      'no-process-exit': 'off',
      'object-shorthand': 'off',
      'react/react-in-jsx-scope': 'off',
      'class-methods-use-this': 'off',
      'padding-line-between-statements': [
        'error',
        { blankLine: 'always', prev: '*', next: '*' }, // Require an empty line between any two statements
      ],
      'camelcase':['error',{
        properties: 'always',
      }],
      'unicorn/filename-case': ['error', {
        cases: {
          pascalCase: true,
        },
      }],
      // JSDoc rules
      'jsdoc/require-jsdoc': [
        'error',
        {
          require: {
            FunctionDeclaration: true,
            MethodDefinition: true,
            ClassDeclaration: true,
            ArrowFunctionExpression: true,
            FunctionExpression: true,
          },
        },
      ],
      'jsdoc/check-param-names': 'error', // Ensure parameter names are consistent
      'jsdoc/require-param': 'error', // Require @param for each parameter
      'jsdoc/require-returns': 'error', // Require @returns if the function returns a value
    },
    settings: {
    react: {
      version: 'detect',
    },
  },
  },
];
