ESLint: Expected linebreaks to be ‘LF’ but found ‘CRLF’.(linebreak-style)

eslint報錯解決方式:
ESLint: Expected linebreaks to be ‘LF’ but found ‘CRLF’.(linebreak-style)

編輯器如果這邊是CRLF就會每一行都有紅波浪

開始研究怎麼解決

在打開專案的時候會看到編輯器會跑這些

在IDE可以設定Code Style,注意有一個Enable EditorConfig support,點了它會蓋掉IDE的設定(如果有檔案的話)

EditorConfig是什麼咚咚?
EditorConfig官網
簡單來說就是『叫編輯器聽我的話!』這樣的檔案


另外研究了這篇
Git for Windows: Line Endings
懶人包:增加.gitattributes這個檔案就好

參考文章:
Prettier – End of Line
enforce consistent linebreak style (linebreak-style)
Disallow mixing CRLF and LF linebreaks (linebreak-style)
Why should I use core.autocrlf=true in Git?
Windows下前端开发使用prettier保证以LF结尾
Git – gitattributes Documentation

另一個eslint
ESLint: Delete (prettier/prettier)

參考這裡:
Using this rule with version control systems