0

Whenever I try to deploy my firebase cloud functions, it considers poor formatting as a real error and doesn't let me proceed. For example:

error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

Could someone tell me how to prevent this and let me deploy my code regardless of its formatting? Thanks

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • That error indicates you function contains invalid characters. LF is a character, CRLF is 'two characters'. To correct, you would need to replace the CRLF's with just a LF. Did you copy from another source and paste your cloud function code? – Jay Mar 29 '21 at 17:19
  • No this is my code, but this is a minor error, it always gives me issues saying "indentation of 6 spaces was expected but found 8" or stuff like that. How can I prevent it from considering that as an error and not letting me proceed? – Aaryaman Maheshwari Mar 30 '21 at 02:59
  • That's pretty vague so it's hard to understand what's going on. What is 'it'? What specifically is giving errors? – Jay Mar 30 '21 at 17:10
  • the problem is that it considers indentation and non-eslint complaint issues as "errors" and prevents me from deploying my functions. I have noticed a .eslintrc file in the cloud functions directory, maybe there's some way to modify that file in order to prevent these kinds of "errors" – Aaryaman Maheshwari Mar 31 '21 at 08:44
  • We don't know what "it" is or how you're "formatting" the function so the question and the problem are unclear. Perhaps taking a look at a couple of example functions in the documentation [Add the addMessage() function](https://firebase.google.com/docs/functions/get-started?authuser=0#add-the-addmessage-function) would help you understand how they should look? – Jay Mar 31 '21 at 15:16

2 Answers2

0

As I saw you mention in the comments, there is a previous iteration of this issue.

You can see there that you have to configure your linebreak-style in your .eslintrc or in your source code. You can also follow the approach of the second answer and ignore the linebreak-rules to avoid this warnings/errors from happening.

For further information, refer to the documentation.

Roger
  • 158
  • 8
0

Get the same error when I try to deploy codes written in Mac.

I tried this solution and it worked:

git config core.autocrlf false
git rm --cached -r .
git reset --hard

Note - Make sure you don't have any un-committed changes else it will be deleted!

Source - https://stackoverflow.com/a/59660083

KevinD
  • 53
  • 5