-
Notifications
You must be signed in to change notification settings - Fork 889
Add ability to ban global functions #327
Comments
This would likely be an extension of the |
+1 subscribing |
👍 , specifically banning |
More use cases: |
Do you prefer extending the ban rule or creating a separate rule? IMHO it would be most intuitive to extend the existing ban rule, but this could be confusing in the configuration. How would a config then look like? Is a global function configuration just a string? Or an array of one string (which is described in the documentation as an object)?
So for a clear configuration a separate rule could make sense. If you prefer a separate rule: Are you fine with the name "global-ban"? It feels there could be a better name. I will send a pull request tonight or tomorrow. |
I think extending the ban rule would be nicer, but I would be fine with a new role called global-ban. |
And how would you configure it in the ban rule? As a one item array (which would follow the syntax for the other bans) or as single strings (which may be a bit confusing)? My first implementation uses a single item array: |
Oh, I don't know :) Maybe others have an opinion about this. |
Looks good, or as an object it could be some reserved word (e.g. global) or null/undefined value "ban": [true, [null, "someGlobalFunction"], ["console", "log"], ["someObject", "someFunction"]] I'm looking for ways to ban |
Me personally, I'm not a huge fan of using null/undefined keywords in such cases. I just submitted a pull request. Please have a look at it. If you don't like the suggested syntax, we can again discuss it and change the implementation. :) |
ie:
alert
The text was updated successfully, but these errors were encountered: