Turborepo Eslint 配置不适用

Flo*_*y99 8 javascript eslint monorepo vercel turborepo

我创建了一个 Turborepo 测试项目,我想尝试在 Turborepo 根目录中设置的 ESlint 配置是否适用于我的 /apps 文件夹中的所有项目,结果发现它对我不起作用......我在哪里搞砸了向上 ?我正在关注这篇文章

/packages/esling-config-custom/index.js

module.exports = {
  extends: ["next", "turbo", "prettier"],
  rules: {
    "no-console": 2,
    "@next/next/no-html-link-for-pages": "off",
  },
};
Run Code Online (Sandbox Code Playgroud)

.eslintrc.js(Turborepo 的根目录)

module.exports = {
  root: true,
  // This tells ESLint to load the config from the package `eslint-config-custom`
  extends: ["custom"],
  settings: {
    next: {
      rootDir: ["apps/*/"],
    },
  },
};
Run Code Online (Sandbox Code Playgroud)

/apps/testing-app/.eslintrc.js

module.exports = {
  ...require("eslint-config-custom/index"),
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: "./tsconfig.json",
  },
};
Run Code Online (Sandbox Code Playgroud)

/apps/testing-app/package.json

{
  "name": "testing-app",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@headlessui/react": "^1.7.2",
    "@heroicons/react": "^2.0.10",
    "@stripe/react-stripe-js": "^1.13.0",
    "@stripe/stripe-js": "^1.41.0",
    "@supabase/supabase-js": "^2.0.0-rc.10",
    "@tailwindcss/line-clamp": "^0.4.2",
    "@tanstack/react-query": "^4.3.4",
    "axios": "^0.27.2",
    "daisyui": "^2.25.0",
    "framer-motion": "^7.3.2",
    "next": "12.2.5",
    "next-transpile-modules": "^10.0.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "stripe": "^10.14.0",
    "ui": "*"
  },
  "devDependencies": {
    "@types/node": "18.7.16",
    "@types/react": "18.0.18",
    "@types/react-dom": "18.0.6",
    "autoprefixer": "^10.4.8",
    "eslint": "8.23.0",
    "postcss": "^8.4.16",
    "prettier": "^2.7.1",
    "prettier-plugin-tailwindcss": "^0.1.13",
    "tailwindcss": "^3.1.8",
    "tsconfig": "*",
    "eslint-config-custom": "*",
    "typescript": "4.8.2"
  }
}
Run Code Online (Sandbox Code Playgroud)

/apps/testing-app/pages/index.tsx

 import type { NextPage } from "next";
    
    const Home: NextPage = () => {
      return (
        <h1 className="text-3xl font-bold underline">
          Hello world!<>{console.log("hey")}</> //I should get an error here which I don't...
        </h1>
      );
    };
    
    export default Home;
Run Code Online (Sandbox Code Playgroud)

sea*_*olf 0

root: true尝试在您的顶级文件中删除.eslintrc.js;对我来说,这打乱了 ESLint 关于每个应用程序的应用程序根目录的想法。