feat(lint): implement useConsistentMethodSignatures from typescript-eslint#8786
feat(lint): implement useConsistentMethodSignatures from typescript-eslint#8786dyc3 merged 4 commits intobiomejs:mainfrom
useConsistentMethodSignatures from typescript-eslint#8786Conversation
🦋 Changeset detectedLatest commit: 6fe58c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
WalkthroughAdds a nursery linter rule Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @.changeset/shiny-hands-care.md:
- Line 24: The file .changeset/shiny-hands-care.md is missing a trailing
newline; open that markdown file and add a single newline character at the end
so the file ends with exactly one trailing newline (ensure no extra blank lines
are appended).
In
`@crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs`:
- Around line 240-245: Fix the typo in the doc comment for the
declare_node_union! block that defines AnyTsMethodSignatureLike: change the
string "orinterface" to "or interface" in the comment above the macro invocation
so the sentence reads "within a type alias or interface." Leave the macro name
declare_node_union! and the union members (TsMethodSignatureTypeMember |
TsPropertySignatureTypeMember) unchanged.
- Line 56: The documentation comment in use_consistent_method_signatures.rs
contains an incomplete sentence: "any `Event`s passed to the `SpecialEvent`s" —
update the doc string for the rule (near the comment mentioning `Event` and
`SpecialEvent`) to complete the thought and clarify the relationship (for
example: "any `Event`s passed to the `SpecialEvent` handlers" or "any `Event`s
passed to `SpecialEvent`-typed parameters"), ensuring the sentence reads
grammatically and consistently references `Event` and `SpecialEvent`.
- Around line 114-118: The doctest in use_consistent_method_signatures.rs
contains invalid TypeScript syntax for the property type `genericProp<T, U>:
(arg: T) => U`; update the example so the property is typed as a generic
function type instead of placing type parameters on the property name (i.e.,
make `genericProp` have a type that declares `<T, U>` on the function itself and
then `(arg: T) => U`). Modify the snippet in the doctest for the `genericProp`
property accordingly so it is valid TypeScript.
crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs
Show resolved
Hide resolved
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs`:
- Around line 248-253: Doc comment contains a typo "annotatation" — update the
comment inside the declare_node_union for AnyTsMethodSignatureLike (the union of
TsMethodSignatureTypeMember and TsPropertySignatureTypeMember) to correct
"annotatation" to "annotation" so the documentation reads properly.
- Around line 149-155: The JSON example in the doc comment for the rule
use_consistent_method_signatures contains an invalid trailing comma after
"method"; remove that trailing comma so the snippet becomes valid JSON (update
the docblock showing the "options" example in
use_consistent_method_signatures.rs to have "style": "method" without a
following comma).
🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs (1)
188-192: Convert comment to rustdoc.Per coding guidelines, use inline rustdoc documentation. The current comment uses
//instead of///.Proposed fix
-// Struct containing info about an inconsistent method signature diagnostic. +/// Struct containing info about an inconsistent method signature diagnostic. pub struct InconsistentMethodSignatureState { target_style: MethodSignatureStyle, node_style: MethodSignatureStyle, }
crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_consistent_method_signatures.rs
Show resolved
Hide resolved
useConsistentMethodSignatures from TSEslintuseConsistentMethodSignatures from typescript-eslint
|
... how did merging into |
96e95d3 to
a7d21de
Compare
|
@dyc3 Rebased onto main as requested. |
|
There's still some CI failures |
|
@dyc3 The goal was to highlight lines 2-3 and 4-6 of the codeblock on the website, but it appears this will have to be shelved until the doctest code learns to ignore such patterns. |
|
That's fine, we can remove the syntax causing the error |
Summary
Works towards implementing #8780
Implements a new nursery rule
useConsistentMethodSignatureswith the same semantics as its parent TSEslint counterpart.No code fix is currently implemented, so the issue is left open for someone else to try their hand.
Test Plan
4 new spec test files, plus around 1-2 dozen doctests.
Docs
see above