You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a bug with validateAttributeSeparator when attributes are named in a specific way. If one attribute is named e.g. a, there cannot be an attribute named after a-b it, but it works the other way round (a-b before a).
...the linter fails with Invalid attribute separator found, pointing at the dash in a-b. Interestingly, with the same lint rule, the following pug code with an attribute named a-a:
div(aa-a="foo")
...fails with error:
TypeError: Cannot read property 'line' of undefined
at lib/rules/validate-attribute-separator.js:9:4527
at lib/pug-file.js:9:18727
at Array.forEach (<anonymous>)
at PugFile.iterateTokensByFilter (lib/pug-file.js:9:18624)
at PugFile.iterateTokensByType (lib/pug-file.js:9:18937)
at module.exports.lint (lib/rules/validate-attribute-separator.js:9:2008)
at lib/linter.js:9:8270
at Array.forEach (<anonymous>)
at Linter._checkFile (lib/linter.js:9:8092)
at Linter.checkString (lib/linter.js:9:3918)
at Linter.checkFile (lib/linter.js:9:2741)
...
When the attributes are re-ordered, the pug code is linted without errors:
div(a-b="foo"a)
div(a-a="foo"a)
The same bug occurs in multiline attributes.
pug-lint version used: 2.5.0
The text was updated successfully, but these errors were encountered:
jlaamanen
pushed a commit
to jlaamanen/pug-lint
that referenced
this issue
Apr 12, 2018
Hello!
There seems to be a bug with
validateAttributeSeparator
when attributes are named in a specific way. If one attribute is named e.g.a
, there cannot be an attribute named aftera-b
it, but it works the other way round (a-b
beforea
).For example, given the lint rule:
...and the following pug code:
...the linter fails with
Invalid attribute separator found
, pointing at the dash ina-b
. Interestingly, with the same lint rule, the following pug code with an attribute nameda-a
:...fails with error:
When the attributes are re-ordered, the pug code is linted without errors:
The same bug occurs in multiline attributes.
pug-lint
version used: 2.5.0The text was updated successfully, but these errors were encountered: