-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
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 after a-b it, but it works the other way round (a-b before a).
For example, given the lint rule:
{
"validateAttributeSeparator": {
"separator": " ",
"multiLineSeparator": "\n "
}
}...and the following pug code:
div(a a-b="foo")...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(a a-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
Max-0n
Metadata
Metadata
Assignees
Labels
No labels