Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

members of Object.prototype shouldn't be treated as undeclared variables in no-undef #180

Closed
michaelficarra opened this issue Aug 1, 2013 · 6 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion rule Relates to ESLint's core rules

Comments

@michaelficarra
Copy link
Member

See discussion in #164. Related: #6.

@nzakas
Copy link
Member

nzakas commented Aug 1, 2013

JSHint warns on these. Is there a reason we should act differently?

@michaelficarra
Copy link
Member Author

The rule is described as "locate potential ReferenceErrors resulting from mispellings [sic] of variable and parameter names or accidental implicit globals". The members of Object.prototype are in scope, so usage will not cause a ReferenceError and assignments will not cause an own-property of the global object to be created.

@anba
Copy link

anba commented Aug 2, 2013

Strictly speaking the current behaviour is compliant to ECMAScript, because the [[Prototype]] of the global object is implementation specific. That means a compliant ECMAScript implementation can set the global object's [[Prototype]] to null or any other object.

@nzakas
Copy link
Member

nzakas commented Aug 2, 2013

That's a very good point. Given that, I think we should stick with the current behavior.

@nzakas nzakas closed this as completed Aug 2, 2013
@michaelficarra
Copy link
Member Author

@anba: That's a really good point. I had always taken it for granted that the global object's [[Prototype]] was Object.prototype. But you're right that it's not specified that way. I am going to ask es-discuss whether this was an omission or intentional, in which case a spec NOTE making it explicit would be handy.

@michaelficarra
Copy link
Member Author

ECMA-262 bug filed here: https://bugs.ecmascript.org/show_bug.cgi?id=1714. The spec will soon enforce that Object.prototype is in the prototype chain of the global object.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants