tecnoyucas / tecnoyucas.github.io

Yucazos de Innovación Tecnológica
MIT License
4 stars 0 forks source link

Set coding styles and Guidelines and setup .editorconfig #6

Open stefanmaric opened 10 years ago

stefanmaric commented 10 years ago

Let's get a coding standard, for HTML, CSS, JS, and whatever else we will be working with. Discussion here. ( @sadasant , @adrianObel , @ghostbar )

After that:

sadasant commented 10 years ago

For JavaScript: I think I prefer http://requirejs.org/ and something like Mozilla's dryice.

Or what about Riot? I think we can get something good done with Riot + jquery + grunt/dryice (to compress and unify the scripts)

adrianObel commented 10 years ago

I usually follow the npm-style standard for writing JS

stefanmaric commented 10 years ago

@sadasant I can't see any coding style in requirejs, dryice, nor Riot (Riot looks interesting due its minimalism).

I meant coding styles like the one @adrianObel mentioned: npm-style. Am I missing something?

sadasant commented 10 years ago

@stefanmaric yes, you're right, I was thinking on what framework should we use.

sadasant commented 10 years ago

@stefanmaric you both can pick the coding styles, a couple of things I prefer:

For JS:

adrianObel commented 10 years ago

If it was up to me I'd just do it in coffee ;)

How does npm-style sound? var for first variable only, comma first, and ditch the semi-colons

ghostbar commented 10 years ago

I just ditched coffee and I'm loving my complete syntax and not ugly-looking npm-style javascript xD

I think nodeguide.com/style.html is pretty good. And https://github.com/meteor/meteor/wiki/Meteor-Style-Guide

Just for extra-clarity: I like code like this, don't know what you guys think https://github.com/ghostbar/twitter-rest-lite/blob/master/lib/api.js

sadasant commented 10 years ago

I like that, but let's define every variable with it's own var, what do you think?

sadasant commented 10 years ago

I closed it by error.

ghostbar commented 10 years ago

Hmmm... Why that? If we use:

var hey = "this is me",
    hoy = "I'm another one";

Should be enough to get it organized or even:

var hey = "duh",
  what = "it's up!";
sadasant commented 10 years ago

It enforces consistency when moving lines and avoids spaces/tabs to change the style.

var hey = "duh";
var what = "is up!";

Here's an example:

(function() {
    var my_variable = "variable";
    var my_other_variable = false;

    // Let's move one of those variables inside the function below.

    return function() {
        var variables = "inside";
        var the_crazy = "return function";

        // We can just put any of those variables here, or everywhere,
        // it doesn't matter, there's no need of correcting the last character,
        // or removing anything, just paste and it's done.
    }
})();
ghostbar commented 10 years ago

I think we have a winner here :D