Hello @Romakita
I would like to propose to change code style
I propose following:
I. add tslint.const instead of let if the variable is not reassignedany if the type can be specified, can have exceptions<type>varName -> varName as typeArray<T> -> T[]{format: format} -> {format}new MyObject -> new MyObject()The list is not finished.
Just want to discuss that and I can do some refactoring after.
Thanks!
Use single quote instead of double quote
2 space for indentation code, instead 4 space
All interfaces should start with I. add tslint. Issue #350
Hello @troyanskiy,
1 and 2. I follow the official guideline https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
Double quote and 4 spaces are recommended by Microsoft, also, default tslint configuration follow this rules too. I know, many of you (@milewski ^^) want use the single quote and 2 spaces in the code XD. I use this convention with eslint.
I propose a vote for that ;).
varName as type, ok :)Thanks for your proposals, I'm happy about that ;)
See you,
Romain
@troyanskiy You can work on the rules which are simple to set up in a first and on which we are ok :)
do never user I for interface they ended up removing this recommendation due to fight with some users coming from other languages where I is kind of standard for interface: example: https://github.com/Microsoft/TypeScript-Handbook/issues/121, but i kind agree not using I because nothing starting with I l (iL) looks pretty anyways....<type>varName ts team discourage this way.. it is legacy and i forgot where in their doc i read it to stop using it T[] it also a official recommendation {format}new MyObject()Yes for the "I" it's a problem. I started with, but now some interfaces doesn't follow this rules. Now, we can follow this rules and prepare the code migration to this goal. I can create an Issue about that.
Also, we can add a guideline section in the contributions.md about the code style adopted by us :)
in my daily life the convention i adopt for interfaces as well as other codding patterns are the one usually used within the php community,
SomethingInterface, SomethingAbstract, SomethingRepository, SomethingFactory, SomethingRegistry so on....
Story was created here #350
Ok. So. I will create a branch for each subrefacoring task and will start some refactoring.
Or how it鈥檚 better to do?
PS: Personally i don鈥檛 agree with some MS recommendation. Aspacially about double quote and 4 spaces :)
Yes a branch for each subrefactoring task is a better solution ;)
I know, this is why you have created this topics :p
Hahaha @Romakita totally right ;)
or perhaps we could use prettier https://github.com/prettier/prettier \o/ i dont agree with some of their rules but in the end in the team i work on everything averages out... besides it has been mass adopted by many big open source projects out there
So.
To summarize
Moved to the first comment of the issue
Add to coding styles one more rule
Kind of new line before return;
public set(target: Type<any> | symbol, provider: I) {
this.registry.merge(target, provider);
return this;
}
Should be like that
public set(target: Type<any> | symbol, provider: I) {
this.registry.merge(target, provider);
return this;
}
Please vote for that with likes or dislikes
Changes have been done in https://github.com/Romakita/ts-express-decorators/tree/style-no-unused-variables branch.
@Romakita Could you please check my commit comments plz?
Thanks!
@milewski Why not, prettier could be a nice solution :).
Who work on this ?
If you are all in favor of prettier I can do it... :)
@milewski I'm totally for that if it will replace all double quotes to single and replaces all ident with 2 spaces... :D
At least you can play with it and see the result.
I have added to line new line before return.
@milewski You can work on prettier ;)
Hi all,
There remains only this:
Otherwise, prettier work fine :)
Good works guys !
See you
@Romakita I think we can close the issue.
It's really hard to put now the rule to tslint no to use any because it will be tonnes of errors at linting.
Most helpful comment
Add to coding styles one more rule
Kind of new line before return;
Should be like that
Please vote for that with likes or dislikes