Edit: This problem is related to JSHint instead of JSLint - Change the tag has given .
The following gives me a "potentially severe violation" - I understand why a violation occurs - this is a function that does not trust JSLIID, this
Is a method due to the use of:
function widget (name) {This.name = name; } Widget.prototype.do Something = Something; Function doSomething () {console.log (this.name + "did something"); }
However, JSLT warnings are resolved in the following ways, they force me into code organization that I want to save:
1) Function inline Announced:
widget.prototype.do some = actions () {console.log (this.name + "did something"); }
2) this
:
widget. Prototype.doSomething = function () {return DoSomething (this); }; Function doSomething (self) {// ...}
Is there any way to organize the code to solve the issue other than using the above methods?
properly How to find out your question is Do # 1:
widget.prototype.do some = function () {console.log (this.name + "did something"); }
The entire issue of the lint is that it prevents you from making source code in common sources, and the error you are seeing is completely correct It is: You do not see any it
mentioned in any function not declared on any object.
There is nothing to do with the behavior of the program at the time of implementation of the lining. It is not that Linting does not "believe" that your method will be applied to one object, that there is a problem in your source code which is problematic. You can work around it, but even if Pattern is still in your source, you still have a linings problem.
If you want to ignore it, then wrap it in / * jslint start * /
and / * ignore jslint end * /
, but The problem will still be there.
No comments:
Post a Comment