{
  "extends": [
    "react-app",
    "prettier",
    "plugin:jsx-a11y/recommended",
    "./.eslintrc.core.js",
  ],
  "plugins": ["prettier", "react-hooks", "jsx-a11y"],
  "root": true,
  "env": {
    "es6": true,
    "browser": true,
    "node": true,
    "mocha": true,
    "jasmine": true,
  },
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "legacyDecorators": true,
    },
  },
  "rules": {
    "import/no-unresolved": 1,
    "import/named": "error",
    "react/jsx-key": [2, { "checkFragmentShorthand": true }],
    "no-alert": 1,
    "no-console": 1,
    "no-debugger": 1,
    "prettier/prettier": [
      "error",
      { "trailingComma": "all", "singleQuote": true },
    ],
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn",
    "react/react-in-jsx-scope": "off",
    "jsx-a11y/label-has-associated-control": "off",
  },
  "settings": {
    "import/resolver": {
      "alias": {
        "map": [
          ["@plone/volto", "./src"],
          ["@plone/volto-slate", "../volto-slate/src"],
          ["@plone/types", "../types"],
          ["@package", "./src"],
          ["@root", "./src"],
        ],
        "extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
      },
      "node": { "extensions": [".js", ".jsx", ".ts", ".tsx", ".json"] },
      "babel-plugin-root-import": {
        "rootPathSuffix": "src",
      },
    },
    "import/core-modules": ["load-volto-addons"],
    "react": {
      "version": "detect",
    },
  },
  "overrides": [
    {
      "files": ["**/*.ts", "**/*.tsx"],
      // "react-app" already loads plugin:@typescript-eslint/eslint-plugin
      // and it complains on having two different versions around.
      // Re-add it if at some point, we stop relying on it
      "extends": ["react-app", "prettier", "plugin:jsx-a11y/recommended"],
      "plugins": ["prettier", "react-hooks", "jsx-a11y"],
      "parser": "@typescript-eslint/parser",
    },
    {
      "files": [
        "**/*.test.js",
        "**/*.test.jsx",
        "**/*.test.ts",
        "**/*.test.tsx",
        "**/cypress/**/*.js",
        "**/cypress/**/*.ts",
      ],
      "plugins": ["no-only-tests"],
      "rules": {
        "no-only-tests/no-only-tests": "error",
      },
    },
    {
      "files": ["**/*.stories.js", "**/*.stories.jsx"],
      "rules": {
        "import/no-anonymous-default-export": "off",
      },
    },
    {
      "files": [
        "**/*.stories.js",
        "**/*.stories.jsx",
        "**/*.test.js",
        "**/*.test.jsx",
      ],
      "rules": {
        "no-restricted-syntax": "off",
      },
    },
  ],
  "globals": {
    "root": true,
    "__DEVELOPMENT__": true,
    "__CLIENT__": true,
    "__SERVER__": true,
    "__DISABLE_SSR__": true,
    "__DEVTOOLS__": true,
    "__DEBUG__": true,
    "__SSR__": true,
    "__SENTRY__": true,
    "cy": true,
    "Cypress": true,
    "jest": true,
    "socket": true,
    "webpackIsomorphicTools": true,
    "vitest": true,
    "vi": true,
  },
}
