Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular2, file should end with a newline, and trailing space

I am new to angular2 and typescript, I got this 3 errors, I don't understand how to fix trailing whitespace and file should end with a newline.

enter image description here

like image 317
user1034127 Avatar asked Oct 19 '16 19:10

user1034127


2 Answers

The errors come from tslint which defines some rules on your project and check if your code matches the rules. You need to either fix the error or ignore/disable those rules.

file should end with a newline

You can ignore this rule on tslint.json by adding this on the rules object property

 "eofline": false

-

trailing whitespace

You can ignore this rule on tslint.json by adding this on the rules object property

 "no-trailing-whitespace": false

More about the rules: https://palantir.github.io/tslint/rules/

like image 98
Hans Tiono Avatar answered Sep 27 '22 20:09

Hans Tiono


The error is coming from your code linter.

A code linter looks for code formatting inconsistencies and throws exceptions when you violate some rules (that you can specify manually).

This means it's a formatting error on your code. Your linter is basically telling you to add an empty line at the end of the file events/event-list.component.ts. Moreover, there is a trailing whitespace somewhere in that file. There are text editor tools that can do this built-in or with a plugin, and I suggest looking for that feature on your editor. If not, you can look for online tools that strip trailing whitespace on your code.

like image 35
Jerome Indefenzo Avatar answered Sep 27 '22 21:09

Jerome Indefenzo