sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
811 stars 80 forks source link

Trimming trailing whitespace #118

Closed scttcper closed 7 years ago

scttcper commented 7 years ago

Whitespace is being removed one line per save. You can see eslint reacting to the saves. I'm on 1.7.0. The gif has a bunch of extra time at the end that I forgot to trim. saving

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

My file looks like this, with a bunch of garbage whitespace.

module.exports = [
  { 
    name: 'BPM',  
    id: 'thebeat'  
  }, 
  {  
    name: 'Electric Area', 
    id: 'area33'
  },
];
scttcper commented 7 years ago

for some reason it isn't happening anymore after i've restarted my computer.

scttcper commented 7 years ago

With the whitespace package enabled its fine with only atom-editorconfig i'm still getting the issue.

florianb commented 7 years ago

Hey @scttcper - thank you for reporting that issue. Am i getting this right? You're saving the file and the no-trailing-spaces messages appear all at once (this is because eslint seems to lint on save) and then disappear line per line, in a frequency of 1 messages per second?

I got it wrong in first place. Only one line is affected by trim trailing whitespace per save.

florianb commented 7 years ago

Hey @scttcper -- nothing more to do. I am able to reproduce that!

florianb commented 7 years ago

@scttcper -- the patch is flying. Please give me a hint if this embarrassing :bug: is 🔨 ed with the quadruple 🎶 of the tabbed 🎼 .

scttcper commented 7 years ago

Stay gold, 🦄

florianb commented 7 years ago

Yey... 👏 Thanks again @scttcper

zauni commented 7 years ago

Unfortunately in v2.0.2 I have the same problem...

My editorconfig:

root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
end_of_line = LF
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[package.json]
indent_size = 2

I attached two screenshots, one before I hit save, and one after I hit save. Per save just one line gets trimmed. I have disabled the whitespace package from Atom.

Can you reproduce this? Would love to help :)

editorconfig-screen1 editorconfig-screen2

florianb commented 7 years ago

@zauni -- thank you very much for reporting this! I am able to reproduce it.

florianb commented 7 years ago

Hey @zauni - i recently released a patch, i would appreciate if you could confirm that this solves the issue.

I am really sorry for any inconveniences and very thankful for your support! 🎁

zauni commented 7 years ago

Thank you very much @florianb That was really a speedy response and resolution 👍 Works like a charm now.