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

ng lint <project> --files behaves differently #13399

Closed
abhijeetkpawar opened this issue Jan 10, 2019 · 3 comments · Fixed by #13489
Closed

ng lint <project> --files behaves differently #13399

abhijeetkpawar opened this issue Jan 10, 2019 · 3 comments · Fixed by #13489
Labels
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Milestone

Comments

@abhijeetkpawar
Copy link

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [x] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Windows 10

$ node --version
v10.14.2

$ npm --version
6.5.0

$ ng --version

Angular CLI: 7.1.4  
Node: 10.14.2
OS: win32 x64  
Angular: 7.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic 
... router
Package                            Version
------------------------------------------------------------     
@angular-devkit/architect          0.11.4  
@angular-devkit/build-angular      0.11.4 
@angular-devkit/build-ng-packagr   0.11.4
@angular-devkit/build-optimizer    0.11.4
@angular-devkit/build-webpack      0.11.4
@angular-devkit/core               7.1.4 
@angular-devkit/schematics         7.1.4  
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.1.4 
@schematics/angular                7.1.4 
@schematics/update                 0.11.4   
ng-packagr                         4.4.5   
rxjs                               6.3.3
typescript                         3.1.6   
webpack                            4.23.1

Repro steps

  1. ng new lint-issue
  2. cd lint-issue/
  3. ng g library sample
  4. touch projects/sample/one.component.ts
  5. echo "" > projects/sample/one.component.ts
  6. ng lint sample
  7. ng lint sample -files projects/sample/one.component.ts

Step 6 succeeds, but step 7 gives error

The log given by the failure

File '<full-path>\lint-issue\projects\sample\one.component.ts' is not part of the TypeScript project 'projects/sample/tsconfig.lib.json,projects/sample/tsconfig.spec.json'.
Error: File '<full-path>\lint-issue\projects\sample\one.component.ts' is not part of the TypeScript project 'projects/sample/tsconfig.lib.json,projects/sample/tsconfig.spec.json'.
    at getFileContents (<full-path>\lint-issue\node_modules\@angular-devkit\build-angular\src\tslint\index.js:163:19)
    at lint (<full-path>\lint-issue\node_modules\@angular-devkit\build-angular\src\tslint\index.js:124:26)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (<full-path>\lint-issue\node_modules\@angular-devkit\build-angular\src\tslint\index.js:61:37)
    at Observable._trySubscribe (<full-path>\lint-issue\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (<full-path>\lint-issue\node_modules\rxjs\internal\Observable.js:30:22)
    at <full-path>\lint-issue\node_modules\rxjs\internal\util\subscribeTo.js:22:31
    at Object.subscribeToResult (<full-path>\lint-issue\node_modules\rxjs\internal\util\subscribeToResult.js:10:45)
    at MergeMapSubscriber._innerSub (<full-path>\lint-issue\node_modules\rxjs\internal\operators\mergeMap.js:82:29)
    at MergeMapSubscriber._tryNext (<full-path>\lint-issue\node_modules\rxjs\internal\operators\mergeMap.js:76:14)
    at MergeMapSubscriber._next (<full-path>\lint-issue\node_modules\rxjs\internal\operators\mergeMap.js:59:18)

Desired functionality

ng lint <project> command with and without files flag should perform in consistent way

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: devkit/build-angular labels Jan 10, 2019
@ngbot ngbot bot added this to the Backlog milestone Jan 10, 2019
@zuzusik
Copy link

zuzusik commented Jan 15, 2019

facing the same issue in our project

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jan 15, 2019

The issue here is that by default in the lint config there are two tsconfig provided.

"tsConfig": [
  "projects/lib/tsconfig.lib.json",
  "projects/lib/tsconfig.spec.json"
],

And the file in question, is only present in one of the compilation units, since most likely it is never referenced in a unit test.

mgechev pushed a commit that referenced this issue Jan 23, 2019
… in non of the programs

At the moment, if a user provides multiple tsconfig, a file needs to be part of all compilations as otherwise it will fail.

This PR changes this behavour and as long as it's in one of the compilations it will not error out.

Fixes #13399
mgechev pushed a commit that referenced this issue Jan 23, 2019
… in non of the programs

At the moment, if a user provides multiple tsconfig, a file needs to be part of all compilations as otherwise it will fail.

This PR changes this behavour and as long as it's in one of the compilations it will not error out.

Fixes #13399
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants