How to keep OS specific configuration for eslint

家住魔仙堡 提交于 2019-12-11 17:00:04

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/45627360/how-to-keep-os-specific-configuration-for-eslint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!