question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX namespaced attribute syntax not supported

See original GitHub issue

TypeScript Version:

1.8.2

Background:

I have been working on trying to get https://github.com/eslint/typescript-eslint-parser, a TypeScript parser plugin for ESLint, off the ground, and the job this weekend has been to begin adding JSX support.

ESLint uses espree and so the aim of the project is to convert the output of the tsc to an AST which espree expects. We already have a solid suite of JSX tests to develop against (taken from the espree project itself), but I have come up against a tsc error in one of them so far.

My issue is that it seems currently the tsc does not accept this “namespaced attribute” JSX syntax:

Code

<a n:foo="bar"> {value} <b><c /></b></a>;

Expected behavior: Please note the AST produced by espree (see in particular the tokens array): http://astexplorer.net/#/B46lew7I59

Actual behavior: …compared to the one produced by the tsc (note the issues found in parseDiagnostics): http://astexplorer.net/#/G5L3CptVNq

Removing the n: from n:foo resolves the parsing issues.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

15reactions
nickmessingcommented, Jan 11, 2019

@RyanCavanaugh Vue JSX uses namespace for directive arguments, any chance TypeScript could support it? https://github.com/vuejs/jsx#directives

7reactions
snowyucommented, Apr 22, 2019

I also hope a universal solution to embed different template, such as like markdown.

return (```pug
svg
   use(xlink:href="....")
```)


return ```xhtml
<svg><use xlink:href="..."/></svg>
```
Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: unknown: Namespace tags are not supported by ...
I get the following error when trying to download svg as a React Component. SyntaxError: unknown: Namespace tags are not supported by default....
Read more >
Rendering Namespace Tags/Attributes Like xmlns:inkscape In ...
In this article we are going to see that how you can render some attributes that react does not support(throws error if you...
Read more >
Using React for XML & SVG - ITNEXT
SitemapXMLRoot.jsModule build failed: SyntaxError: Namespace tags are not supported. ReactJSX is not XML.> 181 | <image:image>
Read more >
Element.removeAttributeNS() - Web APIs - MDN Web Docs
The removeAttributeNS() method of the Element interface removes the specified attribute from an element. Syntax. removeAttributeNS(namespace, ...
Read more >
API - esbuild
Supported by: Build ... By default esbuild will not bundle the input files. ... It assumes the environment supports import and export syntax....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found