Getting Facebook's react.js library JSX syntax to play nicely with jslint?

前端 未结 7 1386
死守一世寂寞
死守一世寂寞 2021-01-30 05:19

I am playing around with the Facebook\'s react.js library. I am trying to use their JSX syntax which describes creating a view in the following way.

/** @jsx Rea         


        
7条回答
  •  执笔经年
    2021-01-30 05:51

    (Update: This post is from 2013 and obsolete now.)

    I use JSHint + JSX.

    It shouldn't require a fork of JSHint, there should be a way to tell JSHint to disable all warnings for a block of code. Unfortunately there is no such way to disable all warnings, only a specific set of warnings, so I may end up submitting a pull request to add this, or change linters.

    Update: We submitted a pull request which was accepted. To disable all warnings, add /*jshint ignore: start */ to start the section, and /*jshint ignore: end */ to end it.

    As you noted, the workflow Facebook and Instagram use is to lint outside the IDE from the command line.

    Your other option is to extract all your JSX templates into their own files, and make them a function of scope instead of existing inside an implicit lexical scope. We tried it out and didn't like the amount of boilerplate.

    (Note: I am not affiliated with the React team.)

提交回复
热议问题