Using the sinon library's recommended usage of it's fakes feature.
Seems to be triggering on replace (though oddly, this doesn't appear to be a documented thing in the rule docs?
import sinon from 'sinon';
const fakeConfirm = sinon.fake.returns(true);
sinon.replace(window, 'confirm', fakeConfirm);
console.log(
window.confirm('Are you a banana?') ? 'It's peanut butter jelly time!' : 'Perhaps you are a baseball bat'
);
sinon.restore();
If I may piggy-back on the report, it might be helpful to have some method to define custom exclusion patterns for this rule in the config to tide us over until the false positives can be fixed. Obviously, the rule can be disabled in-line (or for entire files), but that could also cover cases where the false-positive comes from project code instead.
Using the sinon library's recommended usage of it's
fakesfeature.Seems to be triggering on
replace(though oddly, this doesn't appear to be a documented thing in the rule docs?If I may piggy-back on the report, it might be helpful to have some method to define custom exclusion patterns for this rule in the config to tide us over until the false positives can be fixed. Obviously, the rule can be disabled in-line (or for entire files), but that could also cover cases where the false-positive comes from project code instead.