添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
老实的电梯  ·  C# ...·  4 月前    · 
开朗的咖啡  ·  编辑轴 - Tableau·  7 月前    · 

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

Hello, I am currently using tslint as a linter for my ts files and I was ignoring the ts file, generated by your awesome lib.
Now, tslint started to deprecate the unused varuable flag ( Start to deprecate no-unused-variable rule ) , because in newer versions of Typescript noUnusedParameters and noUnusedLocals flags have been added ( Flag unused declarations with --noUnusedParameters and --noUnusedLocals )
If you set them to true and try to compile the ts file, generated by NSwag you will get at least :

  • error TS6133: 'caught' is declared but never used, when setting noUnusedParameters to true (caused by this )
  • error TS6133: 'RequestOptionsArgs' is declared but never used, when setting noUnusedLocals to true (caused by this )
  • As far as I can see the latest is caused, because it is used in the TransformOptionsMethod here

    There might be some other errors, those are the onse I stumbled upon.
    Thank you!

    @RSuter You can't disable validation currently because it's at the TypeScript compiler level.

    I have some changes in a branch to solve the particular issues here, but I couldn't send a PR last night because of the diff problem .

    We'll probably want to go through the other clients besides Angular 2 and check those as well.

    @RSuter Yes, you can skip the validation with TSLint for some files, but you shouldn't bother with TSLint, mostly because its usage is optional and the usage of the TS compiler is required : )

    As @grovesNL said, those flags are now part of the Typescript compiler itself. You can disasble the validation if you set them to false(the default values), but you can't disable them for some files . So It's either on or off for all of your ts files. As I said, and as @grovesNL pointed out, there might be some other problems (due to some other flags in the TS compiler config) and in other TS templates from(I posted this issue just for the Angular2 template).

    We could start with min NSwag configuration, generate all of the possible TS templates and then run them with through the TS compiler with max strictness options. Something like:

    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,