eslintmonorepoturborepopnpm-workspace

ESlint packages not found in apps


I have a turborepo with a web app in the apps directory and an eslint-config-custom as a package.

eslint-config-custom has some dependencies on other eslint plugins. However, those are not found in the web app.

webapp package.json:

{
  "name": "web",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "lint:ts": "tsc --noEmit",
    "format": "prettier --write src",
    "scripts": "ts-node",
    "analyze": "ANALYZE=true npm run build"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.3.0",
    "@fortawesome/free-brands-svg-icons": "^6.3.0",
    "@fortawesome/free-regular-svg-icons": "^6.3.0",
    "@fortawesome/free-solid-svg-icons": "^6.3.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@hookform/resolvers": "^2.9.11",
    "@next-auth/prisma-adapter": "^1.0.5",
    "@next/font": "13.2.3",
    "@popperjs/core": "^2.11.6",
    "aes-js": "^3.1.2",
    "axios": "^1.3.2",
    "bootstrap": "^5.2.3",
    "csstype": "^3.1.1",
    "database": "workspace:*",
    "firebase": "^9.17.1",
    "mapbox-gl": "^2.12.0",
    "next": "13.2.3",
    "next-auth": "^4.20.1",
    "nprogress": "^0.2.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-gtm-module": "^2.0.11",
    "react-hook-form": "^7.43.5",
    "react-hot-toast": "^2.4.0",
    "react-map-gl": "^7.0.21",
    "react-switch": "^7.0.0",
    "sass": "^1.58.0",
    "zod": "^3.21.4"
  },
  "devDependencies": {
    "@next/bundle-analyzer": "^13.1.6",
    "@types/aes-js": "^3.1.1",
    "@types/mapbox-gl": "^2.7.10",
    "@types/node": "^18.14.6",
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@types/react-gtm-module": "^2.0.1",
    "autoprefixer": "^10.4.14",
    "eslint-config-custom": "workspace:*",
    "firebase-tools": "^11.24.0",
    "next-compose-plugins": "^2.2.1",
    "next-seo": "^5.15.0",
    "postcss": "^8.4.21",
    "prettier": "^2.8.4",
    "tailwind-config": "workspace:*",
    "tailwindcss": "^3.2.4",
    "ts-node": "^10.9.1",
    "tsconfig": "workspace:*",
    "tsconfig-paths": "^4.1.2",
    "typescript": "^4.9.5"
  }
}

eslint-config-custom package.json:

{
  "name": "eslint-config-custom",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "format": "prettier --write ./*.js"
  },
  "dependencies": {
    "@typescript-eslint/eslint-plugin": "^5.54.1",
    "@typescript-eslint/parser": "^5.54.1",
    "eslint": "^8.35.0",
    "eslint-config-prettier": "^8.7.0",
    "eslint-config-react-native": "^4.1.0",
    "eslint-config-turbo": "^0.0.9",
    "eslint-import-resolver-typescript": "^3.5.3",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0"
  },
  "devDependencies": {
    "typescript": "^4.9.5"
  },
  "publishConfig": {
    "access": "public"
  }
}

eslint-config-custom has multiple configurations, not just the index.js


Solution

  • I hade to add public-hoist-pattern[]=*eslint-plugin* to my .npmrc in order to get it working.