// 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'],
    parser: '@typescript-eslint/parser',
    plugins: ['@typescript-eslint', 'header'],
    parserOptions: {
      ecmaFeatures: {
        jsx: true
      },
      ecmaVersion: 2020,
      sourceType: 'module'
    },
    rules: {
      '@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.'],
      '@typescript-eslint/no-explicit-any': 'error',
      '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }],
      'no-restricted-imports': [
        'error',
        {
          patterns: [
            // Do not allow references that are outside the src folder. These will break the npm package created as no src dir exists in output dir.
            '**/../**/src/*',
            // Do not allow references to node_modules' /es/ folder. These will break jest tests and the npm package as those imports won't be transpiled.
            '**/dist/**/es/*',
            '**/lib/**/es/*'
          ]
        }
      ]
    },
    root: true,
    overrides: [
      {
        files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx', '**/mocks/*'],
        rules: {
          '@typescript-eslint/ban-ts-comment': 'off'
        },
        env: {
          jest: true
        }
      }
    ]
  };
  