-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
Rebased after #6 was merged. |
I don't have a large sample size, but it looks like among my local cache, the problem file is a singular occurrence:
|
Went hunting to see how npm does this, in case it has a clever way of handling it.. Turns out it is basically doing the same thing: https://github.com/npm/npm/blob/latest/lib/utils/parse-json.js if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1)
} |
@zkat if this feels like deja vu.. npm/npm#8724 |
66a3363
to
6fb3db0
Compare
This LGTM. Can we get a test for it, too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but needs a test (for all of npm-shrinkwrap.json
, package-lock.json
, and package.json
, imo)
Incoming. I skipped it on the first pass because every time I looked at failing file with
Is it really necessary to test 3 different filenames in a unit test for |
fs.readFile* don't strip the BOM header, even when specifying 'utf8' as the encoding, and JSON.parse() doesn't handle it either. There are technically a bunch of BOM indicators, but this is the one seen most commonly and actually appears in a number of package.json files in the wild. See nodejs/node#6924, nodejs/node#3040 for background.
@zkat I've rebased and added a unit test for for |
fs.readFile* don't strip the BOM header, even when specifying 'utf8' as
the encoding, and JSON.parse() doesn't handle it either. There are
technically a bunch of BOM indicators, but this is the one seen most
commonly and actually appears in a number of package.json files in the
wild.
See nodejs/node#6924, nodejs/node#3040 for background.