-
-
Notifications
You must be signed in to change notification settings - Fork 163
Plugin is polluting Array.prototype #366
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
Comments
Unless you are opposed to all polyfills, it is not polluting to add a compliant polyfill for a standard or pseudo-standard method like |
flat It is erringly looking for The problem arises from the fact that iterating over any array with |
In our case, this code is inside our main |
… renamed `flatten` method from polluting prototype (gajus#366)
|
I'll go ahead and close now with the change added to |
My main question here is why even include another flatMap function since you already have one in Lodash (that you use) |
@brettz9 Thanks. This will help |
@luislobo My preference has been to move away from lodash where there is a native equivalent. The semantics are more well-known and understood. There's nothing wrong with frameworks, of course, but even some features that elegantly save a good deal of code and which we are still using, like lodash's Some of the sugar in lodash may be unexpected for those not familiar with it--e.g., where it may not fail with non-array values, so if there is a native near-equivalent, I'd very much prefer to use that where practical (where there is little difference in the readability/amount of code needed). |
* master: chore: report unused disable directives in eslint refactor: remove unused disable directives fix(require-jsdoc): avoid exported functions possessing jsdoc blocks causing other non-public functions to be treated as exported; fixes gajus#358 refactor(require-jsdoc): remove redundant check docs(require-returns): Fix typo chore: update devDeps; avoid `lint-staged` Add type "symbol" to noUndefinedTypes chore: update `lint-staged` for husky issue: typicode/husky#247 chore(CI): stop running broken npm script `check-readme` fix(no-undefined-types): avoid `flat-map-polyfill` entirely; further further fix for gajus#366 fix(check-tag-names): ensure `replacement` field overrides a default tag name preference; fixes gajus#367 chore: update comment-parser dep. and devDeps; avoid buggy eslint6.2 and for eslint 6 tests, avoid breaking typescript-eslint/parser update fix(`no-undefined-types`): import flat-map polyfill directly to avoid renamed `flatten` method from polluting prototype (gajus#366)
This is a really weird one.
Since upgrading from
4.8.3
to15.*
we began to see an interesting browser console error:As you can see, somehow a function/method is being inserted into our template as a stylesheet.
The
eslint-plugin-jsdoc
dependency was not even on the list of suspects. However, we finally observed that downgrading resolved the issue. We can replicate this 100% of the time.TLDR: Something (some polyfill it seems) in your codebase is modifying
Array.prototype
with aflatten
method that is polluting the webpack plugin namespace.The text was updated successfully, but these errors were encountered: