Why doesn't CoffeeScript pass JSHint compile?

I use examples from the CoffeeScript Home Page and do not check.

for loop one of them is a great example, if you use the coffeescript operator, it does not wrap the body in if .

  • Expected '{' and instead sees a "child".
  • Possible severe violation.
  • The constructor name must begin with an uppercase letter.
  • 'insertclassnamehere' is already defined.
  • Would you like to return a conditional expression instead of an assignment?
  • Expected '===' and instead saw '=='.
  • Unexpected '~'.
  • Expected '! == 'and instead saw'! = '.
  • The body of a for in must be wrapped in an if statement to filter out unwanted properties from the prototype.
+4
source share
1 answer

My compiled CoffeeScript will not be checked in JShint .. why?

Short answer: because the creators of the CoffeeScript compiler did not find it necessary.

It makes sense to encode code that is written and maintained by developers. This avoids human error by making the code readable.

The code generated by the compiler, on the other hand, has completely different requirements. Readability is usually not a concern. More importantly, the code should be efficient and small.

If you really want this, you need to change the source of the CoffeeScript compiler.

+8
source

Source: https://habr.com/ru/post/1437326/


All Articles