ts-interface-checker icon indicating copy to clipboard operation
ts-interface-checker copied to clipboard

Add tslint:disable:variable-name for linters that ensure variable writing

Open JanFellner opened this issue 5 years ago • 2 comments

Where Interfaces are required to start with a capsule letter (forced to I on our side), the variable names shall be lower case. The Linter checks that on our side.

The interface-checker-compiler creates out of the interface declaration objects which have a Capsule Letter

The Linter config: "variable-name": { "options": [ "check-format" ] },

The Source: interface ISDP { profile: string, local: string, remote: string, }

The generated code: export const IJanusAdminSDP = t.iface([], { "profile": "string", "local": "string", "remote": "string", });

Possible workarounds: Add // tslint:disable:variable-name where you also add // tslint:disable:object-literal-key-quotes

Or generate objects which follow best practice naming of variables. https://basarat.gitbooks.io/typescript/docs/styleguide/styleguide.html#variable-and-function

JanFellner avatar Oct 24 '19 07:10 JanFellner

Happy to have a PR adding tslint directive. Changing the variable name seems trickier -- now it matches the name of the interface it represents. We could add a "ti" prefix or something, but it may create annoyances, and is not backward compatible.

dsagal avatar Oct 24 '19 08:10 dsagal

I solved it with totally excluding those files from the linter. "linterOptions": { "exclude": [ "*-ti.ts" ] },

JanFellner avatar Oct 25 '19 09:10 JanFellner