-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use join type for other rules
- Loading branch information
Showing
7 changed files
with
133 additions
and
142 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,11 +1,2 @@ | ||
import type { TSESTree } from '@typescript-eslint/types' | ||
|
||
export interface SortingNode<Node extends TSESTree.Node = TSESTree.Node> { | ||
hasMultipleImportDeclarations?: boolean | ||
addSafetySemicolonWhenInline?: boolean | ||
isEslintDisabled: boolean | ||
group?: string | ||
name: string | ||
size: number | ||
node: Node | ||
} | ||
export type { JoinWithDash } from './join-with-dash' | ||
export type { SortingNode } from './sorting-node' |
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import type { Join } from './join' | ||
|
||
export type JoinWithDash<T extends string[]> = Join<T, '-'> |
This file contains 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export type Join<T extends string[], Separator extends string> = T extends [ | ||
infer First extends string, | ||
...infer Rest extends string[], | ||
] | ||
? Rest extends [] | ||
? `${First}` | ||
: `${WithSeparatorOrEmpty<First, Separator>}${Join<Rest, Separator>}` | ||
: never | ||
|
||
type WithSeparatorOrEmpty<T extends string, Separator extends string> = | ||
| `${T}${Separator}` | ||
| '' |
Oops, something went wrong.