Hi all,

I'd like to get some opinions on this. As I've been reviewing the existing
rules, we have a bunch that fall into the category styling: line length,
semicolons, etc. I've been having some heartache around the tri-state
nature of these rules. What I mean is, our rules are mostly binary (on vs.
off), but in reality there are three states:

1) Require something
2) Disallow something
3) Turn the rule off

So for the semicolons rule, right now we can enforce semicolons or else the
rule is off. We don't have a way of saying "require that semicolons ARE NOT
used". If we wanted to add that, what would we do? I don't like the idea of
adding a no-semi rule, because that makes semi and no-semi mutually
exclusive without any way of indicating this is so (this is what JSCS does,
and I really don't like that approach).

What I've been thinking is to have a single rule that is responsible for
style and add a special section in the conf to specify styling preferences,
such as:

style: {
    quotes: "double",
    semi: "require",   // or "disallow" or remove this setting if you don't
care
    indent: "\t",
    spaces: {
        inside-parents: true,
    },
    newlines: {
        // etc
    }
},

rules: {
    style: 2
}

Then there would be a "style" rule that is responsible for applying
everything in the style section.

This is still a very raw idea in my brain, so I'd like to hear some
opinions on this.

Thanks.



-- 

______________________________
Nicholas C. Zakas
@slicknet

Author, Professional JavaScript for Web Developers
Buy it at Amazon.com:
http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to