Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool for checking codestyle in JSX files [closed]

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>
like image 525
Alexey B. Avatar asked Feb 16 '15 12:02

Alexey B.


1 Answers

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"

like image 120
niba Avatar answered Oct 17 '22 10:10

niba