Rahul Ravindran
Rahul Ravindran

Reputation: 318

How to keep OS specific configuration for eslint

I currently work in a team which uses atom as the editor of choice but split between windows and OSX. Our .eslintrc.js reports the linebreak-style as an issue on windows(Expect line ending to be LF but found CRLF) but works fine on OSX. Is there a way to specify to eslint that only check this rule while on OSX

Upvotes: 0

Views: 640

Answers (1)

Ignacio
Ignacio

Reputation: 688

The purpose of having this rule enabled is to unify the line endings along all the OS and editors. Probably your coworkers that are using Windows have not configured LF (OSX, Linux) line endings in their editors, and have instead CRLF (Windows). This is normally configurable in most editors.

If you want to allow different line endings on Windows, I think the best option is to configure your version control to unify it on commit, like indicated in this post, i.e. text eol=lf in your project's .gitattributes.

Otherwise, as per the comments, a good solution is to create a end_of_line = lf in a .editorconfig file.

Upvotes: 2

Related Questions