[Pkg-javascript-commits] [node-acorn-jsx] 447/484: Add a descriptive error message for two adjacent JSX tags - fixes babel/babel#1682, fixes #19
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:21:09 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit b1748633704b1cb8cb06b3ac695da6a9743c3e0f
Author: Sebastian McKenzie <sebmck at gmail.com>
Date: Sun Jun 7 20:26:22 2015 +0100
Add a descriptive error message for two adjacent JSX tags - fixes babel/babel#1682, fixes #19
---
inject.js | 3 +++
test/tests-jsx.js | 3 +++
2 files changed, 6 insertions(+)
diff --git a/inject.js b/inject.js
index af51997..92fdd2a 100644
--- a/inject.js
+++ b/inject.js
@@ -602,6 +602,9 @@ module.exports = function(acorn) {
node.openingElement = openingElement;
node.closingElement = closingElement;
node.children = children;
+ if (this.type === tt.relational && this.value === "<") {
+ this.raise(this.pos, "Adjacent JSX elements must be wrapped in an enclosing tag");
+ }
return this.finishNode(node, 'JSXElement');
};
diff --git a/test/tests-jsx.js b/test/tests-jsx.js
index def8d98..5851ea1 100644
--- a/test/tests-jsx.js
+++ b/test/tests-jsx.js
@@ -3633,8 +3633,11 @@ var fbTestFixture = {
if (typeof exports !== "undefined") {
var test = require("./driver.js").test;
+ var testFail = require("./driver.js").testFail;
}
+testFail("var x = <div>one</div><div>two</div>;", "Adjacent JSX elements must be wrapped in an enclosing tag (1:23)");
+
for (var ns in fbTestFixture) {
ns = fbTestFixture[ns];
for (var code in ns) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list