sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

Prettier Standard doesn't add spaces before params #26

Closed matiasleidemer closed 7 years ago

matiasleidemer commented 7 years ago

First of all, thank you for all for your hard work on prettier-standard! It's awesome. Now, I'm not sure how to point this out, so that's why I'm opening this issue.

I was trying to add the lib to a project here, and everything went fine until I noticed that it wasn't adding spaces before the param list:

function foo(a) { console.log(a) }
// instead of
function foo (a) { console.log(a) }

At first, I thought it was something related to Flow (the file in question is annotated), but I was wrong. Digging deeper I was finally able to fix the issue. So, in my project I had eslint-config-standard@5.3.5. After updating it to its latest version, we problem was gone. Actually, updating to 6.0.0 fixed the problem as well.

I wanted to open a PR here to update the dependency version, but then I realized prettier-standard doesn't depend on eslint-config-standard. I was taking a look at the diff between 5.3.5 and 6.0.0, and I believe it is something related to this line, but I'm not sure.

Maybe there was some crazy problem in my project itself, and updating eslint-config-standard made it go away. Still, I just wanted to share this here; case others face the same issue. Later today I will try to reproduce this on a brand new project to confirm if the problem happens.

Thanks!

matiasleidemer commented 7 years ago

I guess found the culprit.

Turns out the project was using eslint@2.13.1, and somehow it wasn't adding the spaces I mentioned. I'm somewhat new to JS dependencies and etc, but in my mind npm should complain about the mismatch between prettier-standard and my local project.

Anyway, this is not a bug at all, just an inconvenient dependency mess-up. Sorry all the noise 😬