module.exports = {
  parser: '@typescript-eslint/parser',
  plugins: [
    '@typescript-eslint',
  ],
  extends: [
    'airbnb-base',
    'plugin:@typescript-eslint/eslint-recommended',
    'plugin:@typescript-eslint/recommended',
  ],
  env: {
    browser: true,
    commonjs: true,
    jasmine: true,
    jest: true,
    es6: true,
  },
  rules: {
    'arrow-parens': [
      'error',
      'as-needed',
      { requireForBlockBody: true }
    ],
    'class-methods-use-this': 'off',
    'comma-dangle': 'off',
    'consistent-return': 'off',
    'func-names': 'off',
    'import/no-extraneous-dependencies': 'off',
    'no-use-before-define': 'off',
    indent: [
      'error',
      2,
      {
        SwitchCase: 1,
        FunctionDeclaration: { parameters: 'first' },
        FunctionExpression: { parameters: 'first' }
      }
    ],
    'newline-per-chained-call': 'off',
    'no-constant-condition': [
      'error',
      { checkLoops: false }
    ],
    'no-eq-null': 'error',
    'no-mixed-operators': [
      'error',
      { groups: [['+', '-', '*', '/', '%', '**']] }
    ],
    'no-multiple-empty-lines': [
      'error',
      { max: 1 }
    ],
    'no-param-reassign': 'off',
    'no-shadow': 'off',
    '@typescript-eslint/no-empty-interface': 'off',
    '@typescript-eslint/no-var-requires': 'off',
    'import/no-named-as-default': 'off',
    'import/no-named-as-default-member': 'off',
    '@typescript-eslint/no-this-alias': 'off',
    '@typescript-eslint/no-empty-function': 'off',
    'no-plusplus': [
      'error',
      { allowForLoopAfterthoughts: true }
    ],
    'no-restricted-globals': [
      'error',
      'Handsontable',
      {
        name: 'console',
        message: 'Using the `console` object is not allowed within Handsontable. Please use one of the helpers from the `console.js` file instead.'
      }
    ],
    'no-underscore-dangle': 'off',
    '@typescript-eslint/ban-types': 'off',
    'max-len': 'off',
    'no-void': 'off',
    'padded-blocks': 'off',
    quotes: ['error', 'single'],
    'space-before-function-paren': ['error', 'never'],
    'linebreak-style': 'off'
  },
  overrides: [
    {
      files: ['test/**', 'src/3rdparty/walkontable/test/**', '*.unit.js', '*.e2e.js'],
      rules: {
        'import/extensions': 'off',
        'import/no-unresolved': [
          'error',
          { ignore: ['handsontable', 'walkontable'] }
        ],
        'no-restricted-globals': 'off',
        'no-undef': 'off',
      }
    }
  ],
};
