vscode-react-typescript
vscode-react-typescript copied to clipboard
Interface names should not necessarily start with I
I've used this extension for a couple of weeks but today I got tired of removing I-s from Interface names, so I read up on all guidelines and practices I found and it seems most agree with me.
I know this was changed as a response to #11 but I'd like to point out that that problem was caused by a setting in someones tslint file, probably one like this: https://palantir.github.io/tslint/rules/interface-name/
The official Typescript documemtation clearly avoids prefixing interface names with I as seen here: https://www.typescriptlang.org/docs/handbook/interfaces.html, which is reasonable since Typescript is a typed language mostly written in IDEs where syntax hightlighting is good and it is easy to lookup definitions.
Also the guidelines for developing Typescript, while not prescriptive for projects using Typescript, also tells contributors to not prefix interface names with I: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
Also here is a stackoverflow answer that add some detail: https://stackoverflow.com/a/41967120
For anyone who says: "but the tslint must be right", I'd like to point out that this is easily adjustable, just set "interface-name": [true, "never-prefix"]
and you'll get sane behaviour from tslint from now on :-)
I'll probably just create my own snippets but I thought it was worth pointing out as a way to give something back help avoid people doing what I and many other thinks is a bad thing just because the default template suggest it.
Alternatively we can keep both, just prefix the current ones with dndt_
(for do not do this) and add a comment with a TODO: fix tslint-files to not suggest prefixing interfaces with I, see: https://stackoverflow.com/a/41967120
;-)
Thank you for your suggestion, I will make some changes later.