1. 2
  1.  

  2. 6

    This article feels like it’s rationalizing trading window.{{library}} for context.{{library}}. In the end, we avoid both scenarios as they’re polluting a namespace without being explicitly used in the file. After 20 different dependencies, it gets unwieldy and can lead to unnecessary conflicts.

    Instead, we prefer per-file requires/includes (which are mentioned in the article then handwavingly dismissed) as it keeps everything explicit. In the case of removing a common dependency across many files, linters will typically complain about unused dependencies and git grep/sed are our friends. In my experience, this rarely is an issue although sometimes I would wish for a custom DSL in tests (which I’ve since learned to do pre-emptively)

    1. 1

      This is like the “monkey-patch everything onto jQuery.prototype even if it doesn’t have anything to do with jQuery” fever that only recently broke.