Angular-cli: Add option for tslint formatters directory in ng lint command

Created on 6 Mar 2017  路  4Comments  路  Source: angular/angular-cli

OS?

Windows 7 and 10

Versions.

1.0.0-rc.1

Repro steps.

I upgraded angular-cli from an older version to the current rc.1. I also applied the changes to the package.json from this Pull Request #4248. While there is support for built-in formatters (using the --format flag), there is currently no support to specify the formatters directory for third party formatters. The tslint api provides such an option (see here), it is just not yet used in the angular-cli.

It would be great if you could provid this additional option. Currently I need to manually patch the lint command of the cli to work around it.

The log given by the failure.

If you run ng lint with the TeamCity formatter (ng lint --format TSHintTeamcity) you get the following output:

Error: formatter 'TSHintTeamcity' not found
at Linter.getResult (D:\projects\test\iks.frontendnode_modules\tslint\lib\linter.js:121:19)
at lintConfigs.forEach (D:\projects\test\iks.frontendnode_modules\@angular\cli\tasks\lint.js:43:35)
at Array.forEach (native)
at Class.run (D:\projects\test\iks.frontendnode_modules\@angular\cli\tasks\lint.js:27:14)
at Class.run (D:\projects\test\iks.frontendnode_modules\@angular\cli\commands\lint.js:39:25)
at Class. (D:\projects\test\iks.frontendnode_modules\@angular\cli\ember-cli\lib\models\command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:103:7)

3 (nice to have)

Most helpful comment

If you just want to use tslint-teamcity-reporter there is no need to specify directory.
Just run ng lint --format tslint-teamcity-reporter (use package name).

But I still see the need of --formatters-dir support for user defined formatters.

All 4 comments

If you just want to use tslint-teamcity-reporter there is no need to specify directory.
Just run ng lint --format tslint-teamcity-reporter (use package name).

But I still see the need of --formatters-dir support for user defined formatters.

That's awesome. I wasn't aware that you could just use the package name. Thanks @dzonatan for pointing this out.

Closing as answered by @dzonatan, thanks!

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hartjo picture hartjo  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

hareeshav picture hareeshav  路  3Comments

donaldallen picture donaldallen  路  3Comments