module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 2019,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
    },
  },
  settings: {
    react: {
      version: 'detect',
    },
    'import/resolver': {
      // resolves aliases from .babelrc automatically
      'babel-module': {},
    },
  },
  env: {
    es6: true,
    browser: true,
    node: true,
  },
  plugins: [
    'react',
    'jsx-a11y',
  ],
  extends: [
    'airbnb',
    'airbnb/hooks',
    'plugin:react/recommended',
  ],
  globals: {
    React: true,
    document: true,
    window: true,
    localStorage: true,
    fetch: true,
  },
  rules: {
    'babel/object-curly-spacing': 0,
    'class-methods-use-this': 0,
    indent: [
      'error',
      2,
    ],
    'jsx-a11y/anchor-is-valid': [
      'warn',
      {
        aspects: [
          'invalidHref',
        ],
      },
    ],
    'jsx-a11y/href-no-hash': 'off',
    'no-trailing-spaces': [
      2,
      {
        skipBlankLines: true,
      },
    ],
    'prefer-template': 0,
    'react/jsx-boolean-value': [
      'warn',
      'never',
    ],
    'react/jsx-closing-bracket-location': [
      'warn',
      'after-props',
    ],
    'react/jsx-curly-spacing': [
      'warn',
      'never',
    ],
    'react/jsx-filename-extension': [
      'warn',
      {
        extensions: [
          '.jsx',
        ],
      },
    ],
    'react/jsx-first-prop-new-line': [
      'warn',
      'multiline',
    ],
    'react/jsx-handler-names': [
      'warn',
      {
        eventHandlerPrefix: 'handle',
        eventHandlerPropPrefix: 'on',
      },
    ],
    'react/jsx-indent': [
      2,
      2,
    ],
    'react/jsx-key': 'error',
    'react/jsx-wrap-multilines': [
      'warn',
    ],
    'react/prop-types': 0,
    'react/self-closing-comp': [
      'warn',
      {
        component: true,
        html: false,
      },
    ],
    'react/sort-comp': [
      1,
      {
        groups: {
          rendering: [
            '/^render.+$/',
            'render',
          ],
        },
        order: [
          'everything-else',
          'lifecycle',
          'rendering',
          'static-methods',
        ],
      },
    ],
    'no-console': 0,
  },
};
