Skip to content

Commit

Permalink
fix(lint/noRedeclare): don't report type params of method signatures (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Oct 24, 2023
1 parent 6f72cf5 commit 00d8afe
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
#### Bug fixes

- Fix [#557](https://github.com/biomejs/biome/issues/557) which made [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) report imported types used in `typeof` expression. Contributed by @Conaclos

- Fix [#576](https://github.com/biomejs/biome/issues/576) by removing some erroneous logic in [noSelfAssign](https://biomejs.dev/linter/rules/no-self-assign/). Contributed by @ematipico

- Fix [#591](https://github.com/biomejs/biome/issues/591) which made [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) report type parameters with identical names but in different method signatures. Contributed by @Conaclos

### Parser

### VSCode
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
interface I {
get<T>(f: T): T;
post<T>(g: T): T;
}

type A = {
get<T>(f: T): T;
post<T>(g: T): T;
}

declare class C {
get<T>(f: T): T;
post<T>(g: T): T;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
expression: validMethodTypeParam.ts
---
# Input
```js
interface I {
get<T>(f: T): T;
post<T>(g: T): T;
}

type A = {
get<T>(f: T): T;
post<T>(g: T): T;
}

declare class C {
get<T>(f: T): T;
post<T>(g: T): T;
}

```


6 changes: 5 additions & 1 deletion crates/biome_js_semantic/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ impl SemanticEventExtractor {
| TS_ENUM_DECLARATION
| TS_TYPE_ALIAS_DECLARATION
| TS_DECLARE_FUNCTION_DECLARATION
| TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION => {
| TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION
| TS_METHOD_SIGNATURE_CLASS_MEMBER
| TS_METHOD_SIGNATURE_TYPE_MEMBER => {
self.push_scope(
node.text_range(),
ScopeHoisting::DontHoistDeclarationsToParent,
Expand Down Expand Up @@ -602,6 +604,8 @@ impl SemanticEventExtractor {
| JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER
| TS_DECLARE_FUNCTION_DECLARATION
| TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION
| TS_METHOD_SIGNATURE_CLASS_MEMBER
| TS_METHOD_SIGNATURE_TYPE_MEMBER
| TS_INTERFACE_DECLARATION
| TS_ENUM_DECLARATION
| TS_TYPE_ALIAS_DECLARATION
Expand Down
4 changes: 4 additions & 0 deletions website/src/content/docs/internals/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
#### Bug fixes

- Fix [#557](https://github.com/biomejs/biome/issues/557) which made [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) report imported types used in `typeof` expression. Contributed by @Conaclos

- Fix [#576](https://github.com/biomejs/biome/issues/576) by removing some erroneous logic in [noSelfAssign](https://biomejs.dev/linter/rules/no-self-assign/). Contributed by @ematipico

- Fix [#591](https://github.com/biomejs/biome/issues/591) which made [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) report type parameters with identical names but in different method signatures. Contributed by @Conaclos

### Parser

### VSCode
Expand Down

0 comments on commit 00d8afe

Please sign in to comment.