react-mindmap icon indicating copy to clipboard operation
react-mindmap copied to clipboard

"error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style" when running on Windows

Open kwahsog opened this issue 6 years ago • 0 comments

The testing examples describes running:

git clone https://github.com/learn-anything/react-mindmap cd react-mindmap npm install && npm run test

This fails on Windows (tested on Win10) with the same error in various JS files when using 'npm run test':

C:...\react-mindmap\src\utils\subnodesToHTML.js 1:50 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style 2:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style 3:3 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

Solutions discussed in Stackoverflow:

https://stackoverflow.com/questions/39114446/how-can-i-write-a-eslint-rule-for-linebreak-style-changing-depending-on-windo/

Personally, I resolved by changing .eslintrc.js to:

rules: { 'react/jsx-uses-vars': 'error', 'react/jsx-uses-react': 'error', "linebreak-style": 0 },

This just ignores line endings which I assume would be appriopriate for all OSs?

kwahsog avatar Mar 27 '18 16:03 kwahsog