acorn-import-attributes icon indicating copy to clipboard operation
acorn-import-attributes copied to clipboard

fix: keys for nodes should be something or null

Open swiing opened this issue 3 years ago • 2 comments

Currently, the assertions key of a node can get an object value, or null, or undefined. The latter case should not happen: the value should either be something or null.

Why does it matter?

Third party tools, e.g. rollup, assume that if no value exists, it should be null (e.g. here). If it encounters undefined instead, the code will break with an error.

Is it not an issue with those third party tools instead?

No. Even if it could be argued tools depending on acorn should be written in a more robust manner, acorn has consistently used null when there was no value available. This behaviour should remain.

swiing avatar Mar 20 '22 19:03 swiing

@xtuc any feedback on this one?

swiing avatar Apr 29 '22 08:04 swiing

@swiing the change is conflicting now. I'm happy to merge it once fixed.

xtuc avatar Nov 06 '24 09:11 xtuc