pugjs / pug-lint

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

Aurelia-style function delegates cause error in validate-attribute-separator #124

Open WillsonHaw opened 7 years ago

WillsonHaw commented 7 years ago

I have an attribute like so in Aurelia in a pug file:

my-button(
    async,
    async-click.delegate="runAsync($event)"
)

I want to use validateAttributeSeparator with this pug file, using this configuration:

"validateAttributeSeparator": {
    "separator": " ",
    "multiLineSeparator": "\n    "
}

But when the lint runs, an error is raised:

error:   TypeError: Cannot read property 'line' of undefined
    at D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\rules\validate-attribute-separator.js:109:22
    at D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\pug-file.js:367:7
    at Array.forEach (native)
    at Object.PugFile.iterateTokensByFilter (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\pug-file.js:366:36)
    at Object.PugFile.iterateTokensByType (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\pug-file.js:374:10)
    at Object.module.exports.lint (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\rules\validate-attribute-separator.js:73:10)
    at D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:145:12
    at Array.forEach (native)
    at Object.Linter._checkFile (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:142:31)
    at Object.Linter.checkString (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:72:17)
    at Object.Linter.checkFile (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:48:17)
    at Object.<anonymous> (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:35:37)
    at Array.forEach (native)
    at Object.Linter.checkDirectory (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:28:35)
    at Object.<anonymous> (D:\Dev\iQmetrix\Hub\node_modules\pug-lint\lib\linter.js:33:37)
    at Array.forEach (native)
batandwa commented 7 years ago

I have a similar issue running version 2.4.0.