5

There are exists many beautiful code formatting tools for vanilla Javascript. For example, JSCS. Is there any tool that can validate and format reactjs templates?

I have got error like that one at this moment

Unexpected token < at static/view/Auth.jsx :
    34 |
    35 |  return (
    36 |      <div className="auth-page"></div>
Alexey B.
  • 11,965
  • 2
  • 49
  • 73
  • 1
    jshint ? https://github.com/jshint/jshint/pull/1260 – Alex Feb 16 '15 at 12:09
  • 1
    Also see this http://stackoverflow.com/questions/17248504/getting-facebooks-react-js-library-jsx-syntax-to-play-nicely-with-jslint – Alex Feb 16 '15 at 12:10

1 Answers1

7

JSCS can be used with React. You have to add flag --esprima=esprima-fb to make it compatible with jsx syntax.

If you're starting your JSCS from cmd: jscs path[ path[...]] --esprima=esprima-fb

If you have a .jscrsc config file add "esprima" : "esprima-fb"

niba
  • 2,821
  • 1
  • 19
  • 23