Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: get callee by function and use hyperlink
  • Loading branch information
unvalley committed Jan 9, 2023
commit 1c52728fc71325e6377af9371960eab2b75157df
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ impl Rule for NoPrototypeBuiltins {

fn run(ctx: &RuleContext<Self>) -> Self::Signals {
let call_expr = ctx.query();
let JsCallExpressionFields { callee, .. } = call_expr.as_fields();
let mut callee = callee.ok()?;
let mut callee = call_expr.callee().ok()?;

// We need to handle a parenthesized expression case e.g. `(foo?.hasOwnProperty)("bar");`
if let AnyJsExpression::JsParenthesizedExpression(expr) = callee {
Expand Down Expand Up @@ -132,7 +131,7 @@ impl Rule for NoPrototypeBuiltins {
"It's recommended using "<Emphasis>"Object.hasOwn()"</Emphasis>" instead of using "<Emphasis>"Object.hasOwnProperty()"</Emphasis>"."
})
.note(markup! {
"See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn"
"See "<Hyperlink href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn">"MDN web docs"</Hyperlink>" for more details."
}),
)
} else {
Expand Down