{"size": 5474, "ext": "js", "max_stars_repo_path": ".eslintrc.js", "max_stars_repo_name": "seek-oss/eslint-config-seek", "max_stars_repo_stars_event_min_datetime": "2018-04-24T06:36:06.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-16T15:40:43.000Z", "max_issues_repo_path": ".eslintrc.js", "max_issues_repo_name": "seek-oss/eslint-config-seek", "max_issues_repo_issues_event_min_datetime": "2018-01-10T03:25:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-23T03:37:24.000Z", "max_forks_repo_path": ".eslintrc.js", "max_forks_repo_name": "seek-oss/eslint-config-seek", "max_forks_repo_forks_event_min_datetime": "2018-03-22T08:31:45.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-27T06:11:38.000Z"}
{"max_stars_count": 3, "max_issues_count": 15, "max_forks_count": 5, "avg_line_length": 27.2338308458, "max_line_length": 124, "alphanum_fraction": 0.5769090245}
const path = require('path');
const root = require('find-root')(process.cwd());

const OFF = 0;
const ERROR = 2;

const baseRules = {
  // Possible Errors
  'no-console': ERROR,
  'no-unexpected-multiline': ERROR,
  'block-scoped-var': ERROR,
  curly: [ERROR, 'all'],
  'default-case': ERROR,
  'dot-notation': ERROR,
  eqeqeq: [ERROR, 'always', { null: 'ignore' }],
  'guard-for-in': ERROR,
  'no-alert': ERROR,
  'no-caller': ERROR,
  'no-div-regex': ERROR,
  'no-else-return': ERROR,
  'no-eval': ERROR,
  'no-extend-native': ERROR,
  'no-extra-bind': ERROR,
  'no-floating-decimal': ERROR,
  'no-implicit-coercion': ERROR,
  'no-implied-eval': ERROR,
  'no-iterator': ERROR,
  'no-labels': ERROR,
  'no-lone-blocks': ERROR,
  'no-loop-func': ERROR,
  'no-multi-str': ERROR,
  'no-new-func': ERROR,
  'no-new-wrappers': ERROR,
  'no-new': ERROR,
  'no-octal-escape': ERROR,
  'no-param-reassign': ERROR,
  'no-proto': ERROR,
  'no-return-assign': ERROR,
  'no-script-url': ERROR,
  'no-self-compare': ERROR,
  'no-sequences': ERROR,
  'no-throw-literal': ERROR,
  'no-useless-call': ERROR,
  'no-void': ERROR,
  radix: ERROR,
  'vars-on-top': ERROR,
  yoda: ERROR,
  strict: [ERROR, 'never'],
  'no-label-var': ERROR,
  'no-shadow': ERROR,
  'no-undef-init': ERROR,
  'no-unused-vars': [
    ERROR,
    { argsIgnorePattern: '^_', ignoreRestSiblings: true },
  ],
  'handle-callback-err': ERROR,
  'no-new-require': ERROR,
  'no-path-concat': ERROR,
  'no-process-exit': ERROR,
  'no-restricted-modules': ERROR,
  'no-sync': ERROR,
  'linebreak-style': [ERROR, 'unix'],
  'new-cap': ERROR,
  'no-lonely-if': ERROR,
  'no-nested-ternary': ERROR,
  'no-unneeded-ternary': ERROR,
  'spaced-comment': [ERROR, 'always'],
  'no-var': ERROR,
  'object-shorthand': ERROR,
  'prefer-const': ERROR,
  'prefer-spread': ERROR,
  'prefer-template': ERROR,
  'no-return-await': ERROR,
};

const reactRules = {
  'react/prefer-es6-class': [ERROR, 'always'],
  'react/self-closing-comp': ERROR,
  'react/jsx-pascal-case': ERROR,
  'react-hooks/rules-of-hooks': ERROR,
  'react-hooks/exhaustive-deps': ERROR,
  'react/no-children-prop': ERROR,
  'react/display-name': OFF,
  'react/prop-types': OFF,
};

const baseConfig = {
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module',
    ecmaFeatures: { jsx: true },
  },
  root: true,
  env: {
    browser: true,
    node: true,
  },
  settings: {
    react: {
      version: '>16',
    },
  },
  plugins: ['react', 'react-hooks'],
  extends: ['plugin:react/recommended', 'prettier'],
  rules: {
    ...baseRules,
    ...reactRules,
  },
  overrides: [
    {
      // TypeScript config
      files: ['**/*.ts', '**/*.tsx'],
      parser: '@typescript-eslint/parser',
      parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module',
      },
      extends: [
        'plugin:@typescript-eslint/eslint-recommended',
        'plugin:@typescript-eslint/recommended',
        'prettier/@typescript-eslint',
      ],
      rules: {
        '@typescript-eslint/no-unused-expressions': ERROR,
        '@typescript-eslint/no-unused-vars': [
          ERROR,
          { argsIgnorePattern: '^_', ignoreRestSiblings: true },
        ],
        '@typescript-eslint/no-use-before-define': OFF,
        '@typescript-eslint/no-non-null-assertion': OFF,
        '@typescript-eslint/ban-ts-comment': OFF,
        '@typescript-eslint/no-explicit-any': OFF,
        '@typescript-eslint/explicit-function-return-type': OFF,
        '@typescript-eslint/no-empty-function': OFF,
        '@typescript-eslint/no-empty-interface': OFF,
        '@typescript-eslint/no-inferrable-types': [
          ERROR,
          { ignoreParameters: true },
        ],
        '@typescript-eslint/explicit-module-boundary-types': OFF,
        // prefer TypeScript exhaustiveness checking
        // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
        'default-case': OFF,
        'arrow-body-style': [ERROR, 'as-needed'],
        // Use `typescript-eslint`'s no-shadow to avoid false positives with enums
        // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
        'no-shadow': OFF,
        '@typescript-eslint/no-shadow': ERROR,
      },
    },
    {
      // JavaScript config
      files: ['**/*.js', '**/*.jsx'],
      env: {
        es6: true,
      },
      extends: [
        'plugin:import/errors',
        'plugin:import/warnings',
        'plugin:import/typescript',
      ],
      settings: {
        'import/resolver': {
          node: {
            moduleDirectory: [root, path.join(root, 'node_modules')],
          },
        },
      },
      rules: {
        'no-use-before-define': [ERROR, { functions: false }],
        'no-unused-expressions': ERROR,
        'import/no-unresolved': [
          ERROR,
          { commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
        ],
        'import/no-duplicates': ERROR,
      },
    },
    {
      // Jest config
      files: ['**/__tests__/**/*.{js,ts,tsx}', '**/*.@(spec|test).{js,ts,tsx}'],
      env: {
        jest: true,
      },
      extends: ['plugin:jest/recommended'],
      plugins: ['jest'],
    },
    {
      // Cypress config
      files: ['cypress/**/*.{js,ts,tsx}'],
      env: {
        'cypress/globals': true,
      },
      extends: ['plugin:cypress/recommended'],
      plugins: ['cypress'],
    },
  ],
};

module.exports = baseConfig;
