Skip to content
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

feat: add eslint peer dependency #106

Merged
merged 5 commits into from
Sep 27, 2024
Merged

Conversation

danielrentz
Copy link
Contributor

@danielrentz danielrentz commented Aug 13, 2024

Prerequisites checklist

What is the purpose of this pull request?

This package exports TS type definitions referring to eslint types, thus it should publicly include the @types/eslint package.

What changes did you make? (Give an overview)

In packages/compat/package.json, move "@types/eslint" to "dependencies".

Related Issues

fixes #104
fixes #105

Is there anything you'd like reviewers to focus on?

Copy link

linux-foundation-easycla bot commented Aug 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@nzakas nzakas marked this pull request as draft August 13, 2024 15:22
@nzakas
Copy link
Member

nzakas commented Aug 13, 2024

Switching to draft until we resolve #104

@danielrentz danielrentz marked this pull request as ready for review September 17, 2024 04:26
nzakas
nzakas previously approved these changes Sep 17, 2024
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Would like another review before merging.

@nzakas
Copy link
Member

nzakas commented Sep 17, 2024

@danielrentz can you please sign the CLA?

@danielrentz
Copy link
Contributor Author

done

@danielrentz danielrentz changed the title feat: make @types/eslint dependency public feat: add @types/eslint dependency Sep 18, 2024
@danielrentz danielrentz changed the title feat: add @types/eslint dependency feat: add @types/eslint peer dependency Sep 18, 2024
@@ -55,6 +55,14 @@
"rollup": "^4.16.2",
"typescript": "^5.4.5"
},
"peerDependencies": {
"@types/eslint": "^9.6.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that the eslint package itself publishes its own types (eslint/eslint#18854), @types/eslint is no longer necessary in general. I'd assumed the plan was to turn it into a stub type definition per normal DefinitelyTyped practices. Should this be switched to "eslint", along with the meta lower on?

Copy link
Member

Choose a reason for hiding this comment

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

I'd assumed the plan was to turn it into a stub type definition per normal DefinitelyTyped practices.

We don't know normal DefiniteTyped practices. 😄 Can you open an issue somewhere for this task explaining what it is?

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg Sep 20, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, per eslint/eslint#18928 (comment) I'll mark this as needing to switch from @types/eslint to eslint. Thanks @snitin315!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switched to eslint ^9.10.0 (first version with bundled typings)
@nzakas @JoshuaKGoldberg Question: Should the "optional" be removed? (Can this package be used without eslint?)

Copy link
Member

Choose a reason for hiding this comment

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

I think optional can stay. This package doesn't use eslint at runtime, only at dev time to validate types. @JoshuaKGoldberg?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Correct place to change, but a different place in code now I believe. Thanks!

@nzakas
Copy link
Member

nzakas commented Sep 25, 2024

We should update eslint to the latest version. I believe that will fix the CI error.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Would like @JoshuaKGoldberg to verify before merging.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

🚀

@danielrentz danielrentz changed the title feat: add @types/eslint peer dependency feat: add eslint peer dependency Sep 27, 2024
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@silverwind
Copy link

Is there a reason why this peer dependency does not include eslint@8?

@fasttime
Copy link
Member

fasttime commented Dec 8, 2024

@silverwind ESLint v8 has reached end-of-life. See https://eslint.org/version-support/.

@silverwind
Copy link

silverwind commented Dec 8, 2024

@silverwind ESLint v8 has reached end-of-life. See https://eslint.org/version-support/.

I know, but @eslint/compat is in active use with eslint@8 like for example in this plugin, and this change is introducing a eslint@9 peerDependency, so the major version should have been bumped.

@silverwind
Copy link

silverwind commented Dec 8, 2024

Upon further inspection, that plugin uses @eslint/compat to convert v8 rules to v9, and the module is only imported for the v9 config, so the peerDependency warning is essentially a non-issue, and I recommend this module to specify ^8 | ^9 for its peerDependencies so that plugins that support both v8 and v9 can work.

@fasttime
Copy link
Member

fasttime commented Dec 8, 2024

I know, but @eslint/compat is in active use with eslint@8 like for example in this plugin, and this change is introducing a eslint@9 peerDependency, so the major version should have been bumped.

Technically yes, this should have been a breaking change. But @eslint/compat was never intended to work with ESLint v8.

@silverwind
Copy link

Technically yes, this should have been a breaking change. But @eslint/compat was never intended to work with ESLint v8.

Yeah, it's not supposed to and it's not actually loaded with eslintrc configs because those configs do not usually import js modules. Problem is that any plugin or config which dual-publishes v8 and v9 and which has the @eslint/compat dependency will result in the peerDependency warning when installed.

I think it's better to just unrestrict the peer dependency to allow such dual publishes because people are still not fully migrated to v9 or flat config (I'm waiting on eslint-plugin-react-hooks, for example).

@fasttime
Copy link
Member

fasttime commented Dec 9, 2024

I think it's better to just unrestrict the peer dependency to allow such dual publishes because people are still not fully migrated to v9 or flat config (I'm waiting on eslint-plugin-react-hooks, for example).

@silverwind If you would like to suggest a change it's better to open a new issue because closed issues are not actively triaged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Change Request: Add @types/eslint dependency Bug: TypeScript type error in generated dts files
5 participants