Skip to content

Commit

Permalink
Merge branch 'main' into fix-useless-fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
nissy-dev committed Oct 24, 2023
2 parents 167785e + 00d8afe commit fa97d22
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ 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 [#595](https://github.com/biomejs/biome/issues/595) by updating unsafe-apply logic to avoid unexpected errors in [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/). Contributed by @nissy-dev

- 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
Expand Up @@ -692,7 +692,7 @@ impl Rule for UseExhaustiveDependencies {
rule_category!(),
use_effect_range,
markup! {
"This hook do not specify all of its dependencies."
"This hook does not specify all of its dependencies."
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function MyComponent2() {
```
checkHooksImportedFromReact.js:3:9 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
1 │ function MyComponent1() {
2 │ let a = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function MyComponent() {
```
customHook.js:5:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
3 │ function MyComponent() {
4 │ let a = 1;
Expand All @@ -46,7 +46,7 @@ customHook.js:5:5 lint/correctness/useExhaustiveDependencies ━━━━━━
```
customHook.js:8:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
6 │ console.log(a);
7 │ });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extraDependenciesInvalid.js:28:3 lint/correctness/useExhaustiveDependencies ━
```
extraDependenciesInvalid.js:28:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
26 │ function MyComponent1() {
27 │ let someObj = getObj();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function MyComponent13() {
```
missingDependenciesInvalid.js:7:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
5 │ let a = 1;
6 │ const b = a + 1;
Expand All @@ -160,7 +160,7 @@ missingDependenciesInvalid.js:7:5 lint/correctness/useExhaustiveDependencies ━
```
missingDependenciesInvalid.js:7:5 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
5 │ let a = 1;
6 │ const b = a + 1;
Expand All @@ -184,7 +184,7 @@ missingDependenciesInvalid.js:7:5 lint/correctness/useExhaustiveDependencies ━
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -208,7 +208,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -232,7 +232,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -256,7 +256,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -280,7 +280,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -304,7 +304,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
19 │ const deferredValue = useDeferredValue(value);
20 │ const [isPending, startTransition] = useTransition();
Expand All @@ -327,7 +327,7 @@ missingDependenciesInvalid.js:21:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:41:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
39 │ function MyComponent3() {
40 │ let a = 1;
Expand All @@ -351,7 +351,7 @@ missingDependenciesInvalid.js:41:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:42:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
40 │ let a = 1;
41 │ useEffect(() => console.log(a));
Expand All @@ -375,7 +375,7 @@ missingDependenciesInvalid.js:42:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:43:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
41 │ useEffect(() => console.log(a));
42 │ useCallback(() => console.log(a));
Expand All @@ -399,7 +399,7 @@ missingDependenciesInvalid.js:43:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:44:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
42 │ useCallback(() => console.log(a));
43 │ useMemo(() => console.log(a));
Expand All @@ -423,7 +423,7 @@ missingDependenciesInvalid.js:44:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:45:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
43 │ useMemo(() => console.log(a));
44 │ useImperativeHandle(ref, () => console.log(a));
Expand All @@ -447,7 +447,7 @@ missingDependenciesInvalid.js:45:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:46:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
44 │ useImperativeHandle(ref, () => console.log(a));
45 │ useLayoutEffect(() => console.log(a));
Expand All @@ -471,7 +471,7 @@ missingDependenciesInvalid.js:46:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:53:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
51 │ function MyComponent4() {
52 │ let a = 1;
Expand All @@ -495,7 +495,7 @@ missingDependenciesInvalid.js:53:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:62:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
60 │ function MyComponent5() {
61 │ let a = 1;
Expand Down Expand Up @@ -528,7 +528,7 @@ missingDependenciesInvalid.js:62:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:72:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
70 │ function MyComponent6() {
71 │ let someObj = getObj();
Expand All @@ -552,7 +552,7 @@ missingDependenciesInvalid.js:72:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:78:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
77 │ const MyComponent7 = React.memo(function ({ a }) {
> 78 │ useEffect(() => {
Expand All @@ -575,7 +575,7 @@ missingDependenciesInvalid.js:78:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:84:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
83 │ const MyComponent8 = React.memo(({ a }) => {
> 84 │ useEffect(() => {
Expand All @@ -598,7 +598,7 @@ missingDependenciesInvalid.js:84:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:92:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
90 │ export function MyComponent9() {
91 │ let a = 1;
Expand All @@ -622,7 +622,7 @@ missingDependenciesInvalid.js:92:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:99:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
97 │ export default function MyComponent10() {
98 │ let a = 1;
Expand All @@ -646,7 +646,7 @@ missingDependenciesInvalid.js:99:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:107:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
105 │ function MyComponent11() {
106 │ let a = 1;
Expand All @@ -670,7 +670,7 @@ missingDependenciesInvalid.js:107:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:114:3 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
112 │ function MyComponent12() {
113 │ let a = 1;
Expand All @@ -694,7 +694,7 @@ missingDependenciesInvalid.js:114:3 lint/correctness/useExhaustiveDependencies
```
missingDependenciesInvalid.js:122:9 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━
! This hook do not specify all of its dependencies.
! This hook does not specify all of its dependencies.
120 │ function MyComponent13() {
121 │ let a = 1;
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,9 +33,13 @@ 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 [#595](https://github.com/biomejs/biome/issues/595) by updating unsafe-apply logic to avoid unexpected errors in [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/). Contributed by @nissy-dev

- 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
Expand Up @@ -51,7 +51,7 @@ function component() {

<pre class="language-text"><code class="language-text">correctness/useExhaustiveDependencies.js:5:5 <a href="https://biomejs.dev/linter/rules/use-exhaustive-dependencies">lint/correctness/useExhaustiveDependencies</a> ━━━━━━━━━━━━

<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">This hook do not specify all of its dependencies.</span>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">This hook does not specify all of its dependencies.</span>

<strong>3 │ </strong>function component() {
<strong>4 │ </strong> let a = 1;
Expand Down Expand Up @@ -151,7 +151,7 @@ function component() {

<pre class="language-text"><code class="language-text">correctness/useExhaustiveDependencies.js:6:5 <a href="https://biomejs.dev/linter/rules/use-exhaustive-dependencies">lint/correctness/useExhaustiveDependencies</a> ━━━━━━━━━━━━

<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">This hook do not specify all of its dependencies.</span>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">This hook does not specify all of its dependencies.</span>

<strong>4 │ </strong> let a = 1;
<strong>5 │ </strong> const b = a + 1;
Expand Down

0 comments on commit fa97d22

Please sign in to comment.