-
-
Notifications
You must be signed in to change notification settings - Fork 55
chore: adopt new deprecated: DeprecatedInfo
meta rule option
#378
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
chore: adopt new deprecated: DeprecatedInfo
meta rule option
#378
Conversation
🦋 Changeset detectedLatest commit: c19b39f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe metadata for the Changes
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (15)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to 8126b27 in 32 seconds. Click for details.
- Reviewed
28
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/rules/imports-first.ts:10
- Draft comment:
Ensure DeprecatedInfo keys meet spec. The deprecation message indicates 'import-x/first' but replacedBy rule name is just 'first'. Consider aligning them. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
2. src/rules/imports-first.ts:16
- Draft comment:
Verify that docsUrl('first') returns the correct URL for the replacement rule. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_Tv17AsIuUlDO7SX8
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/rules/imports-first.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/rules/imports-first.ts (1)
src/utils/docs-url.ts (1)
docsUrl
(5-6)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
src/rules/imports-first.ts (2)
1-1
: VerifydocsUrl
export
Ensure that thedocsUrl
function is re-exported fromsrc/utils/index.js
so this import resolves correctly at runtime.
20-23
: Confirmdocs
metadata URL
IfcreateRule
does not auto-populatemeta.docs.url
, explicitly add:url: docsUrl('imports-first'),Otherwise the documentation link may be missing.
commit: |
@error-four-o-four CI is broken |
oh dear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/package.spec.ts (1)
69-89
: Comprehensive test for DeprecatedInfo structure is well-implemented.This test thoroughly validates the ESLint core DeprecatedInfo structure and ensures proper migration from boolean deprecation flags. The validation covers all required properties and structure.
Consider these optional improvements for enhanced type safety and validation:
it('provides information about deprecated rules', () => { expect(module.rules!['imports-first'].meta).not.toHaveProperty('replacedBy') expect(typeof module.rules!['imports-first'].meta.deprecated).toBe('object') - const deprecated = module.rules!['imports-first'].meta.deprecated as Record< - string, - unknown - > + const deprecated = module.rules!['imports-first'].meta.deprecated as { + message: string + url: string + deprecatedSince: string + replacedBy: Array<{ message: string; rule: string }> + } expect(deprecated).toHaveProperty('message') + expect(typeof deprecated.message).toBe('string') expect(deprecated).toHaveProperty('url') + expect(typeof deprecated.url).toBe('string') expect(deprecated).toHaveProperty('deprecatedSince') + expect(typeof deprecated.deprecatedSince).toBe('string') expect(deprecated).toHaveProperty('replacedBy') expect(Array.isArray(deprecated.replacedBy)).toBe(true) - const replacedBy = deprecated.replacedBy as unknown[] + expect(deprecated.replacedBy.length).toBeGreaterThan(0) - expect(typeof replacedBy[0]).toBe('object') - expect(replacedBy[0]).toHaveProperty('message') - expect(replacedBy[0]).toHaveProperty('rule') + expect(typeof deprecated.replacedBy[0]).toBe('object') + expect(deprecated.replacedBy[0]).toHaveProperty('message') + expect(typeof deprecated.replacedBy[0].message).toBe('string') + expect(deprecated.replacedBy[0]).toHaveProperty('rule') + expect(typeof deprecated.replacedBy[0].rule).toBe('string') })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/rules/imports-first.ts
(2 hunks)test/package.spec.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/rules/imports-first.ts
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: JounQin
PR: un-ts/eslint-plugin-import-x#378
File: src/rules/imports-first.ts:10-19
Timestamp: 2025-06-08T12:09:38.535Z
Learning: The current implementation in eslint-plugin-import-x uses the correct ESLint core DeprecatedInfo structure: deprecatedSince field and replacedBy array with objects containing rule properties that match the ExternalSpecifier type with name and url fields.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
test/package.spec.ts (1)
65-65
: LGTM: Test correctly adapted for DeprecatedInfo structure.The change from checking
deprecated
istrue
to checking it's defined properly accommodates the new structured deprecation metadata format.
I'm still a bit insecure because the added test seems quite exhaustive. Aside from that the test is hardcoded and therefore it's not future-proof in case other rules will be deprecated too. But I'd argue that this could be better handled by The reported messages seem a bit uncaring but on the other hand they're sufficient enough |
Just in case: I finally found the related RFC, PR for |
deprecated: DeprecatedInfo
meta rule option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this, I didn't know about this change at all.
Hey there,
this is just a minor fix which updates the metadata of
imports-first
according to DeprecatedInfo in @eslint/core or rather @typescript-eslint/utilsImportant
Updates
imports-first
rule to useDeprecatedInfo
, marking it as deprecated and specifying replacement byimport-x/first
.imports-first
rule insrc/rules/imports-first.ts
to useDeprecatedInfo
.imports-first
as deprecated with message, URL, and version.import-x/first
with URL usingdocsUrl
.docsUrl
import from../utils/index.js
.This description was created by
for 8126b27. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit