Skip to content

ng lint with format flag errors #10657

Closed
@alisa-duncan

Description

@alisa-duncan

Versions

Angular CLI: 6.0.0
Node: 9.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  1. Create new application via angular-cli.
  2. Run ng lint with format flag.
ng new my-test
cd my-test
ng lint --format checkstyle

I can edit angular.json to add "format":"checkstyle" option to "my-test" and "my-test-e2e" projects. Then ng lint will run successfully and console will contain checkstyle output for each project.

Observed behavior

Architect commands with multiple targets cannot specify overrides.'lint' would be run on the following projects: my-test,my-test-e2e
Error: Architect commands with multiple targets cannot specify overrides.'lint' would be run on the following projects: my-test,my-test-e2e
    at LintCommand.validate (C:\repos\my-test\node_modules\@angular\cli\models\architect-command.js:91:23)
    at C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:274:39
    at Generator.next (<anonymous>)
    at C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:3:12)
    at validateAndRunCommand (C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:273:12)
    at Object.<anonymous> (C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:100:26)
    at Generator.next (<anonymous>)
    at fulfilled (C:\repos\my-test\node_modules\@angular\cli\models\command-runner.js:4:58)

When using format option in angular.json, I get 2 checkstyle outputs (one for each project).

ng lint
<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"></checkstyle>
<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"></checkstyle>

Desired behavior

  • I would like to be able to pass in format param via command line so that it can be used via CI and local builds.
  • Default output is prose in console.
  • Aggregate all linting errors preferred but can work around. (This was previous behavior).
    • Aggregate lint output for all projects so that I can pipe to file
    • For checkstyle it has all errors in one xml output instead of 2

Mention any other details that might be useful (optional)

We use Jenkins CI and use checkstyle reporter to file for CI builds only, but would like to retain prose console output for local builds. We cannot do that when format is set in angular.json.

This is similar to #10422 but reporter was using multiple libraries. This issue is visible in a basic application.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions