humphd/bridge-troll

Linebreak errors with eslint

Owen-Mak opened this issue · 7 comments

I ran eslint in Windows and it generated a list of errors regarding line-break style. (see screenshot below).

image

Steps to reproduce:

  1. run npm run eslint

Expected result:
No errors reported, but possible warnings.

Possible fix:
Following some research, I think the cause of the issue is from .eslintrc.yml . For windows users, we need to change the linebreak style from unix to windows.

I could not find any environment variables for eslint to detect the current operating system, which would allow users to run a separate set of rules for different OS.

Node version: 8.9.4
OS: Windows 7

try running npm run prettier and it will fix it. Then change your editor to use LF for these files.

I also wonder if we should remove the LF eslint error, since Prettier will just fix them?

I tried npm run prettier and got the following error:

image

I have attached the error log in to this message since I am not sure the cause.

2018-03-15T22_46_23_044Z-debug.log

@Owen-Mak, can you please try changing the package.json file line 9 and 10 to this (uses \" and \" around the file glob pattern:

    "prettier": "prettier --single-quote --write \"{tools,src,test}/**/*.{js,css}\"",

See https://stackoverflow.com/questions/48078281/run-prettier-on-windows. If that works, can you please send a Pull Request with the change?

The fix worked for windows and the prettier commands now work.
It is filed under PR#12

However, after running npm run prettier successfully, the issues still remains when I run npm run eslint.
image

@Owen-Mak can you look at https://help.github.com/articles/dealing-with-line-endings/#platform-windows and make sure you have git's line endings configured properly?

You can do git checkout -- tools/csv2json.js if you need to reset that.

Fixed by #15.

@Owen-Mak a tip for you: when you make pull requests, use a description message like this: Fix #7: ... and GitHub will automatically close the issue #7 when that PR is merged.