module.exports = {
  extends: 'airbnb',
  plugins: ['react', 'jsx-a11y', 'import', '@typescript-eslint'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: 'module',
    ecmaFeatures: { jsx: true },
  },
  settings: {
    'import/resolver': {
      node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
    },
  },
  rules: {
    // Handled by the compiler
    'no-undef': 0,
    // Base rules replaced by their TypeScript-aware versions
    'no-unused-vars': 0,
    '@typescript-eslint/no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
    'no-use-before-define': 0,
    '@typescript-eslint/no-use-before-define': 'error',
    // The base rules count overload signatures as redeclarations
    'no-redeclare': 0,
    '@typescript-eslint/no-redeclare': 'error',
    'no-dupe-class-members': 0,
    '@typescript-eslint/no-dupe-class-members': 'error',
    'no-shadow': 0,
    '@typescript-eslint/no-shadow': 'error',
    'object-curly-newline': 0,
    'react/jsx-no-bind': 0,
    'react/jsx-first-prop-new-line': 0,
    'react/jsx-indent-props': 0,
    'react/jsx-filename-extension': 0,
    'react/react-in-jsx-scope': 0, // remove when import React is ready
    'import/no-unresolved': 0,
    'react/jsx-props-no-spreading': 0,
    'comma-dangle': 0,
    'no-console': 0,
    'no-plusplus': 0,
    'import/prefer-default-export': 0,
    'import/no-named-as-default': 0,
    'import/no-named-as-default-member': 0,
    'arrow-parens': 0,
    'react/jsx-no-undef': 0,
    'react/jsx-tag-spacing': 0,
    'react/prefer-stateless-function': 0,
    'react/forbid-prop-types': 0,
    'react/prop-types': 0,
    'import/extensions': 0,
    quotes: ['warn', 'single'],
    'no-prototype-builtins': 0,
    'class-methods-use-this': 0,
    'no-param-reassign': 0,
    'no-mixed-operators': 0,
    'no-else-return': 0,
    'react/static-property-placement': 0,
    'react/destructuring-assignment': 0,
    'max-len': [
      'error',
      120,
      2,
      {
        ignoreUrls: true,
        // The published JSDoc is prose copied into the declarations
        ignoreComments: true,
        ignoreRegExpLiterals: true,
        ignoreStrings: true,
        ignoreTemplateLiterals: true,
      },
    ],
    'no-trailing-spaces': ['error', { skipBlankLines: true }],
    'react/sort-comp': [
      1,
      {
        order: ['static-variables', 'static-methods', 'lifecycle', 'everything-else', 'render'],
      },
    ],
  },
};
