"The Yeoman generator is not using indent_size from .editorconfig and doesn't give the abbility to set it."
On BBB-generator, we parse the code we output in a "beautifier" to update indent to the desired length. We plan on extending this eventually to give full style guide choices.
Maybe that's something Yeoman generator could think on adding in the default stack ? (Because really, I wouldn't use a generator who don't support my style guide)
@SBoudrias ++1 for your proposal
The fact is I actively use several beautifiers to clean content after the yeoman engine templates the content (it leaves a lot of linefeeds on <% if (...) %> conditions for example)
I guess the current PR #280, is a first try to implement this.
Maybe the solution is just to harden this PR, and this feature would be available, what do you think of it @SBoudrias ?
That's a very interesting proposal @SBoudrias. So far we've been favoring editorconfig + code style comments during reviews but maybe trying out a beautifier path could save us time. Wdyt about this, @passy @sindresorhus @stephenplusplus?
@SBoudrias How has your experience with js-beautifier been so far? I tried esformatter again a few days back and was kind of disappointed.
I generally like this idea a lot.
On my side, js-beautifier been quite OK since 1.4 (plus it bundle an HTML and a CSS beautifier).
It supports a lot of options, but I'm not sure about the extent of the support for more complete style guide.
Although, just normalizing the whitespace is already a huge improvement on how well your generator can be used. Maybe Yeoman could implement a helper functions to normalize the output - I'd be glad to send a PR with this and linking with the .editorconfig.
I've changed the .editorconfig files at both the module level in .nvm and in generated project folders and still my indentation preferences get ignored. What part of yeoman reads .editorconfig files? I don't see any reference to them in my generated Gruntfiles. How are the preferences implimented?
Not implemented yet - and I don't think there's plan to have this as a part of the core soon.
New file utility landed though, so you could work a filter reading .editotfilters and applying style preference on file write. Feel free to develop a module to include or send us a PR!
As it stands, I'm having to compile any coffeescript files to JS, then back to correctly-formatted coffeescript with grunt-js2coffee every time I use a generator. :( Is this the best solution for now, or is there some other way I'm unaware of?
Well, this can be manually implemented in a generator. For example, we did it in Generator-BBB, and we have a WIP branch using the new file utility to simplify this process (and accessory generate coffee files on demand).
So, I'd recommend you to send a PR to your favorite generator implementing this. It shouldn't be to hard to copy what we did over Generator-BBB.
Language-agnostic code beautification is a lot harder than it sounds. I'm current working on a project based off of EditorConfig called ECLint. It's actually supposed to do more than just linting. You can read the project readme for more info. Expect an EditorConfig Grunt plugin (and Gulp.js) down the line, but it's going to be a while out.
BTW, it'd be a LOT easier for such an indentation replacement tool to work if the leading indentation were in tabs and spaces afterwards for alignment. This way, single tabs could be either left alone or replaced with however many spaces you desire for indentation.
I'm still a tab lover, myself, and I have very specific reasons for it. It's the only way you can distinguish between what is indentation and what is alignment. It's also the only way people can adjust their IDE to be however they decide is most readable without actually changing the indent characters in the document.
The idea is tabs for indentation and spaces for code alignment!
Has this issued been resolved? I was directed here from http://stackoverflow.com/questions/24733247/yeoman-ember-generator-how-to-get-4-spaces-per-indent-in-generated-codes/ where I asked to change 2 spaces of generated codes to 4 spaces.
Not yet, there's architecture in place to allow it. We just need someone to actually make it happen.
@SBoudrias Is there already a PR you proposed in #139 around or still waiting for the one to make it happen? Thanks.
No PR currently, waiting for 0.18 to be release as we're working on a new file system.
Let's make things clear:
So far, generator can NOT customize tab/space and size for text indent before building a scaffold, right?
@AndreLion check #699