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

fix: create types for ESLint config/plugin #9976

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 5 commits into from
Feb 14, 2025
Merged

fix: create types for ESLint config/plugin #9976

merged 5 commits into from
Feb 14, 2025

Conversation

anthonyshew
Copy link
Contributor

@anthonyshew anthonyshew commented Feb 14, 2025

Description

Creates types for eslint-config-turbo.

Addresses #9919

@anthonyshew anthonyshew requested a review from a team as a code owner February 14, 2025 19:19
Copy link

vercel bot commented Feb 14, 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 Feb 14, 2025 8:00pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 8:00pm

@@ -24,7 +24,6 @@
"dist/**"
],
"scripts": {
"release": "pnpm build && pnpm publish",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing vestigial from prior iterations of our publishing flows. This isn't being used anymore.

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

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

LGTM

@anthonyshew
Copy link
Contributor Author

Tried it out manually. Looks good!

@anthonyshew anthonyshew linked an issue Feb 14, 2025 that may be closed by this pull request
1 task
@anthonyshew anthonyshew enabled auto-merge (squash) February 14, 2025 20:08
@anthonyshew anthonyshew disabled auto-merge February 14, 2025 20:08
@anthonyshew anthonyshew merged commit 433128b into main Feb 14, 2025
44 checks passed
@anthonyshew anthonyshew deleted the shew/c2092 branch February 14, 2025 20:14
joshnuss pushed a commit to joshnuss/turborepo that referenced this pull request Feb 15, 2025
### Description

Creates types for `eslint-config-turbo`.

Addresses vercel#9919
anthonyshew added a commit that referenced this pull request 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](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"

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

eslint-config-turbo/flat - missing TypeScript definitions
3 participants