Skip to content

ng generate should use tslint configuration #6192

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

Closed
NCC1701M opened this issue May 5, 2017 · 6 comments · Fixed by #6213
Closed

ng generate should use tslint configuration #6192

NCC1701M opened this issue May 5, 2017 · 6 comments · Fixed by #6213
Assignees
Labels
effort1: easy (hours) feature Issue that requests a new feature P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@NCC1701M
Copy link

NCC1701M commented May 5, 2017

Bug Report or Feature Request (mark with an x)

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

Versions.

Software Version
@angular/cli 1.0.2
node 7.10.0
os win32 x64
@angular/animations 4.1.1
@angular/common 4.1.1
@angular/compiler 4.1.1
@angular/core 4.1.1
@angular/forms 4.1.1
@angular/http 4.1.1
@angular/material 2.0.0-beta.3
@angular/platform-browser 4.1.1
@angular/platform-browser-dynamic 4.1.1
@angular/platform-server 4.1.1
@angular/router 4.1.1
@angular/cli 1.0.2
@angular/compiler-cli 4.1.1

Repro steps.

Execute
ng generate component test --module=app.module --spec=false

Behavior

When you open test.component.ts the indention is set to space and the strings are surrounded by '
In my tslint.json I set the following (extraction):

{
   "indent": [
      true,
      "tabs"
   ],
   "quotemark": [
      true,
      "double"
   ],
}

Desired functionality.

ng generate should - at least (further settings are also welcome) - use the indention and quotemarks that are configured in tslint.

@filipesilva filipesilva added effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent feature Issue that requests a new feature labels May 5, 2017
@filipesilva filipesilva self-assigned this May 5, 2017
@filipesilva
Copy link
Contributor

@clydin has suggested a similar approach, to automatically use tslints fix option on generated files according to a option/flag.

I think that's a good compromise for these stylistic issues.

@NCC1701M
Copy link
Author

NCC1701M commented May 8, 2017

@filipesilva But tslint doesn't fix indent issues. This must do be done manually and this isn't optimal. Optimal would be some kind of configuration which would be used by ng generate. tslint.json already offers this configuration.

@clydin
Copy link
Member

clydin commented May 8, 2017

Not completely ideal, but most editors offer a formatting option to quickly handle whitespace issues.

With the referenced PR, ng generate will transparently transform the created/modified files based on a tslint.config. However, as you said, it is limited to what tslint can currently fix.
I'd suggest raising an issue over at tslint for a feature request to provide fix support for the indent rule. If implemented, any downstream user of tslint would benefit; including the CLI.

@NCC1701M
Copy link
Author

NCC1701M commented May 9, 2017

@filipesilva @clydin But then should - at least - ng generate call tslint on the newly generated ts files otherwise the developer had to do it for each file.

The request already exists: palantir/tslint#2350

@clydin
Copy link
Member

clydin commented May 9, 2017

The referenced PR (#6213) essentially does what you're suggesting and will be included in an upcoming version.

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) feature Issue that requests a new feature P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants