Closed soyjavi closed 8 years ago
CSJSX (I'm sure my acronym is wrong) is not valid CoffeeScript. It really truly is a syntax error as CoffeeLint will only parse CoffeeScript, not that hybrid-whatever.
What you can do is convert the CSX to plain CoffeeScript before CoffeeLint parses it. We have some docs on how to do this.
WARNING: CoffeeLint cannot control what these transformers do. They may violate all kinds of rules you have setup. It's up to you to wrap your code in # coffeelint: disable=max_line_length or whatever you need.
Now that you know your option on how to fix this particular error, I have a piece of advice. Just switch to ES6 and use Babel. You'll get much better support for JSX from every tool you pick up than you're ever going to get out of this JSX+CoffeeScript thing. CoffeeLint supports it through a hack that, depending on your rules, may end up producing errors that you will have no control over.
CJSX it's the syntax of React CoffeeScript files
is just coffeescript
plus jsx
syntax. I need to know which are your rules for compile React+Coffeescript
because in your documentation the only reference is use:
coffeelint.json
...
"coffeelint": {
"transforms": [ "coffee-react-transform" ]
}
There are no rules that do any compiling. CoffeeLint has no concept of CJSX whatsoever. If you use the transform it runs your file through the transformer and then lints the valid CoffeeScript that comes out the other side.
The most common problem is that you may be setting a line-length limit. When coffee-react-transform
converts the code you have no control over the line length and will start getting lint errors that you can't fix. When this happens your only option is to wrap your CJSX in # coffeelint: disable=max_line_length
comments to ignore those lines.
Double check that your file extension is .cjsx
. You will get this error if you file is saved with .coffee
.
What do the file names / columns look like in the case where .cjsx
files were transformed? Is there an example project / results for reference?
AFAIK there is no proper support for transforms in coffeelint and this feature was done more as a courtesy to users who used cjsx. So you may end up with incorrect line numbers.
Hi,
I'm trying to lint my
.cjsx
files, everything is ok withcoffee
syntax ... but with myjsx
syntax always have this error in sublime console:My syntax:
My
coffeelint.json
file is: