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

docs(eslint-plugin):improve docs [consistent-type-exports] #4792

Merged
merged 25 commits into from
Apr 11, 2022

Conversation

kmin-jeong
Copy link
Contributor

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.

@nx-cloud
Copy link

nx-cloud bot commented Apr 7, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 2f2bb8d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 43 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

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.

@netlify
Copy link

netlify bot commented Apr 7, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 2f2bb8d
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/625372e39c1e2a0009b02954
😎 Deploy Preview https://deploy-preview-4792--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the example in the "rule details" section

export { Button, type ButtonProps } from 'some-library';
```

## When Not To Use It

- 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'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,7 +5,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this?

Comment on lines 18 to 26
export interface ButtonProps{
onClick: () => void;
}

class Button implements ButtonProps {
onClick(){
console.log('button!')
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example should illustrated re-exporting types. For example:

Suggested change
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.

export { Button, type ButtonProps } from 'some-library';
```

## When Not To Use It

- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical, but I think it's clearer this way:

Suggested change
- 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
Comment on lines 28 to 29
//invalid example
export { Button, ButtonProps };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to how other rule docs are written. You should use two tabs, one incorrect and one correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Josh-Cena Should I write more explanations about the wrong example?

one is correct, another is incorrect
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending! +1 to what Josh-Cena said, and one little change from me please. 🙂

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Apr 8, 2022
@bradzacher bradzacher added documentation Documentation ("docs") that needs adding/updating awaiting response Issues waiting for a reply from the OP or another party and removed awaiting response Issues waiting for a reply from the OP or another party labels Apr 9, 2022
@kmin-jeong
Copy link
Contributor Author

@JoshuaKGoldberg @Josh-Cena @bradzacher
Is there anything else I need to modify?

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 9, 2022
@@ -5,7 +5,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04)


Copy link
Member

@Josh-Cena Josh-Cena Apr 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think this needs to be reverted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Josh-Cena ok! I revert the change log and modify the When Not To Use It part splitting two items now!

export { Button, type ButtonProps } from 'some-library';
```

## When Not To Use It

- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split this into two items

@kmin-jeong
Copy link
Contributor Author

@Josh-Cena Does it still look reverted in changelog.md?

@Josh-Cena
Copy link
Member

You can check yourself in https://github.com/typescript-eslint/typescript-eslint/pull/4792/files :)

@kmin-jeong
Copy link
Contributor Author

@Josh-Cena I commit the code with the message "fix: revert change log" yesterday after reverting changelog.md.
I compared and fixed the changelog.md in the typescript-eslint branch and the changelog in the kminjeong branch
Is there any sentence that needs to be removed or reverted from the changelog?

@Josh-Cena
Copy link
Member

You shouldn't change changelog.md at all.

@kmin-jeong
Copy link
Contributor Author

@Josh-Cena
Then, have the required modifications been satisfied?

@Josh-Cena
Copy link
Member

Yes, this looks good to me. Just waiting for one of the maintainers to review it :)

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kmin-jeong and @Josh-Cena! This looks great! 🙌

@JoshuaKGoldberg JoshuaKGoldberg merged commit 255eea8 into typescript-eslint:main Apr 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation ("docs") that needs adding/updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[consistent-type-exports] Improve docs
4 participants