Angular-cli: lint error: TypeError: this.nameValidator is not a function

Created on 14 Dec 2016  路  6Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

macOS Sierra

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.22-1
node: 7.2.0
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

ng lint

The log given by the failure.

Normally this include a stack trace and some more information.

> tslint "src/**/*.ts"

.../node_modules/tslint/lib/tslint-cli.js:234
    throw error;
    ^

TypeError: this.nameValidator is not a function
    at Rule.SelectorRule.validateName (.../node_modules/codelyzer/selectorNameBase.js:40:25)
    at .../node_modules/codelyzer/selectorNameBase.js:125:33
    at Array.every (native)
    at validateSelectors (.../node_modules/codelyzer/selectorNameBase.js:124:39)
    at .../node_modules/codelyzer/selectorNameBase.js:132:27
    at Array.forEach (native)
    at SelectorValidatorWalker.validateSelector (.../node_modules/codelyzer/selectorNameBase.js:121:18)
    at SelectorValidatorWalker.validateDecorator (.../node_modules/codelyzer/selectorNameBase.js:113:18)
    at Array.forEach (native)
    at SelectorValidatorWalker.visitClassDeclaration (.../node_modules/codelyzer/selectorNameBase.js:103:14)

Mention any other details that might be useful.

Thanks! We'll be in touch soon.

investigation 3 (nice to have) bufix

Most helpful comment

I know this is closed, but it might help someone :)

I got here looking for the this.nameValidator is not a function codelyzer error. It turned out to be because I was not specifying the selectorPrefix in the component|directive-selector rule in tslint.json.

before

"directive-selector": [true, "attribute", "camelCase"]

after (and working)

"directive-selector": [true, "attribute", "", "camelCase"]

All 6 comments

@mgechev any idea? This seems to occur in the codelyzer code itself.

Yes, most likely the configuration is not valid. The current master contains valid configuration. You can fix it manually, by updating tslint.json or the fix will come with the next release automatically.

@hansl I think we can close this issue.

right

I know this is closed, but it might help someone :)

I got here looking for the this.nameValidator is not a function codelyzer error. It turned out to be because I was not specifying the selectorPrefix in the component|directive-selector rule in tslint.json.

before

"directive-selector": [true, "attribute", "camelCase"]

after (and working)

"directive-selector": [true, "attribute", "", "camelCase"]

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings