💼 This rule is enabled in the ✅ recommended config.
This rule will catch and prevent the use of tryInvoke.
This rule aims to disallow the usage of tryInvoke. Native JavaScript language now supports optional chaining and developers are encouraged to use optional chaining ?.() instead.
Examples of incorrect code for this rule:
import { tryInvoke } from '@ember/utils';
class FooComponent extends Component {
foo() {
tryInvoke(this.args, 'bar', ['baz']);
}
}Examples of correct code for this rule:
class FooComponent extends Component {
foo() {
this.args.bar?.('baz');
}
}