CoffeeChaton / vscode-autohotkey-NekoHelp-Old

my style
Other
9 stars 0 forks source link

References to `.base` property cause a nonsense warning #6

Closed Lexikos closed 1 year ago

Lexikos commented 1 year ago
class Widget {

}
x := new Widget()
if (x.base = Widget) {
    MsgBox x is a Widget
}

The reference to .base is underlined as a warning:

Alert Prototype Polution!! Suggest to use class replace - neko help(600)

I have almost no idea what it is trying to say, but I'm quite certain it is mistaken. There is nothing wrong with reading the .base property.

CoffeeChaton commented 1 year ago

I will remove this inappropriate rule this weekend.

Some of the diagnostic rules are arbitrary ports based on the js eslint tool, I will review the diagnostic rules and remove the personal or other ecological rules based on the ahk-doc, after all I have made this extension public and not just for friends.

The reason I added this rule was because I happened to be surprised by the js prototype chain pollution, and I think the surprise of the prototype chain pollution should not appear in the ahk ecosystem, after all, the ahk users I see are not like js users , use npm to install hundreds of runtime dependencies without ever viewing the source code.

Lexikos commented 1 year ago

Although I would not personally find value in being warned when a script is "polluting the prototype chain" (of standard objects or primitive types), I can see why you might want the warning.

However, my example is only reading/inspecting the prototype chain of a private object, not modifying the prototype chain of shared classes. There is no pollution.

CoffeeChaton commented 1 year ago

This diagnostic rule has been removed at v0.0.15.