const [off, , error] = ['off', 'warn', 'error'];

module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  extends: [
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'airbnb',
    'prettier',
  ],
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 12,
    sourceType: 'module',
  },
  plugins: [
    'react',
    'css-modules',
    '@zohodesk/zsecurity',
    '@zohodesk/react-performance',
  ],
  rules: {
    // Internal Rules
    '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
    '@zohodesk/zsecurity/no-unsecure-html': error,
    '@zohodesk/zsecurity/no-protocol-check': error,

    // CSS Module Rules
    'css-modules/no-unused-class': [error, { camelCase: true }],
    'css-modules/no-undef-class': [error, { camelCase: 'only' }],

    'import/no-unresolved': off,
    'import/no-extraneous-dependencies': off,

    // As redux used
    'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
    'react/jsx-filename-extension': off,

    // As we don't follow
    'react/require-default-props': off,
    'react/jsx-props-no-spreading': off,

    // As we didn't update
    'react/jsx-fragments': off,

    // Not needed
    'no-plusplus': off,
    'no-unused-expressions': [
      error,
      {
        allowShortCircuit: true,
        allowTernary: true,
      },
    ],
    'react/jsx-no-target-blank': error,
  },
};
