Skip to content
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

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

Open
JanFellner opened this issue Oct 24, 2019 · 2 comments

Comments

@JanFellner
Copy link

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

@dsagal
Copy link
Member

dsagal commented Oct 24, 2019

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.

@JanFellner
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants