tillarnold/grunt-jsxhint

Linting normal .js files is really slow

Munter opened this issue · 6 comments

I'm guessing everything is run through the transformer as it is.
I have thousands of files that aren't jsx yet. Plugging in grunt-jsxhint as a drop in replacement considerably slows down my linting.

Any way to be able to tell the linter which files should be transformed and which should pass through untouched?

As of now there is no way to do this.
I could add some code that would check if the file starts with

/**
 * @jsx React.DOM
 */

and only run the file trought the transformer if this is the case.
Would that be a possible solution?

Or it could check if the file has a .jsx file extension.

We're not fans of adding that comment at the top, as our internal naming convention of keeping the .jsx extension is enough for us to determine if it needs transforming.

If there was a split code path based on the file extension that would fit our use case perfectly. I haven't been working with jsx long enough to know any other use cases yet.

ok. I will add the split code path based on the file extension.

Awesome!

I added the check for the file extension. Now only .jsx files run through the transformer. I published the package to npm.

Thanks. I'll update when I get back at work in the morning :)