Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linter): implement unicorn/no-useless-undefined (#4079)
Resolves #3870 Hey there, thought I'd give this a try as it's tagged "good first issue" :) Let me know if there's anything that needs to change Another part of the code also needs modification: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/rules/no-useless-undefined.js#L95 I tried to modify it. If there are any issues with these modifications, please let me know. ``` fn is_has_function_return_type(node: &AstNode, ctx: &LintContext<'_>) -> bool { let Some(parent_node) = ctx.nodes().parent_node(node.id()) else { return false; }; match parent_node.kind() { AstKind::ArrowFunctionExpression(arrow_func_express) => { arrow_func_express.return_type.is_some() } AstKind::Function(func) => func.return_type.is_some(), _ => is_has_function_return_type(parent_node, ctx), } } ```
- Loading branch information