facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.
http://facebook.github.io/jsx/
1.96k stars 133 forks source link

Consider including difference between <tag> and <Component> in spec #29

Closed glenjamin closed 2 years ago

glenjamin commented 9 years ago

This arose in relation to https://github.com/eslint/eslint/issues/1911

Currently, the spec has a single node type for JSXElementName, which separates three cases: identifier, xml-namespaced identifier, JS member expression identifier.

In the implementation as of 0.12, the semantics of a tag differ depending on the casing of the first character of the identifier.

Could this be incorporated in some way? Perhaps as JSXComponent vs JSXIdentifier or JSXIdentifier vs JSXTag. Something to indicate that one should be interpreted as a variable reference, and one as a string literal.

sebmck commented 9 years ago

The JSX spec purposely doesn't define semantics. It's meant to be agnostic and <Component> does not necessarily have to reference a variable.

glenjamin commented 9 years ago

In practice, JSX implementations which are "React-agnostic" currently special-case the <tag> forms.

While this remains unspecified, core tooling like eslint & babel are in a bit of a halfway house where React-specific semantics around variables are hard-coded, but not the resulting transform.

sebmck commented 9 years ago

@glenjamin Babel isn't a valid comparison since it specifically targets the React flavour of JSX.

ghost commented 9 years ago

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

Huxpro commented 2 years ago

Closed because this is intentional.