servexyz / tacker

logging tools to help you debug through rough seas
https://npmjs.com/package/tacker
MIT License
0 stars 1 forks source link

Add a default export #13

Open alechp opened 5 years ago

alechp commented 5 years ago

As much as I'm not a fan of default exports, it makes sense to give people the option. Consider:

import { printMirror, printLine, printPkgVersion, printPkgProp } from 'tacker'
printMirror(...)
printLine(...)
printPkgVersion(...)
printPkgProp(...)

While I prefer this, it's undeniably cumbersome for the terse enthusiasts.

Considering

import tk from 'tacker'
tk.mirror(...)
tk.line(...)
tk.

As an author, my one pain point with not using default is needing to be explicit to avoid polluting the namespace.

My ideal would be

import { mirror, line, pkgProp, pkgVersion } from 'tacker'
mirror(...)
line(...)
pkgProp(...)
pkgVersion(...)

Obviously, doesn't make sense. The person can choose what to name it using the export as, but that seems cumbersome... besides all the obvious reasons, it's worse considering tacker is supposed to aid DX.

Then again, what's to stop someone from simply doing ?

import * as tk from 'tacker'

Honestly, that makes more sense.

alechp commented 5 years ago

Following the initial description, here's the action items: