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) bug with parsing closing tags

See original GitHub issue

Here’s the code snippet that doesn’t get highlighted at all:

import React, { Component, PropTypes } from 'react';
import Todo from './Todo';

export default class TodoList extends Component {
  render() {
    return (
      <ul>
        {this.props.todos.map((todo, index) =>
          <Todo {...todo}
                key={index}
                onClick={() => this.props.onTodoClick(index)} />
        )}
      </ul>
    );
  }
}

TodoList.propTypes = {
  onTodoClick: PropTypes.func.isRequired,
  todos: PropTypes.arrayOf(PropTypes.shape({
    text: PropTypes.string.isRequired,
    completed: PropTypes.bool.isRequired
  }).isRequired).isRequired
};

I can reproduce this with 8.8.0. Removing the JSX part makes the highlighting work again.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:11
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

59reactions
adrianmclicommented, Feb 25, 2017

It’s 2017, is JSX support still not here?

8reactions
leebensoncommented, Jun 7, 2017

Still not working, using the default highlight.js plugin inside a Gitbook:

screen shot 2017-06-07 at 12 41 49

Switching to Prism fixes it:

screen shot 2017-06-07 at 12 47 13
Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing error: Expected corresponding JSX closing tag for ...
I faced strange bug in vscode...I'm creating an app with react.js.When I write code in js file , the tages are written correctly...
Read more >
дэн al Twitter: "Finally, fixing Redux docs to use Prism instead of ...
(jsx) bug with parsing closing tags · Issue #931 · highlightjs/highlight.js. Here's the code snippet that doesn't get highlighted at all: import React, ......
Read more >
JSX Self-closing tag not rendering - Codecademy Forums
In the exercise Animal Fun Fact I noticed that using a self-closing h1 does not render the text in the browser. While normal...
Read more >
ValidateJavaScript - Online Tool to Find & Fix JavaScript Errors
... will automatically find basic errors and help prevent potentially destructive bugs in JavaScript & JSX (React.js) code. ... jsx-closing-tag-location
Read more >
VS Code: You don't need that extension - Rob O'Leary
JavaScript: Auto Closing Tags : "Enable/disable automatic closing of JSX tags. Requires using TypeScript 3.0 or newer in workspace".
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