magpie-ea / magpie-modules

the reusable front-end bits in the _magpie modules
MIT License
7 stars 1 forks source link

Code format standard? #46

Open x-ji opened 6 years ago

x-ji commented 6 years ago

Currently there seem to be some discrepancies in the code format, and every time I try to save a JS file some lines' indentations might be changed. It might help to have a consistent format standard, e.g. using a .eslintrc file: https://eslint.org/docs/rules/indent

stelaseldano commented 6 years ago

We can use EditorConfig for consistent styling https://editorconfig.org/

michael-franke commented 6 years ago

I have no opinion on the matter and will happily adopt any solution that you consider best. (Ideally one that let’s me use Emacs.)

On 6. Sep 2018, at 10:02 , stelaseldano notifications@github.com wrote:

We can use EditorConfig for consistent styling https://editorconfig.org/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

stelaseldano commented 6 years ago

Here is more info on how to use EditorConfig with Emacs - https://github.com/editorconfig/editorconfig-emacs#readme

The template repositories also use ESlint now so we can add rules for the indentation in the .eslintrc

x-ji commented 6 years ago

@stelaseldano Hey I just wonder what tool you used for this set of formatting in commit https://github.com/babe-project/MinimalTemplate/commit/8bc1ff08c2fc2fdfd095195ac1d015ed14788df8. The formatting standards for JS is indeed messy. I now have Prettier plugin installed for VS Code, but it insists on not having any space between function name and parentheses. Guess I can also look at the plugin you used, so that we can arrive at a standard, or I'll just turn off Prettier in my editor.

stelaseldano commented 6 years ago

@x-ji I used Beautify (https://github.com/brackets-beautify). I'm not sure it is available for VS Code (I think it is - https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify). I don't mind using Prettier instead.

x-ji commented 6 years ago

@stelaseldano Thanks. Both Beautify and Prettier seem to be supported by most editors. I disabled Beautify previously but I just enabled it for the project. It should suffice for now. Prettier is a bit more opinionated but offers fewer configuration options: https://github.com/HookyQR/VSCodeBeautify/issues/201