schorfES / node-lintspaces

A validator for checking different kinds of whitespaces in your files.
https://npmjs.com/package/lintspaces
MIT License
30 stars 17 forks source link

Behavior for `insert_final_newline = true` is inverted. #31

Closed localjo closed 8 years ago

localjo commented 8 years ago

In an .editorconfig file when insert_final_newline = true, it means that files should end with a blank new line. The lintspaces implementation works in reverse. When I set insert_final_newline = true in my .editorconfig file, lintspaces complains about all of my files ending with newlines, but that's actually what I want, and I'd like to be able to get an error/warning if a file is missing that newline. From the EditorConfig docs;

insert_final_newline: set to true ensure file ends with a newline when saving and false to ensure it doesn't.

schorfES commented 8 years ago

Do you use the lintspaces "core"-api directly or in a grunt or gulp plugin?

Can you checkout the master of node-lintspaces and run the tests using grunt test because there are tests for newline feature and tests for editorconfig feature which currently didn't fail.

localjo commented 8 years ago

I'm using gulp-lintspaces, which uses node-lintspaces directly to parse and apply the linting settings. I'll dig into the code and see if I can pinpoint where the problem is originating.

schorfES commented 8 years ago

It may belongs to your configuration in the .editorconfig

localjo commented 8 years ago

Turns out the issue was that my editor appends an implicit newline to the end of all of my files, so when I was saving them with a manual newline, they ended up having two newlines. EPEBKAC!