const prettierConfig = require('./prettier.config');

module.exports = {
  extends: [
    'react-app',
    'airbnb-typescript',
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'prettier',
  ],
  plugins: ['prettier'],
  parserOptions: {
    project: './tsconfig.json',
  },
  rules: {
    'no-debugger': 'off',
    'prefer-arrow-callback': 'off',
    'arrow-body-style': 'off',
    'import/prefer-default-export': 'off',
    'import/no-anonymous-default-export': [
      'error',
      {
        allowArray: true,
        allowArrowFunction: false,
        allowAnonymousClass: false,
        allowAnonymousFunction: false,
        allowCallExpression: true,
        allowLiteral: false,
        allowObject: true,
      },
    ],
    'react/destructuring-assignment': 'off',
    'react/jsx-filename-extension': 'off',
    'react/prop-types': 'off',
    'react/require-default-props': 'off',
    'react/default-props-match-prop-types': 'off',
    'react/no-unused-prop-types': 'off',
    'react/jsx-uses-react': 'off',
    'react/react-in-jsx-scope': 'off',
    'jsx-a11y/label-has-associated-control': 'off',
    'prettier/prettier': ['error', prettierConfig],
    'dot-notation': 'off',
    '@typescript-eslint/dot-notation': [
      'error',
      {
        allowIndexSignaturePropertyAccess: true,
      },
    ],
    '@typescript-eslint/explicit-function-return-type': [
      'error',
      {
        allowExpressions: true,
        allowTypedFunctionExpressions: true,
      },
    ],
    // 'sort-imports': [
    //   'error',
    //   {
    //     "ignoreCase": true,
    //     "ignoreDeclarationSort": true
    //   },
    // ],
    // 'import/order': [
    //   1,
    //   {
    //     groups: [
    //       'external',
    //       'builtin',
    //       'internal',
    //       'sibling',
    //       'parent',
    //       'index',
    //     ],
    //     pathGroups: [
    //       {
    //         pattern: 'components',
    //         group: 'internal',
    //       },
    //       {
    //         pattern: 'common',
    //         group: 'internal',
    //       },
    //       {
    //         pattern: 'routes/ **',
    //         group: 'internal',
    //       },
    //       {
    //         pattern: 'assets/**',
    //         group: 'internal',
    //         position: 'after',
    //       },
    //     ],
    //     pathGroupsExcludedImportTypes: ['internal'],
    //     alphabetize: {
    //       order: 'asc',
    //       caseInsensitive: true,
    //     },
    //   },
    // ],
    'sort-keys': 'off',
    'no-console': ['warn', { allow: ['warn', 'error'] }],
    'no-use-before-define': 'off',
    '@typescript-eslint/no-use-before-define': [
      'error',
      {
        functions: false,
      },
    ],
    'no-redeclare': 'off',
    '@typescript-eslint/no-redeclare': ['error'],
  },
};
