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"
```