I have created a new Angular4 project using Angular-CLI recently.
The problem I am having is after installing angular2-notifications , I get an error when running the ng lint
command.
Error :
Failed to load C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\angular2-notifications\tslint.json: Could not find custom rule directory: C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\angular2-notifications\node_modules\codelyzer
Stacktrace :
at new FatalError (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\tslint\lib\error.js:40:23)
at Object.findConfiguration (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\tslint\lib\configuration.js:47:15)
at files.forEach (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:36:50)
at Array.forEach (native)
at lintConfigs.map (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:30:19)
at Array.map (native)
at Class.run (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:21:14)
at Class.run (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\commands\lint.js:45:25)
at Class.Command.validateAndRun (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\ember-cli\lib\models\command.js:128:15)
at C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:92:22
I have turned to Google for this issue, without any luck. I have been to the GitHub repo and had no luck there either.
Then I went in the actual tslint.json
file of angular2-notifications package.
I see this at the top :
"rulesDirectory": [
"node_modules/codelyzer"
],
When I remove those 3 lines, the ng lint
command works.
My question is, am I missing something here? I need this command to work and I don't think that modifying the package is an acceptable solution. Is this a bug in the package itself which I should report to them?
Thank you
Exclude node_modules from your lint config in angular-cli.json:
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**/*"
}]
The angular2-notifications project obviously shouldn't break ng lint for users. Still, I suppose it is also somewhat fair to say that a project shouldn't be trying to lint code that shouldn't be edited.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With