pugjs / pug-lint

An unopinionated and configurable linter and style checker for Pug
ISC License
228 stars 51 forks source link

RequireStatementInCodeBock #55

Closed fpedroza closed 8 years ago

fpedroza commented 8 years ago

I'm not sure I'm a fan of this rule. Per your example,

//- Invalid
- var n = 0;
- while (n < 10)
    - n++
    li= n

To avoid the rule violation should be written as:

//- Valid
var n = 0; while (n < 10)
n++ li= n

Yuck! Am I alone in thinking no one wants to write their code like this? Other than disabling the rule entirely, do you have any suggestions for avoiding this error message?

ForbesLindesay commented 8 years ago

The lint rule is just encouraging you to use built in flow control that's supplied by pug/jade. The advantage is that it makes it a lot easier to provide good syntax errors if you make mistakes. Your "valid" example should therefore be:

//- Valid
- var n = 0;
while n < 10
    - n++
    li= n
fpedroza commented 8 years ago

Makes sense. Just to be clear though, that "valid" example is the one listed here (http://rdel.io/jadelint)

benedfit commented 8 years ago

@fpedroza I believe you were looking for https://github.com/rrdelaney/jadelint to raise this against

fpedroza commented 8 years ago

doh!