Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

directive-selector and component-selector rules cause cannot read property '1' of undefined error #292

Closed
fmorriso opened this issue Apr 13, 2017 · 1 comment

Comments

@fmorriso
Copy link

fmorriso commented Apr 13, 2017

After upgrading my Angular 4.0.2 project to use the latest codelyzer 2.1.1 and tslint 5.1.0, I find that the presence of either or both of the following two lines inside my tslint.json file causes the error mentioned in the subject:

"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],

Removing both lines is required to allow lint to work without crashing.

The details of the error:

Cannot read property '1' of undefined
TypeError: Cannot read property '1' of undefined
at Rule.SelectorRule [as constructor] (C:\projects\aaDeleteMe\node_modules\codelyzer\selectorNameBase.js:16:25)
at new Rule (C:\projects\aaDeleteMe\node_modules\codelyzer\directiveSelectorRule.js:12:28)
at Object.loadRules (C:\projects\aaDeleteMe\node_modules\tslint\lib\ruleLoader.js:47:32)
at Linter.getEnabledRules (C:\projects\aaDeleteMe\node_modules\tslint\lib\linter.js:199:44)
at Linter.lint (C:\projects\aaDeleteMe\node_modules\tslint\lib\linter.js:76:33)
at files.forEach (C:\projects\aaDeleteMe\node_modules@angular\cli\tasks\lint.js:37:24)
at Array.forEach (native)
at lintConfigs.map (C:\projects\aaDeleteMe\node_modules@angular\cli\tasks\lint.js:30:19)
at Array.map (native)
at Class.run (C:\projects\aaDeleteMe\node_modules@angular\cli\tasks\lint.js:21:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aa-delete-me@0.0.0 lint: ng lint
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aa-delete-me@0.0.0 lint script 'ng lint'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the aa-delete-me package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng lint
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aa-delete-me
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls aa-delete-me
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\fpmor\AppData\Roaming\npm-cache_logs\2017-04-13T15_20_18_666Z-debug.log

My tslint.json:

{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [true, "rxjs"],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
false,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}

@mgechev
Copy link
Owner

mgechev commented Apr 13, 2017

#281

@mgechev mgechev closed this as completed Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants