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

Jsx namespaced name and attributes #42963

Closed
armano2 opened this issue Feb 25, 2021 · 0 comments Β· Fixed by #43104
Closed

Jsx namespaced name and attributes #42963

armano2 opened this issue Feb 25, 2021 · 0 comments Β· Fixed by #43104
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@armano2
Copy link

armano2 commented Feb 25, 2021

Bug Report

πŸ”Ž Search Terms

  • jsx
  • ast
  • syntax
  • JSXNamespacedName
  • typescript 4.2

πŸ•— Version & Regression Information

  • This changed between versions 4.2.0 and 4.3.x

⏯ Playground Link

Playground link
typescript-eslint/typescript-eslint#3112

πŸ’» Code

declare namespace JSX {
  interface IntrinsicElements {
    'this:b': any;
    'b:c': {
        x: any
    };
    'a:b': any;
  }
}

<a:b></a:b>;  // is working
<b:c.x></b:c.x>;  // should fail, there is no syntax error reported, and only issue is related to incorrect type
<this:b></this:b>; // its failing but there is no syntax error reported

πŸ™ Actual behavior

Invalid syntax is not reported as such.

this:b in AST is reporter as ThisExpression, and has range of this:b

when code above is run in preserve mode, this syntax is generated

<a:b></a:b>;
<b:c.x></b:c.x>;
<this></this>;

this syntax is not allowed according to spec

<b:c.x>
JSXMemberExpression :
    JSXIdentifier . JSXIdentifier
    JSXMemberExpression . JSXIdentifier

https://github.com/facebook/jsx

πŸ™‚ Expected behavior

We should receive some sort of error or this:b should be parsed as Identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
4 participants