eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

False negative for jquery-ember-run for many jquery element references

Open tehhowch opened this issue 2 years ago • 1 comments

import $ from "jquery";
const $el = $("#item");
$el.on("click", () => this.handle());

passes, but it should fail.

import $ from "jquery";
const $parent = $("<div><button type='button'>Click Me</button></div>");
$parent.find("button").on("click", () => this.handle());

should also fail, but passes.

I agree that the rule should not trigger for arbitrary someVar.on("click", callback) scenarios, but when the property is known to be a jQuery element reference, it should trigger.

tehhowch avatar Jun 15 '23 16:06 tehhowch

Yeah that would be a good case to catch. Would require using our getNodeOrNodeFromVariable() helper (which uses findVariable from eslint-utils under the hood) to detect it.

bmish avatar Jun 15 '23 22:06 bmish