0

I just set up coffeelint on Atom. I was getting plenty of warnings like this one:

if HelpersValidators.isNotEmpty(email) and HelpersValidators.isNotEmpty(password) and HelpersValidators.isEmail(email) and HelpersValidators.areValidPasswords(password, passwordConfirm)
   ...

=> Line exceeds maximum allowed length

So what I did is:

if HelpersValidators.isNotEmpty(email)
  and HelpersValidators.isNotEmpty(password)
  and HelpersValidators.isEmail(email)
  and HelpersValidators.areValidPasswords(password, passwordConfirm)

But now, I'm getting the following error and I can't resolve it.

=> SyntaxError: unexpected LOGIC

So how can I structure this condition to make it appear on several lines?

1 Answer 1

1

You can't start new line with logic operator in CoffeeScript, so you should fold the line afret and operator, not before it:

if HelpersValidators.isNotEmpty(email) and
   HelpersValidators.isNotEmpty(password) and
   HelpersValidators.isEmail(email) and
   HelpersValidators.areValidPasswords(password, passwordConfirm)
  // do something

or

if HelpersValidators.isNotEmpty(email) and
  HelpersValidators.isNotEmpty(password) and
  HelpersValidators.isEmail(email) and
  HelpersValidators.areValidPasswords(password, passwordConfirm)
    // do something
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.