docs(eslint-plugin):improve docs [consistent-type-exports]#4792
docs(eslint-plugin):improve docs [consistent-type-exports]#4792JoshuaKGoldberg merged 25 commits intotypescript-eslint:mainfrom
Conversation
|
Thanks for the PR, @kmin-jeong! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Josh-Cena
left a comment
There was a problem hiding this comment.
Missing the example in the "rule details" section
|
|
||
| - If you are using a TypeScript version less than 3.8, then you will not be able to use this rule as type exports are not supported. | ||
| - If you specifically want to use both export kinds for stylistic reasons, you can disable this rule. | ||
| - Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'. |
There was a problem hiding this comment.
Probably a minor rewording so it goes more along the lines of "If you use --isolatedModules you don't need this rule since TS would enforce type-export specifiers"
| # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) | ||
|
|
||
|
|
||
| export interface ButtonProps{ | ||
| onClick: () => void; | ||
| } | ||
|
|
||
| class Button implements ButtonProps { | ||
| onClick(){ | ||
| console.log('button!') | ||
| } | ||
| } |
There was a problem hiding this comment.
The example should illustrated re-exporting types. For example:
| export interface ButtonProps{ | |
| onClick: () => void; | |
| } | |
| class Button implements ButtonProps { | |
| onClick(){ | |
| console.log('button!') | |
| } | |
| } | |
| interface ButtonProps { | |
| onClick: () => void; | |
| } | |
| class Button implements ButtonProps { | |
| onClick() { | |
| console.log('button!'); | |
| } | |
| } | |
| export { Button }; | |
| export type { ButtonProps }; |
Probably we should also give an invalid example, like export { Button, ButtonProps };
Also, I believe code style can be fixed with Prettier. Please remember to format files before committing.
|
|
||
| - If you are using a TypeScript version less than 3.8, then you will not be able to use this rule as type exports are not supported. | ||
| - If you specifically want to use both export kinds for stylistic reasons, you can disable this rule. | ||
| - If you use --isolatedModules, you don't need this rule since TS would enforce type-export specifiers. |
There was a problem hiding this comment.
Not critical, but I think it's clearer this way:
| - If you use --isolatedModules, you don't need this rule since TS would enforce type-export specifiers. | |
| - If you use `--isolatedModules`, you don't need this rule since the compiler would error if a type is not re-exported using `export type`. |
fix examples and --Isolatedmodules explain
| //invalid example | ||
| export { Button, ButtonProps }; |
There was a problem hiding this comment.
Please refer to how other rule docs are written. You should use two tabs, one incorrect and one correct.
There was a problem hiding this comment.
@Josh-Cena Should I write more explanations about the wrong example?
one is correct, another is incorrect
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Thanks for sending! +1 to what Josh-Cena said, and one little change from me please. 🙂
|
@JoshuaKGoldberg @Josh-Cena @bradzacher |
| # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Again, I think this needs to be reverted
There was a problem hiding this comment.
@Josh-Cena ok! I revert the change log and modify the When Not To Use It part splitting two items now!
|
|
||
| - If you are using a TypeScript version less than 3.8, then you will not be able to use this rule as type exports are not supported. | ||
| - If you specifically want to use both export kinds for stylistic reasons, you can disable this rule. | ||
| - If you use `--isolatedModules` the compiler would error if a type is not re-exported using `export type`. If you also don't wish to enforce one style over the other, you can disable this rule. |
|
@Josh-Cena Does it still look reverted in changelog.md? |
|
@Josh-Cena I commit the code with the message "fix: revert change log" yesterday after reverting changelog.md. |
|
You shouldn't change changelog.md at all. |
|
@Josh-Cena |
|
Yes, this looks good to me. Just waiting for one of the maintainers to review it :) |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Thanks @kmin-jeong and @Josh-Cena! This looks great! 🙌
PR Checklist
Overview
I remove duplicate exports in the "correct" example for fixMixedExportsWithInlineTypeSpecifier. and I add about 'isolatedModules' to "When Not To Use It".
I wish reviewers check to see if it has been modified to fit the context.