Angular-cli: Additional codelyzer rules

Created on 21 Jun 2017  路  8Comments  路  Source: angular/angular-cli

  • [x] feature request

In the latest release of [email protected], there are a few new rules:

  • [ ] - angular-whitespace: [true, 'check-interpolation', 'check-pipe'] - Checks if there's whitespace around an expression surrounded by interpolation characters, and after a pipe symbol.
  • [ ] - banana-in-box: true - Checks for proper banana in a box syntax - [(ngModel)] instead of ([ngModel]).
  • [ ] - templates-no-negated-async: true - Enforces (foo | async) === false, rather than !(foo | async), because of the initial falsy value emitted.
  • [ ] - use-view-encapsulation: true - Enforces enabled view encapsulation.

I'm opening this issue in order to discuss which rules align with the vision of the CLI. After that I'll open a PR updating the configuration.

I'd vote for angular-whitespace, banana-in-box and templates-no-negated-async. Although use-view-encapsulation is very useful, it feels restrictive, however, I'd use it in personal projects.

easy (hours) help wanted 3 (nice to have) feature

Most helpful comment

angular-whitespace and banana-in-box seem like no-brainers for me.

templates-no-negated-async is probably okay.

use-view-encapsulation I'm not okay with, since a lot of people don't do view encapsulation (e.g. Angular Material).

All 8 comments

Was just testing this release and it seems the negated rule is incorrectly named here and in the release notes. Isn't it actually: templates-no-negated-async?

https://github.com/mgechev/codelyzer/blob/master/docs/rules/templates-no-negated-async/index.html#L2

@intellix correct.

SGTM. I know a lot of projects aren't doing use-view-encapsulation, so I think it would be restrictive as well.

Hello, I would like to give this issue a shot.

@sendilkumarn we first need to decide which rules to introduce and after that go with the actual PR.

angular-whitespace and banana-in-box seem like no-brainers for me.

templates-no-negated-async is probably okay.

use-view-encapsulation I'm not okay with, since a lot of people don't do view encapsulation (e.g. Angular Material).

Is this still a relevant issue? If so, I would like to have a look but I need some extra information on what the next steps are.

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