tillarnold/grunt-jsxhint

Ignore transformed JSX -> JS code

Opened this issue · 3 comments

If you have a case where say you have your linter looking for single quotes and after your .jsx file is processed and through processing gets strings surrounded by single quotes the linter will fail. But really you don't care if the transformed code passes linting. Just the original code. Is there a way to just ignore the transformed code while linting?

You could use jshint comments around the jsx tags.

/*jshint -W109*/
React.render(<HelloMessage name="John" />, mountNode);
/*jshint +W109*/

-W109 will ignore the error about single quotes.

You could also use jshint ignore

/* jshint ignore:start */
React.render(<HelloMessage name="John" />, mountNode);
/* jshint ignore:end */

This will ignore all errors in the jsx tag.

Sorry for my late answer.

True, but marking your jsx files is tedious and muddles up the code. Definitely something that could be automated.