ts-interface-checker
ts-interface-checker copied to clipboard
Add tslint:disable:variable-name for linters that ensure variable writing
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
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.
I solved it with totally excluding those files from the linter. "linterOptions": { "exclude": [ "*-ti.ts" ] },