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

VjeuxTYRONEMICHAEL提出了一个问题:Getting Facebook's react.js library JSX syntax to play nicely with jslint?,或许与您遇到的问题类似。

回答者Dustin Getz给出了该问题的处理方式:

(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.

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.

(I am not affiliated with the React team)

希望本文对你有帮助,欢迎支持JavaScript中文网