sindresorhus / atom-editorconfig

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

editorconfig 1.5.1 inserts string "auto" at EOF when I save #107

Closed fredrikekelund closed 7 years ago

fredrikekelund commented 7 years ago

I just updated to the 1.5.1 version, and it seems to be inserting the string "auto" before the final newline of a file whenever I save it. I'm guessing it concerns the insert_final_newline setting.

Involved .editorconfig-files

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{*.{json,md,yml,yaml},.jshintrc}]
indent_size = 2

Directory structure

.
├── .DS_Store
├── .editorconfig
├── Brocfile.js
├── Gruntfile.js
├── README.md
├── assets
│   ├── .DS_Store
│   ├── app.css.liquid
│   ├── app.js
│   ├── icon-cart--negative.svg
│   ├── icon-cart.svg
│   ├── icon-close--negative.svg
│   ├── icon-close.svg
│   ├── icon-facebook.svg
│   ├── icon-instagram.svg
│   ├── icon-menu--negative.svg
│   ├── icon-menu.svg
│   ├── icon-minus--small.svg
│   ├── icon-minus.svg
│   ├── icon-pinterest.svg
│   ├── icon-plus--small.svg
│   ├── icon-plus.svg
│   ├── icon-twitter.svg
│   ├── logo_black.png
│   ├── logo_white.png
│   └── temp
│       ├── bg_home.jpg
│       ├── collection_ikebana.jpg
│       ├── collection_july.jpg
│       ├── giftcard.jpg
│       ├── home001.jpg
│       ├── home002.jpg
│       ├── logo_white.png
│       ├── press.jpg
│       ├── special01.jpg
│       └── special02.jpg
├── config
│   ├── settings_schema.js
│   └── settings_schema.json
├── config.yml
├── layout
│   └── theme.liquid
├── package.json
├── snippets
│   ├── asset-img-srcset.liquid
│   ├── img-srcset.liquid
│   └── social-meta-tags.liquid
├── src
│   ├── .DS_Store
│   ├── img
│   │   ├── .DS_Store
│   │   ├── icon-cart--negative.svg
│   │   ├── icon-cart.svg
│   │   ├── icon-close--negative.svg
│   │   ├── icon-close.svg
│   │   ├── icon-facebook.svg
│   │   ├── icon-instagram.svg
│   │   ├── icon-menu--negative.svg
│   │   ├── icon-menu.svg
│   │   ├── icon-minus--small.svg
│   │   ├── icon-minus.svg
│   │   ├── icon-pinterest.svg
│   │   ├── icon-plus--small.svg
│   │   ├── icon-plus.svg
│   │   ├── icon-twitter.svg
│   │   ├── logo_black.png
│   │   ├── logo_white.png
│   │   └── temp
│   │       ├── bg_home.jpg
│   │       ├── collection_ikebana.jpg
│   │       ├── collection_july.jpg
│   │       ├── giftcard.jpg
│   │       ├── home001.jpg
│   │       ├── home002.jpg
│   │       ├── logo_white.png
│   │       ├── press.jpg
│   │       ├── special01.jpg
│   │       └── special02.jpg
│   ├── js
│   │   └── app.js
│   └── scss
│       ├── _grid.scss
│       ├── _utilities.scss
│       └── app.scss
├── templates
│   ├── blog.liquid
│   ├── cart.liquid
│   ├── collection.liquid
│   ├── customers
│   │   ├── login.liquid
│   │   └── register.liquid
│   ├── index.liquid
│   ├── list-collections.liquid
│   ├── page.collection1.liquid
│   ├── page.collection2.liquid
│   ├── page.collection3.liquid
│   ├── page.collection4.liquid
│   ├── page.collection5.liquid
│   ├── page.collections.liquid
│   ├── page.contact.liquid
│   ├── page.liquid
│   └── product.liquid

Installed packages

Built-in Atom Packages (89)
├── atom-dark-syntax@0.27.0
├── atom-dark-ui@0.52.0
├── atom-light-syntax@0.28.0
├── atom-light-ui@0.44.0
├── base16-tomorrow-dark-theme@1.2.0
├── base16-tomorrow-light-theme@1.2.0
├── one-dark-ui@1.6.0
├── one-light-ui@1.6.0
├── one-dark-syntax@1.3.0
├── one-light-syntax@1.3.0
├── solarized-dark-syntax@1.0.2
├── solarized-light-syntax@1.0.2
├── about@1.7.0
├── archive-view@0.61.1
├── autocomplete-atom-api@0.10.0
├── autocomplete-css@0.11.2
├── autocomplete-html@0.7.2
├── autocomplete-plus@2.31.1
├── autocomplete-snippets@1.11.0
├── autoflow@0.27.0
├── autosave@0.23.1
├── background-tips@0.26.1
├── bookmarks@0.42.0
├── bracket-matcher@0.82.1
├── command-palette@0.38.0
├── deprecation-cop@0.54.1
├── dev-live-reload@0.47.0
├── encoding-selector@0.22.0
├── exception-reporting@0.40.0
├── find-and-replace@0.201.1
├── fuzzy-finder@1.4.0
├── git-diff@1.1.0
├── go-to-line@0.31.0
├── grammar-selector@0.48.2
├── image-view@0.59.0
├── incompatible-packages@0.26.1
├── keybinding-resolver@0.35.0
├── line-ending-selector@0.5.0
├── link@0.31.1
├── markdown-preview@0.158.0
├── metrics@1.0.0
├── notifications@0.65.1
├── open-on-github@1.2.0
├── package-generator@1.0.0
├── settings-view@0.242.2-hotfix1
├── snippets@1.0.2
├── spell-check@0.68.2
├── status-bar@1.4.1
├── styleguide@0.47.0
├── symbols-view@0.113.1
├── tabs@0.101.0
├── timecop@0.33.2
├── tree-view@0.209.3
├── update-package-dependencies@0.10.0
├── welcome@0.35.1
├── whitespace@0.33.0
├── wrap-guide@0.38.2
├── language-c@0.52.1
├── language-clojure@0.21.0
├── language-coffee-script@0.47.2
├── language-csharp@0.12.1
├── language-css@0.37.1
├── language-gfm@0.88.0
├── language-git@0.15.0
├── language-go@0.42.1
├── language-html@0.45.1
├── language-hyperlink@0.16.0
├── language-java@0.23.0
├── language-javascript@0.119.0
├── language-json@0.18.2
├── language-less@0.29.5
├── language-make@0.22.2
├── language-mustache@0.13.0
├── language-objective-c@0.15.1
├── language-perl@0.35.0
├── language-php@0.37.2
├── language-property-list@0.8.0
├── language-python@0.45.0
├── language-ruby@0.69.0
├── language-ruby-on-rails@0.25.0
├── language-sass@0.56.0
├── language-shellscript@0.22.4
├── language-source@0.9.0
├── language-sql@0.23.0
├── language-text@0.7.1
├── language-todo@0.28.0
├── language-toml@0.18.0
├── language-xml@0.34.9
└── language-yaml@0.26.0

Community Packages (24) /Users/Fredrik/.atom/packages
├── autoupdate-packages@1.3.1
├── color-picker@2.2.2
├── docblockr@0.8.7
├── editorconfig@1.5.1
├── emmet@2.4.3
├── file-icons@1.7.22
├── git-plus@5.18.0
├── hard-wrap@1.1.0
├── language-chef@0.9.0
├── language-ejs@0.4.0
├── language-jade@0.7.2
├── language-liquid@0.5.1
├── language-nginx@0.6.2
├── language-puppet@0.21.0
├── language-twig@1.6.3
├── lines@0.13.1
├── linter@1.11.18
├── linter-jshint@3.0.1
├── linter-jsonlint@1.3.0
├── linter-php@1.3.1
├── minimap@4.25.4
├── pigments@0.37.0
├── project-plus@0.9.0
└── remote-edit2@3.0.0

└── (empty)
florianb commented 7 years ago

@fredrikekelund - thank you for reporting and sorry for these inconvenience! Just to be sure, in which files does this happen?

fredrikekelund commented 7 years ago

In both a PHP and a JS file, the problem went away after disabling the editorconfig plugin and restarting the editor. If I re-enabled the plugin and restarted again, the problem came back

florianb commented 7 years ago

I am really sorry - i prepare a patch. :(

fredrikekelund commented 7 years ago

Don't worry, looks like I happened to update just a few minutes after the latest release, so I don't think that many people will be affected :)

florianb commented 7 years ago

Oh no - it is always a nightmare.. 🙀

As a quick solution, try to explicitly define f.e. end_of_line = lf -- this seems only to happen if no eol is set.

fredrikekelund commented 7 years ago

@florianb yup, that did the trick!

florianb commented 7 years ago

@fredrikekelund - i released a patch, everything* should now work as expect.

Thank you very much for your fast response! Please tell me if this works for you, i would then close that issue.

*) Except from preventing Atom saving multiple newlines at the end of a file. But thats not that urgent, i will prepare a patch for that now.

fredrikekelund commented 7 years ago

@florianb I removed the end_of_line = lf, tested the new version (after a restart of the editor), and it seems to work as expected now :+1:

Same to you, happy you were able to resolve the issue so quickly!