-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove legacy rule function form"
This reverts commit e053179.
- Loading branch information
1 parent
6b6e249
commit bc6d611
Showing
5 changed files
with
51 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import type { RuleModule } from '../ts-eslint'; | ||
import type { RuleCreateFunction, RuleModule } from '../ts-eslint'; | ||
|
||
/** | ||
* Uses type inference to fetch the Options type from the given RuleModule | ||
*/ | ||
type InferOptionsTypeFromRule<T> = | ||
T extends RuleModule<infer _MessageIds, infer Options> ? Options : unknown; | ||
T extends RuleModule<infer _MessageIds, infer Options> | ||
? Options | ||
: T extends RuleCreateFunction<infer _MessageIds, infer Options> | ||
? Options | ||
: unknown; | ||
|
||
/** | ||
* Uses type inference to fetch the MessageIds type from the given RuleModule | ||
*/ | ||
type InferMessageIdsTypeFromRule<T> = | ||
T extends RuleModule<infer MessageIds, infer _TOptions> | ||
? MessageIds | ||
: unknown; | ||
: T extends RuleCreateFunction<infer MessageIds, infer _TOptions> | ||
? MessageIds | ||
: unknown; | ||
|
||
export { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule }; |
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