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
Use eslint-config-xo-typescript
#1740
Conversation
package.json
Outdated
} | ||
] | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-type-alias": "off", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really struggling to figure out what options to set for this rule. See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
There's no clear answer when to use interface
or type
...
https://stackoverflow.com/questions/37233735/typescript-interfaces-vs-types
https://medium.com/@martin_hotell/interface-vs-type-alias-in-typescript-2-7-2a8f1777af4c
Feedback wanted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In regards to a type vs. Interface, a type is just an alias.
The implications of that are that you can't use declaration merging with a type that is defined with the "type" keyword. So if you expose it in your declaration files, devs won't be able to enhance that particular type. So in that case prefer an interface.
See https://twitter.com/nickytonline/status/1114351742945247234
package.json
Outdated
"varsIgnorePattern": "^React$" | ||
} | ||
] | ||
"@typescript-eslint/explicit-function-return-type": "off", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfred-it Are you ok with making all void functions explicit?
Meaning async function init() {
=> async function init(): void {
This will prevent us from accidentally return something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: void
sounds fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll leave that for a separate PR. It's quite a big change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickytonline do you have time to drop this rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look at it later tonight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also suggested: b6f6c97
@bfred-it This is ready for another look. |
or that don't currently cause errors
Thoughts on 6b3200a? |
Why the |
Because we prefer self-explanatory variable names. Why have a custom rule when we can just use the regular name (regulated by a third rule nonetheless) |
I use
|
But doesn't matter. Soon we can just remove the variable all together. |
Thanks for reviewing :) |
Oh, didn’t realize that it was a default in xo as well 😅 |
I think TypeScript, Firefox and Chrome all already support the optional Build passes too: |
No description provided.