-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't modify string prototype #159
Comments
Having the same issue. Please fix |
Same issue, any solutions or proposed work arounds? |
+1, driven by the string.js report. |
Yeah, this is super annoying and violates modern idiomatic JavaScript :) Any willingness to fix this? |
A bit quick on the keyboard... hope that didn't come off as entitled; if it did, I'm sorry. Even an option to disable it would work great. Thanks! |
Also experiencing this issue. Please fix. |
I've published a new version |
Extending the prototype at all is dubious, especially implicitly instead of explicitly, but doing so with functions that dirty the filesystem is just nasty. I just spent two hours of my day running down where a mysterious file was coming from that's a result of what appears to be nasty behavior on the part of both shelljs AND string.js; either fix will do, but they both need it. |
+1 This looks to be the root cause of watson-developer-cloud/node-sdk#56 / jprichardson/string.js#160 |
version |
+1 pleasse do not modify or at least make it not enumerable. |
Bumping this thread, since this will finally be resolved in #360. Thanks for reporting this! |
We decided to go with the "opt-out" approach for ShellJS v0.7 (see #398 for the discussion). If you don't mind having the string prototype extended, you can continue to use the convenience script If the string prototype is still a concern for |
@nfischer - I think modifying builtins or their prototypes is a very bad idea. I'd encourage deprecating the whole |
@BYK: I think the idea behind global mode is to more closely emulate bash scripting in shelljs. If you're writing a simple script which is only shelljs commands, it can save a lot of time. This is also why we have the non-global option for people who would prefer not to. |
@ariporad - we can still do that with Anyways, I think even if we keep the global mode, having our own |
The rationale is that modifying the global namespace is equally as wrong as modifying the builtin. So, for now, it's been added back, but only for global. I think we should give a deprecation warning (converting a string to a ShellString is an alternative). This is something I wouldn't be opposed to removing for good in v0.8. |
Ran into an issue debugging an issue with a coworker.
If the
string
module is included anywhere downstream ofshelljs
you get a pair of warnings.Here is the script to duplicate the issue.
This has already been caught by several other issues...
Since shelljs is so heavily relied upon it might be a better to not modify the global
String
prototype.The text was updated successfully, but these errors were encountered: