// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

module.exports = {
    env: {
      browser: true,
      node: true,
      es6: true
    },
    extends: [
      'eslint:recommended',
      'plugin:@typescript-eslint/recommended',
      'plugin:prettier/recommended',
      'plugin:react/recommended',
      'plugin:react-hooks/recommended'
    ],
    parser: '@typescript-eslint/parser',
    plugins: ['@typescript-eslint', 'header'],
    parserOptions: {
      ecmaFeatures: {
        jsx: true
      },
      ecmaVersion: 2020,
      sourceType: 'module'
    },
    rules: {
        "react/react-in-jsx-scope": "off",
        "react/jsx-uses-react": "off",
      '@typescript-eslint/explicit-function-return-type': [
        'warn',
        {
          allowExpressions: true,
          allowTypedFunctionExpressions: true
        }
      ],
      eqeqeq: 'warn',
      'header/header': ['error', 'line', ' Copyright (c) Microsoft Corporation.\n Licensed under the MIT License.'],
      'react/display-name': 'off',
      '@typescript-eslint/no-explicit-any': 'error',
      '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
      curly: 'error',
      'no-restricted-imports': [
        'error',
        {
          patterns: [
            {
              group: ['@internal/*'],
              message: 'Use @azure/communication-react instead.'
            }
          ]
        }
      ]
    },
    settings: {
      react: {
        version: 'detect'
      }
    },
    overrides: [
      {
        files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx', '**/mocks/*'],
        env: {
          jest: true
        }
      }
    ]
  };
