mozilla / eslint-plugin-no-unsanitized

Custom ESLint rule to disallows unsafe innerHTML, outerHTML, insertAdjacentHTML and alike
Mozilla Public License 2.0
223 stars 34 forks source link

Unsupported Callee for CallExpression no-unsanitized/method #71

Closed bennycode closed 6 years ago

bennycode commented 6 years ago

I tested eslint-plugin-no-unsanitized and got the following output:

D:\dev\projects\wireapp\wire-webapp\app\script\view_model\bindings\CommonBindings.js 303:14 error Error in no-unsanitized: Unexpected Callee. Please report a minimal code snippet to the developers at https://github.com/mozilla/eslint-plugin-no-unsanitized/issues/new?title=Unsupported%20Callee%20for%20CallExpression no-unsan itized/method 306:7 error Error in no-unsanitized: Unexpected Callee. Please report a minimal code snippet to the developers at https://github.com/mozilla/eslint-plugin-no-unsanitized/issues/new?title=Unsupported%20Callee%20for%20CallExpression no-unsan itized/method

It seems like the plugin doesn't like return this().trim(); & this(value.trim()); in:

ko.subscribable.fn.trimmed = function() {
  return ko.computed({
    owner: this,
    read() {
      return this().trim();
    },
    write(value) {
      this(value.trim());
      this.valueHasMutated();
    },
  });
};

Here are the links to the specific lines of CommonBindings.js (which the plugin complains about):

mozfreddyb commented 6 years ago

Sorry for the long delay in my response. I was on parental leave for the last month and am still in the process of catching up with backlog.

Thank you for the detailed report, I'll try to get to it within this week. heads up to @jonathanKingston, I'll ask you for a review then.

mozfreddyb commented 6 years ago

@bennyn I just published v2.0.2 which has a fix for this issue. Thank you for using our tiny plugin and submitting useful, detailed reports! Please let us know if you discover anything else in the future.

bennycode commented 6 years ago

@mozfreddyb Thanks for publishing the fix! 🤗

We immediately applied your plugin in our codebase:

Well done! 👍