Open Ulrikop opened 8 years ago
Similar issue for me, I have this rule:
"validateAttributeSeparator": { "separator": ", ", "multiLineSeparator": ",\n " },
And each time an attribute has a dash -
an error is reported, like:
src/app/user/user.list.jade:19:29
> 19| div(layout, layout-align="center start")
------------------------------^
Invalid attribute separator found
Is anything planned to fix this issue? Thanks for your great work!
what is the status of that issue?
I'm also experiencing this.
$ cat .pug-lintrc.json test.pug
{
"validateAttributeSeparator": {
"separator": " ",
"multiLineSeparator": "\n\t"
}
}
div(
uib-dropdown
uib-dropdown-toggle
dropdown-append-to-body="true"
)
$ pug-lint -c .pug-lintrc.json test.pug
test.pug:4:1
2| uib-dropdown
3| uib-dropdown-toggle
> 4| dropdown-append-to-body="true"
-------^
5| )
6|
Invalid attribute separator found
I think the culprit is getParsedSource
. I did some quick console.log
-based debugging and this came up:
[ 'uib\\-dropdown',
'uib\\-dropdown\\-toggle',
'dropdown\\-append\\-to\\-body\\s*\\!*=\\s*"true"' ]
############
############-toggle
##############################
So, certain patterns are replaced by #
. But because there is a repeating pattern in the attribute names, the second pattern will match nothing after the first pattern was already replaced.
While I don't know how to properly fix this, it revealed a workaround: just sort attributes with repeating tokens from longest to shortest.
$ cat .pug-lintrc.json test.pug
{
"validateAttributeSeparator": {
"separator": " ",
"multiLineSeparator": "\n\t"
}
}
div(
uib-dropdown-toggle
uib-dropdown
dropdown-append-to-body="true"
)
$ pug-lint -c .pug-lintrc.json test.pug
<nothing>
The same for me with camelcase attributes in Angular syntax:
currency, currencySign="$",
We have inner codestyle that force to use alphabetical order for attributes.
Hi, I found a bug at validateAttributeSeparator:
says:
When I change the length of some names, the position of the bug is changed at a very strange way:
I think, it have something to do with attributes which starts with the same chars, because the following jade code does not lead to errors:
PS: Thanks for fixing my last found bug :-) PPS: One question which have nothing to do with the bug: Can I add a custom rule, so that I can throw a error when 3 consecutive } are found. I need it for using angular translate at attributes: