ember-cli / ember-cli/core-object

Clobbering `this` from `options` might be murky

Open
#26 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16
Forks
16
PR merge metrics
No merged PRs in 30d

Description

If I understand [the constructor](https://github.com/ember-cli/core-object/blob/9138b1f55da74386b9547110ee5b6f52afcdfa65/core-object.js#L18-L20) correctly, we're providing the ability to assign arbitrary properties on `this` through an `options` hash as a common base class constructor.

I used to do this in early versions of Broccoli plugin classes because it seemed convenient. I stopped doing it when I started running into cases where some library upgrade would cause property names to start colliding with option names. I simply do `this.options = options` in constructors ever since, and have been much happier with that.

My suggestion would be to make the base class constructor empty, and let people do their own option handling. I realize this might be a breaking change, but perhaps it's worth considering for the next major version?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.