Skip to content

Commit

Permalink
Fixes @jsx pragma detection + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiopro committed Nov 17, 2015
1 parent d2e07cf commit 6d1a6df
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-react-jsx/src/index.js
@@ -1,5 +1,5 @@
export default function ({ types: t }) {
let JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/;
let JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;

let visitor = require("babel-helper-builder-react-jsx")({
pre(state) {
Expand Down
@@ -0,0 +1,10 @@
/**
* @jsx React.DOM
*/

<Foo></Foo>;

var profile = <div>
<img src="avatar.png" className="profile" />
<h3>{[user.firstName, user.lastName].join(" ")}</h3>
</div>;
@@ -0,0 +1,3 @@
{
"throws": "The @jsx React.DOM pragma has been deprecated as of React 0.12"
}
@@ -0,0 +1,8 @@
/* @jsx React.DOM */

<Foo></Foo>;

var profile = <div>
<img src="avatar.png" className="profile" />
<h3>{[user.firstName, user.lastName].join(" ")}</h3>
</div>;
@@ -0,0 +1,3 @@
{
"throws": "The @jsx React.DOM pragma has been deprecated as of React 0.12"
}
@@ -0,0 +1,8 @@
// @jsx React.DOM

<Foo></Foo>;

var profile = <div>
<img src="avatar.png" className="profile" />
<h3>{[user.firstName, user.lastName].join(" ")}</h3>
</div>;
@@ -0,0 +1,3 @@
{
"throws": "The @jsx React.DOM pragma has been deprecated as of React 0.12"
}
@@ -0,0 +1,8 @@
/** @jsx React.DOM */

<Foo></Foo>;

var profile = <div>
<img src="avatar.png" className="profile" />
<h3>{[user.firstName, user.lastName].join(" ")}</h3>
</div>;
@@ -0,0 +1,3 @@
{
"throws": "The @jsx React.DOM pragma has been deprecated as of React 0.12"
}

0 comments on commit 6d1a6df

Please sign in to comment.