这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: eslint-config-turbo module export #10105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged

fix: eslint-config-turbo module export #10105

merged 1 commit into from
Mar 5, 2025

Conversation

anthonyshew
Copy link
Contributor

@anthonyshew anthonyshew commented Mar 5, 2025

Description

In #9976, I erroneously turned the named export from packages/eslint-config-turbo/index.js into a default export in packages/eslint-config-turbo/index.ts. Users reported the breakage for ESLint v8 projects here.

This PR fixes by turning it back into a named export.

Testing Instructions

I've hand-tested the fixed export path with the following steps:

  1. npx create-turbo@latest -e https://github.com/vercel/turborepo/tree/39f94e9af2e51504fa268c92011a96fa04f14190/examples/basic - This is far back enough in history that the example is using ESLint v8.
  2. turbo run build --filter=packages/eslint-config-turbo on this branch
  3. pnpm pack --pack-destination=your-favorite-destination
  4. In the example, change the dependency in packages/eslint-config-package.json to the tarball.
  git diff packages/eslint-config/package.json
diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json
index 821a738..3fbb7be 100644
--- a/packages/eslint-config/package.json
+++ b/packages/eslint-config/package.json
@@ -9,7 +9,7 @@
   ],
   "devDependencies": {
     "@vercel/style-guide": "^5.2.0",
-    "eslint-config-turbo": "^2.0.0",
+    "eslint-config-turbo": "file:your-favorite-destination-again",
     "eslint-config-prettier": "^9.1.0",
     "eslint-plugin-only-warn": "^1.1.0",
     "@typescript-eslint/parser": "^7.1.0",
  1. Run pnpm install in the example.
  2. Run turbo run lint

That task should pass.

I started feeling pathological about making sure I didn't break it again, so I've also followed the same process for npx create-turbo@latest for ensuring eslint-config-turbo is working as expected with ESLint v9 Flat Configuration. The diff I used to confirm is (again, make sure to update the dependency path in package.json):

diff --git a/packages/eslint-config/base.js b/packages/eslint-config/base.js
index 09d316e..d617da0 100644
--- a/packages/eslint-config/base.js
+++ b/packages/eslint-config/base.js
@@ -1,6 +1,6 @@
 import js from "@eslint/js";
 import eslintConfigPrettier from "eslint-config-prettier";
-import turboPlugin from "eslint-plugin-turbo";
+import turboConfig from "eslint-config-turbo/flat";
 import tseslint from "typescript-eslint";
 import onlyWarn from "eslint-plugin-only-warn";
 
@@ -12,15 +12,8 @@ import onlyWarn from "eslint-plugin-only-warn";
 export const config = [
   js.configs.recommended,
   eslintConfigPrettier,
+  ...turboConfig,
   ...tseslint.configs.recommended,
-  {
-    plugins: {
-      turbo: turboPlugin,
-    },
-    rules: {
-      "turbo/no-undeclared-env-vars": "warn",
-    },
-  },
   {
     plugins: {
       onlyWarn,
diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json
index cfd4294..864ffe4 100644
--- a/packages/eslint-config/package.json
+++ b/packages/eslint-config/package.json
@@ -16,7 +16,7 @@
     "eslint-plugin-only-warn": "^1.1.0",
     "eslint-plugin-react": "^7.37.4",
     "eslint-plugin-react-hooks": "^5.2.0",
-    "eslint-plugin-turbo": "^2.4.4",
+    "eslint-config-turbo": "file:../../your-favorite-destination",
     "globals": "^16.0.0",
     "typescript": "^5.8.2",
     "typescript-eslint": "^8.26.0"

@anthonyshew anthonyshew requested a review from a team as a code owner March 5, 2025 21:58
Copy link

vercel bot commented Mar 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 9:59pm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file wasn't being used. It looks like it got left in on accident.

@anthonyshew anthonyshew changed the title fix: eslint-config-turbo module export fix: eslint-config-turbo module export Mar 5, 2025
@anthonyshew anthonyshew merged commit 4f32563 into main Mar 5, 2025
51 checks passed
@anthonyshew anthonyshew deleted the shew/3467b branch March 5, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants