Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.25.5
node: 6.8.0
os: linux x64
@angular/common: 2.3.1
@angular/compiler: 2.3.1
@angular/core: 2.3.1
@angular/flex-layout: 2.0.0-beta.1
@angular/forms: 2.3.1
@angular/http: 2.3.1
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.3.1
@angular/platform-browser-dynamic: 2.3.1
@angular/router: 3.3.1
@angular/compiler-cli: 2.3.1
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
- make a TS lint error in a basic project
- run
ng lint
Normally this include a stack trace and some more information.
Notice that there's an error but not lines in the output.
Hard to correct :)
If I go back to lint I had before in my package.json, it's working just fine :
"lint": "tslint \"src/**/*.ts\"
When I updated to beta-25.5 it was replaced by
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
I'm getting errors correctly. This is what I did to test:
On a new project, add var blabla = 1; to src/main.ts, ran ng lint:
kamik@T460p MINGW64 /D/sandbox/master-project (master)
$ ng lint
> [email protected] lint D:\sandbox\master-project
> tslint "src/**/*.ts" --project src/tsconfig.json --type-check && tslint "e2e/**/*.ts" --project e2e/tsconfig.json --type-check
src/main.ts[14, 1]: Forbidden 'var' keyword, use 'let' or 'const' instead
Lint errors found in the listed files.
What kind of error did you add? Maybe it's a different problem. Can you also do npm run lint to see what message you get?
ng lint mostly just does npm run lint but removed the npm ERR bits, so by looking at the real output there might be some hint to the problem.
I had that problem also. I think, it is because the tslint.json includes invalid configuration. I assume, you must have upgraded tslint previously and some of the configuration params became invalid.
@zsfarkas that makes sense, inside ng lint we only really know if the npm script failed so it would look the same.
ng lint works fine in macOS Sierra.
I see this behavior when there are TypeScript compile errors. Running npm run lint will show a stack trace with the errors.
I've the same problem just getting the lines below. The thing I did a fresh ng init on my project with 25.5 as version and took the tsconfig clean from 25.5.
@kalahari
I can confirm after fixing the nom run lint errors the ng lint show's now the detailed errors again!
tslint "src/**/*.ts" --project src/tsconfig.json --type-check && tslint "e2e/**/*.ts" --project e2e/tsconfig.json --type-c
heck
Lint errors found in the listed files.
bash-3.2$
Same problem for me.
I had to remove --type-check option from the tslint command in package.json to make it works again.
With the type-check option, I get this error:
```
$ ./node_modules/.bin/tslint "src/*/.ts" --project src/tsconfig.json --type-check
C:node_modules\tslint\lib\runner.js:117
throw error;
^
Error:
Invalid source file: src/test.ts. Ensure that the files supplied to lint have a .ts, .tsx, .js or .jsx extension.
at Linter.getSourceFile (C:\node_modules\tslint\lib\linter.js:187:19)
at Linter.getEnabledRules (C:\node_modules\tslint\lib\linter.js:156:31)
at Linter.lint (C:\node_modules\tslint\lib\linter.js:83:33)
at Runner.processFiles (C:\node_modules\tslint\lib\runner.js:154:20)
at Runner.run (C:\node_modules\tslint\lib\runner.js:109:18)
at Object.<anonymous> (C:\node_modules\tslint\lib\tslint-cli.js:138:6)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
````
Edit:
I removed "exclude": [ "test.ts" ] from tsconfig.json file (I added this to fix a bug with ng-xi18n) and now --type-check option works.
I am having a similar issue, with npm run lint I get the following:
➜ dashboard git:(master) ✗ npm run lint
> @infarm/[email protected] lint /Users/rolandjitsu/Projects/infarm/dashboard
> tslint src/**/*.ts --project src/tsconfig.json --type-check && tslint e2e/**/*.ts --project e2e/tsconfig.json --type-check
/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/runner.js:91
throw new Error(messages.join("\n"));
^
Error: Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/compiler/src/aot/static_reflector.d.ts:8:49: A class may only implement another class or interface.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/core/src/util/decorators.d.ts:11:5: Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:378:27: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; emitModelToViewChange?: boolea...' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:378:37: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; emitModelToViewChange?: boolea...' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:378:48: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; emitModelToViewChange?: boolea...' has no property 'emitModelToViewChange' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:378:71: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; emitModelToViewChange?: boolea...' has no property 'emitViewToModelChange' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:425:29: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:425:39: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:548:9: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:548:19: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:575:9: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:575:19: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:611:25: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:611:35: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:715:29: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:715:39: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:739:31: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:739:41: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:774:25: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/forms/src/model.d.ts:774:35: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts:30:22: Class 'DomRenderer' incorrectly implements interface 'Renderer'.
Types of property 'animate' are incompatible.
Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number,...'.
Type 'AnimationPlayer | undefined' is not assignable to type 'AnimationPlayer'.
Type 'undefined' is not assignable to type 'AnimationPlayer'.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/platform-browser/src/dom/web_animations_driver.d.ts:12:22: Class 'WebAnimationsDriver' incorrectly implements interface 'AnimationDriver'.
Types of property 'animate' are incompatible.
Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...'.
Type 'WebAnimationsPlayer' is not assignable to type 'AnimationPlayer'.
Types of property 'parentPlayer' are incompatible.
Type 'AnimationPlayer | undefined' is not assignable to type 'AnimationPlayer'.
Type 'undefined' is not assignable to type 'AnimationPlayer'.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/@angular/platform-browser/src/dom/web_animations_player.d.ts:3:53: A class may only implement another class or interface.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/potion-client/@angular/potion.d.ts:41:37: Type 'RequestOptions | undefined' has no property 'method' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/potion-client/@angular/potion.d.ts:41:45: Type 'RequestOptions | undefined' has no property 'search' and no string index signature.
Error at /Users/rolandjitsu/Projects/infarm/dashboard/node_modules/potion-client/@angular/potion.d.ts:41:53: Type 'RequestOptions | undefined' has no property 'data' and no string index signature.
at Runner.run (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/runner.js:91:27)
at Object.<anonymous> (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/lib/tslint-cli.js:138:6)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/rolandjitsu/Projects/infarm/dashboard/node_modules/tslint/bin/tslint:3:1)
And with ng lint I get:
➜ dashboard git:(master) ✗ ng lint
> @infarm/[email protected] lint /Users/rolandjitsu/Projects/infarm/dashboard
> tslint src/**/*.ts --project src/tsconfig.json --type-check && tslint e2e/**/*.ts --project e2e/tsconfig.json --type-check
Lint errors found in the listed files.
Strangely, with ng test --lint, I do get warnings printed out.
If I remove --type-check flag, it seems to work properly.
I am running on the following env:
ngular-cli: 1.0.0-beta.25.5
node: 6.7.0
os: darwin x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/material: 2.0.0-beta.1
The project where I tried that is here : https://gitlab.com/victornoel/petals-cockpit/tree/front/refactor-whole-app
It might help to debug.
If you want to reproduce, just clone the project, checkout front/refactor-whole-app and in frontend/package.json update the lint to one we now have in beta-25.5 (I removed it so the lint can still work).
I found that problem too in 1.0.0-beta.26. There were some lint errors in e2e tests but ng lint did not show any of them just saying "Lint errors found...". Then I run npm run lint and it listed all the e2e spec files where errors have been found.
Same problem
project_path/node_modules/tslint/lib/runner.js:117
throw error;
^
Error: Cannot find module 'tslint/lib/lint'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (project_path/node_modules/codelyzer/selectorNameBase.js:8:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Yup, i can confirm i have the same problem.
> tslint "src/**/*.ts" --project src/tsconfig.json --type-check && tslint "e2e/**/*.ts" --project e2e/tsconfig.json --type-check
Removing --type-check helps.
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._
Most helpful comment
I see this behavior when there are TypeScript compile errors. Running
npm run lintwill show a stack trace with the errors.