-
Notifications
You must be signed in to change notification settings - Fork 6k
Typescript angular linting fixes #6945
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
Typescript angular linting fixes #6945
Conversation
|
Your winter might break others due to the nature of linting I do not
suggest this pe be merged . Just lint iit in your own project
…On Mon, Nov 13, 2017, 5:30 AM Meindert Deen ***@***.***> wrote:
Technical committee: @TiFu <https://github.com/tifu> @taxpon
<https://github.com/taxpon> @sebastianhaas
<https://github.com/sebastianhaas> @kenisteward
<https://github.com/kenisteward> @Vrolijkx <https://github.com/vrolijkx>
PR checklist
- [x ] Read the contribution guidelines
<https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md>
.
- [x ] Ran the shell script under ./bin/ to update Petstore sample so
that CIs can verify the change. (For instance, only need to run
./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if
updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG}
client's mustache templates). Windows batch files can be found in
.\bin\windows\.
- [ x] Filed the PR against the correct branch: 3.0.0 branch for
changes related to OpenAPI spec 3.0. Default: master.
- [x ] Copied the technical committee
<https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee>
to review the pull request if your PR is targeting a particular programming
langauge.
Description of the PR
When I added the generated Typescript Angular code to my project, my
'tslint' did not like the generated code. I updated the code to make my
'tslint' happy. This PR is to share my changes with the community.
------------------------------
You can view, comment on, or merge this pull request online at:
#6945
Commit Summary
- better compliance with tslint
- Merge branch 'master' into typescript_angular_linting_fixes
File Changes
- *M*
modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-0>
(30)
- *M*
modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-1>
(18)
- *M*
samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-2>
(96)
- *M*
samples/client/petstore/typescript-angular-v2/default/api/store.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-3>
(52)
- *M*
samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-4>
(100)
- *M*
samples/client/petstore/typescript-angular-v2/default/configuration.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-5>
(18)
- *M*
samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-6>
(96)
- *M*
samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-7>
(52)
- *M*
samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-8>
(100)
- *M*
samples/client/petstore/typescript-angular-v2/npm/configuration.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-9>
(18)
- *M*
samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-10>
(96)
- *M*
samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-11>
(52)
- *M*
samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-12>
(100)
- *M*
samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-13>
(18)
- *M*
samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-14>
(100)
- *M*
samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-15>
(54)
- *M*
samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-16>
(108)
- *M*
samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-17>
(18)
- *M*
samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-18>
(96)
- *M*
samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-19>
(52)
- *M*
samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-20>
(100)
- *M*
samples/client/petstore/typescript-angular-v4/npm/configuration.ts
<https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-21>
(18)
Patch Links:
- https://github.com/swagger-api/swagger-codegen/pull/6945.patch
- https://github.com/swagger-api/swagger-codegen/pull/6945.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6945>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AMPLtYXl0sQowPiStEARGplLy8Sjo0TZks5s2BorgaJpZM4Qbi_A>
.
|
|
What o truly suggest is not putting the code into you project but building
it and serving it as a bundle . The code is generated and shouldn't really
be changed by hand.
On Mon, Nov 13, 2017, 5:36 AM Kenneth Steward <keni.steward@gmail.com>
wrote:
… Your winter might break others due to the nature of linting I do not
suggest this pe be merged . Just lint iit in your own project
On Mon, Nov 13, 2017, 5:30 AM Meindert Deen ***@***.***>
wrote:
> Technical committee: @TiFu <https://github.com/tifu> @taxpon
> <https://github.com/taxpon> @sebastianhaas
> <https://github.com/sebastianhaas> @kenisteward
> <https://github.com/kenisteward> @Vrolijkx <https://github.com/vrolijkx>
> PR checklist
>
> - [x ] Read the contribution guidelines
> <https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md>
> .
> - [x ] Ran the shell script under ./bin/ to update Petstore sample so
> that CIs can verify the change. (For instance, only need to run
> ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if
> updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG}
> client's mustache templates). Windows batch files can be found in
> .\bin\windows\.
> - [ x] Filed the PR against the correct branch: 3.0.0 branch for
> changes related to OpenAPI spec 3.0. Default: master.
> - [x ] Copied the technical committee
> <https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee>
> to review the pull request if your PR is targeting a particular programming
> langauge.
>
> Description of the PR
>
> When I added the generated Typescript Angular code to my project, my
> 'tslint' did not like the generated code. I updated the code to make my
> 'tslint' happy. This PR is to share my changes with the community.
> ------------------------------
> You can view, comment on, or merge this pull request online at:
>
> #6945
> Commit Summary
>
> - better compliance with tslint
> - Merge branch 'master' into typescript_angular_linting_fixes
>
> File Changes
>
> - *M*
> modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-0>
> (30)
> - *M*
> modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-1>
> (18)
> - *M*
> samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-2>
> (96)
> - *M*
> samples/client/petstore/typescript-angular-v2/default/api/store.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-3>
> (52)
> - *M*
> samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-4>
> (100)
> - *M*
> samples/client/petstore/typescript-angular-v2/default/configuration.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-5>
> (18)
> - *M*
> samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-6>
> (96)
> - *M*
> samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-7>
> (52)
> - *M*
> samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-8>
> (100)
> - *M*
> samples/client/petstore/typescript-angular-v2/npm/configuration.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-9>
> (18)
> - *M*
> samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-10>
> (96)
> - *M*
> samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-11>
> (52)
> - *M*
> samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-12>
> (100)
> - *M*
> samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-13>
> (18)
> - *M*
> samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-14>
> (100)
> - *M*
> samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-15>
> (54)
> - *M*
> samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-16>
> (108)
> - *M*
> samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-17>
> (18)
> - *M*
> samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-18>
> (96)
> - *M*
> samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-19>
> (52)
> - *M*
> samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-20>
> (100)
> - *M*
> samples/client/petstore/typescript-angular-v4/npm/configuration.ts
> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-21>
> (18)
>
> Patch Links:
>
> - https://github.com/swagger-api/swagger-codegen/pull/6945.patch
> - https://github.com/swagger-api/swagger-codegen/pull/6945.diff
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#6945>, or mute the
> thread
> <https://github.com/notifications/unsubscribe-auth/AMPLtYXl0sQowPiStEARGplLy8Sjo0TZks5s2BorgaJpZM4Qbi_A>
> .
>
|
|
Another suggestion would be to use the exclude option for tslint to ignore
the generated code. https://palantir.github.io/tslint/usage/configuration/
On Mon, Nov 13, 2017, 5:37 AM Kenneth Steward <keni.steward@gmail.com>
wrote:
… What o truly suggest is not putting the code into you project but building
it and serving it as a bundle . The code is generated and shouldn't really
be changed by hand.
On Mon, Nov 13, 2017, 5:36 AM Kenneth Steward ***@***.***>
wrote:
> Your winter might break others due to the nature of linting I do not
> suggest this pe be merged . Just lint iit in your own project
>
> On Mon, Nov 13, 2017, 5:30 AM Meindert Deen ***@***.***>
> wrote:
>
>> Technical committee: @TiFu <https://github.com/tifu> @taxpon
>> <https://github.com/taxpon> @sebastianhaas
>> <https://github.com/sebastianhaas> @kenisteward
>> <https://github.com/kenisteward> @Vrolijkx <https://github.com/vrolijkx>
>> PR checklist
>>
>> - [x ] Read the contribution guidelines
>> <https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md>
>> .
>> - [x ] Ran the shell script under ./bin/ to update Petstore sample
>> so that CIs can verify the change. (For instance, only need to run
>> ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if
>> updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG}
>> client's mustache templates). Windows batch files can be found in
>> .\bin\windows\.
>> - [ x] Filed the PR against the correct branch: 3.0.0 branch for
>> changes related to OpenAPI spec 3.0. Default: master.
>> - [x ] Copied the technical committee
>> <https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee>
>> to review the pull request if your PR is targeting a particular programming
>> langauge.
>>
>> Description of the PR
>>
>> When I added the generated Typescript Angular code to my project, my
>> 'tslint' did not like the generated code. I updated the code to make my
>> 'tslint' happy. This PR is to share my changes with the community.
>> ------------------------------
>> You can view, comment on, or merge this pull request online at:
>>
>> #6945
>> Commit Summary
>>
>> - better compliance with tslint
>> - Merge branch 'master' into typescript_angular_linting_fixes
>>
>> File Changes
>>
>> - *M*
>> modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-0>
>> (30)
>> - *M*
>> modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-1>
>> (18)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-2>
>> (96)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/default/api/store.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-3>
>> (52)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-4>
>> (100)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/default/configuration.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-5>
>> (18)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-6>
>> (96)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-7>
>> (52)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-8>
>> (100)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/npm/configuration.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-9>
>> (18)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-10>
>> (96)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-11>
>> (52)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-12>
>> (100)
>> - *M*
>> samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-13>
>> (18)
>> - *M*
>> samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-14>
>> (100)
>> - *M*
>> samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-15>
>> (54)
>> - *M*
>> samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-16>
>> (108)
>> - *M*
>> samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-17>
>> (18)
>> - *M*
>> samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-18>
>> (96)
>> - *M*
>> samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-19>
>> (52)
>> - *M*
>> samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-20>
>> (100)
>> - *M*
>> samples/client/petstore/typescript-angular-v4/npm/configuration.ts
>> <https://github.com/swagger-api/swagger-codegen/pull/6945/files#diff-21>
>> (18)
>>
>> Patch Links:
>>
>> - https://github.com/swagger-api/swagger-codegen/pull/6945.patch
>> - https://github.com/swagger-api/swagger-codegen/pull/6945.diff
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <#6945>, or mute the
>> thread
>> <https://github.com/notifications/unsubscribe-auth/AMPLtYXl0sQowPiStEARGplLy8Sjo0TZks5s2BorgaJpZM4Qbi_A>
>> .
>>
>
|
|
So I think what @kenisteward suggested is to use customized templates to meet different linting requirement and use the |
|
@wing328 that is definitely one way of going about it. I honestly forgot about that! haha. I was trying to give a solution without them having to learn the inner workings of mustache stuff. @gupbeheer while your changes meet your (and mostly my) ts lint restrictions there are some of them that are preferential and definitely may not (e.g. forcing single quotes instead of double is based on preference not necessity) You could definitely create your own templates that fit your coding style but to be honest linting mostly covers keeping code made by developers under check to make sure we write similar code (in my opinion). Since this is generated, you can just ignore linting rules on this folder as you (should) never be working directly on this code. |
|
I go with @kenisteward here, I would recommend not putting the auto-generated sources in your project but rather include it per npm and use it as a dependency. |
|
No problem. I saw the code I committed in #6751 and the linting errors that came up in the files I committed were 90% my new code. So I made it more 'as the other code' and made the linting pass. I thought I should contribute this. That is the reason for this PR. |
|
@gupbeheer great to hear! If you could close this issue then that'd be great :) |
Technical committee: @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.3.0.0branch for changes related to OpenAPI spec 3.0. Default:master.Description of the PR
When I added the generated Typescript Angular code to my project, my 'tslint' did not like the generated code. I updated the code to make my 'tslint' happy. This PR is to share my changes with the community.