I get the following:
TypeError: Cannot read property 'kind' of undefined
at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/codelyzer/selectorNameBase.js:79:50
at Array.forEach (native)
at SelectorNameValidatorWalker.validateSelector (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/codelyzer/selectorNameBase.js:77:18)
at SelectorNameValidatorWalker.validateDecorator (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/codelyzer/selectorNameBase.js:70:18)
at Array.forEach (native)
at SelectorNameValidatorWalker.visitClassDeclaration (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/codelyzer/selectorNameBase.js:58:33)
at SelectorNameValidatorWalker.SyntaxWalker.visitNode (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:264:22)
at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:459:63
at visitEachNode (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/typescript/lib/typescript.js:8247:30)
at Object.forEachChild (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/typescript/lib/typescript.js:8405:24)
at SelectorNameValidatorWalker.SyntaxWalker.walkChildren (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:459:12)
at SelectorNameValidatorWalker.SyntaxWalker.visitBlock (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:28:14)
at SelectorNameValidatorWalker.SyntaxWalker.visitNode (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:249:22)
at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/language/walker/syntaxWalker.js:459:63
at visitNode (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/typescript/lib/typescript.js:8235:20)
at Object.forEachChild (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/typescript/lib/typescript.js:8323:21)
I'm using:
0.0.283.15.11.3.02.0.2Can I see a code snippet of the file you are running codelyzer on?
@preslavsh Unfortunately I run it on probably around 200+ TS files, so I am not sure where it fails. Also, due to an NDA, I am not allowed to disclose any code. And the error does not seem to provide any clue which file that may be.
At least I can tell you that the following rules cause that error:
{
"component-selector-name": [true, "kebab-case"],
"component-selector-type": [true, "element"],
"component-selector-prefix": [true, "infarm"]
}
I have created PR for that, but it's only a smart guess.
Ok, so it boils down to this:
private static createComponent(selector: string, template: string): any {
@Component({selector, template})
class DynamicComponent {}
return DynamicComponent;
}
I have a service that creates dynamic modules/components.
The following does not throw:
@Component({selector: selector, template: template})
But then I get errors for the shorthand rule:
(object-literal-shorthand) app/shared/component-builder/type-builder.service.ts[15, 15]: Expected property shorthand in object literal.
(object-literal-shorthand) app/shared/component-builder/type-builder.service.ts[15, 35]: Expected property shorthand in object literal.
@rolandjitsu thanks for digging into this! With the information you provided we should fix it in a day or two.
@mgechev no worries, @preslavsh pointed me in the right direction.
@rolandjitsu I will not publish to npm in the next a couple of days. I'm planning a bigger release which includes template support.