Tool for checking codestyle in JSX files [closed]
Asked Answered
T

1

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>
Triquetrous answered 16/2, 2015 at 12:5 Comment(2)
jshint ? github.com/jshint/jshint/pull/1260Insulting
Also see this #17249004Insulting
M
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"

Marleen answered 16/2, 2015 at 15:46 Comment(2)
Cant set it in config file, get Error: Unsupported rules: esprima.Triquetrous
okey, first you need to install that package npm i --save-dev esprima-fbTriquetrous

© 2022 - 2024 — McMap. All rights reserved.