diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b01f536066..1d08ffcaa375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom - Add [noMisleadingInstantiator](https://biomejs.dev/linter/rules/no-mileading-instantiator) rule. The rule reports the misleading use of the `new` and `constructor` methods. Contributed by @unvalley +#### Bug fixes + +- Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4 + ### Parser ### VSCode diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_confusing_void_type.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_confusing_void_type.rs index f2df6e6fae91..c8445ea5d414 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_confusing_void_type.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_confusing_void_type.rs @@ -114,6 +114,7 @@ fn node_in(node: &SyntaxNode) -> Option { JsSyntaxKind::TS_THIS_PARAMETER | JsSyntaxKind::TS_RETURN_TYPE_ANNOTATION | JsSyntaxKind::TS_TYPE_PARAMETER + | JsSyntaxKind::TS_FUNCTION_TYPE | JsSyntaxKind::TS_TYPE_ARGUMENT_LIST => { return None; } diff --git a/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts b/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts index 0e590a71f24b..a35ed7e33554 100644 --- a/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts +++ b/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts @@ -5,3 +5,5 @@ logAndReturn(undefined); let voidPromise: Promise = new Promise(() => { }); let voidMap: Map = new Map(); + +type FallbackHandler = (error?: Error) => void; \ No newline at end of file diff --git a/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts.snap b/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts.snap index e3e20055d86d..4239668bf62e 100644 --- a/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts.snap +++ b/crates/biome_js_analyze/tests/specs/nursery/noConfusingVoidType/valid.ts.snap @@ -1,6 +1,5 @@ --- source: crates/biome_js_analyze/tests/spec_tests.rs -assertion_line: 80 expression: valid.ts --- # Input @@ -13,6 +12,7 @@ logAndReturn(undefined); let voidPromise: Promise = new Promise(() => { }); let voidMap: Map = new Map(); +type FallbackHandler = (error?: Error) => void; ``` diff --git a/website/src/content/docs/internals/changelog.mdx b/website/src/content/docs/internals/changelog.mdx index e364abd59152..4bf3716e8d85 100644 --- a/website/src/content/docs/internals/changelog.mdx +++ b/website/src/content/docs/internals/changelog.mdx @@ -28,6 +28,10 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom - Add [noMisleadingInstantiator](https://biomejs.dev/linter/rules/no-mileading-instantiator) rule. The rule reports the misleading use of the `new` and `constructor` methods. Contributed by @unvalley +#### Bug fixes + +- Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4 + ### Parser ### VSCode