pugjs / pug-lint

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

Ambiguity with validateAttributeQuoteMarks #104

Closed julienpa closed 8 years ago

julienpa commented 8 years ago

The doc contains the following example for a given rule validateAttributeQuoteMarks: "'":

//- Invalid
input(type="text" name="name" value="value")

//- Valid
input(type='text' name='name' value='value')

But the following will be considered valid even if it could be considered invalid since it doesn't enforce the chosen style:

//- Valid
input(type=text name=name value=value)
TimothyGu commented 8 years ago

Well, the third snippet uses text as a variable. The rule is there to enforce string literal styles, but that third one doesn't use them as string literals.

julienpa commented 8 years ago

@TimothyGu yeah indeed, my issue was not accurate, sorry. The problem I am having on my current project is with number values for attribute, for example:

element(attr=40)

which outputs

<element attr="40"></element>

...and I wish the linter could tell that 40 should have quotes around

TimothyGu commented 8 years ago

Well, the number works for the output too as you can see, so it's not really an issue for a linter to detect.

julienpa commented 8 years ago

The output also works if I use " sometimes and ' on other occasions, yet there is a linter rule to ensure that I always use the same quote style. My problem is that this rule doesn't apply to numbers, which breaks the feature of ensuring the same quote style for all attributes...