sapegin / mrm

Codemods for your project config files
https://mrm.js.org/
MIT License
1.61k stars 77 forks source link

New line being removed #19

Closed okonet closed 6 years ago

okonet commented 7 years ago

When running tasks I noticed that often they also remove the new line /n at the end which is required by my .editorconfig.

2017-09-05 at 10 04

sapegin commented 7 years ago

That would be hard to fix I’m afraid. Any ideas what to do? Should we read .editorconfig and respect it? That would be super cool ;-)

sapegin commented 7 years ago

I think we can extend mrm-core modules to respect .editorconfig on save. We can use editorconfig-core-js for that I think. And then apply indentation and new line at the end settings.

okonet commented 7 years ago

I was thinking of not modifying the whole file unless needed. But your solution might work as well.

sapegin commented 7 years ago

This would be way to complex and would require a whole rewrite ;-)

I think it’s OK (and even good) if Mrm will reformat the whole file according to EditorConfig rules.

okonet commented 7 years ago

Yeah, probably you're right.

One related issue I had was that mrm has completely reformatted my .gitignore file as well. I wouldn't expect that TBH.

sapegin commented 7 years ago

Could you show me the diff?

okonet commented 7 years ago

https://github.com/okonet/lint-staged/pull/256/files#diff-a084b794bc0759e7a6b77810e01874f2

sapegin commented 7 years ago

Yeah, that wasn’t a good idea to remove empty lines ;-? Could you open a separate issue for that? I’m not sure what would be the best approach here.

okonet commented 7 years ago

Done: https://github.com/sapegin/mrm/issues/20

sapegin commented 6 years ago

This may be usefult: eclint.

sapegin commented 6 years ago

Nope, it has absolutely crazy API and no docs how to use it:

https://github.com/jedmao/eclint/blob/941b176c65aa1affc1b4a6a48cf95c3181021488/lib/eclint.spec.ts#L19-L35

sapegin commented 6 years ago

PR is here: https://github.com/sapegin/mrm-core/pull/9 ;-)

sapegin commented 6 years ago

Done in mrm-core 2.4.0.