I get this error when run
tslint -c tslint.json 'src\app***.ts'
The problem start after i made a npm install in my project. I just checked that tslint has updated to a break change (version 5.0.0 to be more exactly). But i can't say that this make the problem. My package's version:
The error:
TypeError: Cannot read property '1' of undefined
at Rule.SelectorRule [as constructor] (R:\VIXTEAM\_Implementacao\6.1\teamaudit.frontend\node_modules\codelyzer\selectorNameBase.js:16:25)
at new Rule (R:\VIXTEAM\_Implementacao\6.1\teamaudit.frontend\node_modules\codelyzer\directiveSelectorRule.js:11:28)
at Object.loadRules (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\ruleLoader.js:47:32)
at Linter.getEnabledRules (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\linter.js:177:44)
at Linter.lint (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\linter.js:76:33)
at Runner.processFiles (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\runner.js:157:20)
at Runner.run (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\runner.js:108:18)
at Object.<anonymous> (C:\Users\rodrigo.pimenta\AppData\Roaming\npm\node_modules\tslint\lib\tslint-cli.js:140:6)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
I get the same error after updating tslint from 4.5.1 to 5.0.0. Reverting back to 4.5.1 works as expected. I'm using the same versions of typescript and codelyzer as first poster.
Thanks for reporting the issue. I will sync with the other folks from the Angular CLI team and decide how to proceed with the tslint upgrade.
@kensiprell Thanks, that fixed the issue for me as well.
This is technically not a problem in codelyzer since it has as peer dependency tslint^4.0.0. I'll open another issue for the upcoming upgrade to tslint^5.
I am getting the same error running:
codelyzer: 2.1.1 or 3.0.0-beta.4
tslint: 4.5.1
typescript: 2.2.2
same error from @froodley
Related https://github.com/angular/angular-cli/issues/5848
And yes, same issue here. Looks like everyone is passing the buck :-1:
I'm using angular 4.0.1 and gulp 4, possibly relevant
Same here :/
I'm stuck between a bug from typescript requiring me to have the latest version and this, blocking my commits because I lint on pre-commit.
馃槩
Just in case it helps anyone, I was experiencing this issue in WebStorm. I took the advice from the other thread; "use codelyzer 2.1.1 and tslint 4.5.1 and ng lint works", and sure enough ng lint worked but WebStorm still gave the error even after closing and opening the file again. When I restarted WebStorm the problem was gone.
You can also use codelyzer@^3.0.1 with tslint@^5.1.0.
Most helpful comment
You can also use codelyzer@^3.0.1 with tslint@^5.1.0.