Skip to content

Commit 4f32563

Browse files
authored
fix: eslint-config-turbo module export (#10105)
### 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](https://github.com/vercel/turborepo/pull/9978/files#r1974406494). 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", ``` 5. Run `pnpm install` in the example. 6. 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" ```
1 parent 58f3316 commit 4f32563

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

packages/eslint-config-turbo/index.ts

-4
This file was deleted.

packages/eslint-config-turbo/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"@turbo/eslint-config": "workspace:*",
5959
"@turbo/tsconfig": "workspace:*",
6060
"@types/eslint": "^8.56.10",
61+
"@types/node": "^20",
6162
"bunchee": "^6.3.4"
6263
},
6364
"files": [
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// eslint-disable-next-line import/no-default-export -- Matching old module.exports
2-
export default {
1+
const config = {
32
extends: ["plugin:turbo/recommended"],
43
};
4+
5+
module.exports = config;

pnpm-lock.yaml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)