-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docs(eslint-plugin):improve docs [consistent-type-exports] #4792
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5b79028
feat: update repository
kmin-jeong 5c3af4d
remove duplicate examples
kmin-jeong f5674a8
feat:add about re-exporting --isolatedModules in When Not To Use It
kmin-jeong d47eeb4
feat: add exmaples
kmin-jeong 6f74fea
fix: remove duplicate examples in correct
kmin-jeong 7fb6dc7
fix:correct words
kmin-jeong e77ae67
fix: fix space-between
kmin-jeong 2572fd6
fix: fix code
kmin-jeong 40f496f
fix: fix code space
kmin-jeong b508138
fix: check error
kmin-jeong 70dc242
fix:missed examples
kmin-jeong c895ad8
feat: read review and fix them
kmin-jeong 6158e57
feat: add two taps
kmin-jeong c4a25fd
fix: add <!--tabs-->
kmin-jeong cc71bea
feat: fix explaination about `isolatedmodules`
kmin-jeong 251f49e
fix: fix explain about `isolatedModules`
kmin-jeong d42a546
fis: modify When no to use it
kmin-jeong f1c3ce4
fix: revert change log
kmin-jeong 4246b6b
fix: add lint
kmin-jeong c1af45c
fix: add lint
kmin-jeong 42d8958
add: fix code
kmin-jeong efd3668
fix:fix docs splits
kmin-jeong 8b4f9de
feat: add lint
kmin-jeong 24c0f2e
Update packages/eslint-plugin/docs/rules/consistent-type-exports.md
JoshuaKGoldberg 2f2bb8d
Merge branch 'main' into master
kmin-jeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,37 @@ This rule aims to standardize the use of type exports style across a codebase. | |
|
||
Given a class `Button`, and an interface `ButtonProps`, examples of code: | ||
|
||
<!--tabs--> | ||
|
||
### ❌ Incorrect | ||
|
||
```ts | ||
interface ButtonProps { | ||
onClick: () => void; | ||
} | ||
class Button implements ButtonProps { | ||
onClick() { | ||
console.log('button!'); | ||
} | ||
} | ||
export { Button, ButtonProps }; | ||
``` | ||
|
||
### ✅ Correct | ||
|
||
```ts | ||
interface ButtonProps { | ||
onClick: () => void; | ||
} | ||
class Button implements ButtonProps { | ||
onClick() { | ||
console.log('button!'); | ||
} | ||
} | ||
export { Button }; | ||
export type { ButtonProps }; | ||
``` | ||
|
||
## Options | ||
|
||
```ts | ||
|
@@ -70,15 +101,14 @@ export type { ButtonProps } from 'some-library'; | |
### ✅ Correct | ||
|
||
```ts | ||
export { Button } from 'some-library'; | ||
export type { ButtonProps } from 'some-library'; | ||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Split this into two items |
||
|
||
## Attributes | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.