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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schematics compliance with call-signature lint rule #16754

Closed
1 task done
cyrilletuzi opened this issue Jan 24, 2020 · 1 comment 路 Fixed by #16755
Closed
1 task done

Schematics compliance with call-signature lint rule #16754

cyrilletuzi opened this issue Jan 24, 2020 · 1 comment 路 Fixed by #16755
Labels
area: schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient type: bug/fix
Milestone

Comments

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Jan 24, 2020

馃殌 Feature request

Command

  • lint

Description

It's a very good practice in TypeScript to enable the typedef: ["call-signature"] TSLint rule, which ensures that functions return type is explicit.

Why?

  • because otherwise TypeScript infers the return type, but based on the code, which assumes the code is correct (while it may not);
  • it's the minimal documentation that should be expected in any code.

Describe the solution you'd like

It would be nice if Angular CLI schematics could be compliant with that lint rule by default. It's currently not the case:

  • in component schematic ngOnInit()
  • in e2e schematics

The first one is especially annoying as then we need to add : void each time we create a new component.

That would also be more consistent with other schematics where the functions return type is indeed explicit (like guards, interceptors, etc.).

PR done in #16755. Note that it does not enable the lint rule, it just makes schematics compliant with it, so it has no consequences at all.

@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 Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants