-
-
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.
feat(utils): allow specifying additional rule meta.docs in RuleCreator (
#9025) * feat(utils): [RuleCreator] require specifying additional rule meta.docs * test fix * Explicit start and end types * Fix lint failures * lil more linting
- Loading branch information
1 parent
07044c6
commit b1c92d4
Showing
25 changed files
with
227 additions
and
126 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
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
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,5 +1,37 @@ | ||
import { ESLintUtils } from '@typescript-eslint/utils'; | ||
import type { | ||
RuleModuleWithMetaDocs, | ||
RuleRecommendation, | ||
RuleRecommendationAcrossConfigs, | ||
} from '@typescript-eslint/utils/ts-eslint'; | ||
|
||
export const createRule = ESLintUtils.RuleCreator( | ||
export interface ESLintPluginDocs { | ||
/** | ||
* Does the rule extend (or is it based off of) an ESLint code rule? | ||
* Alternately accepts the name of the base rule, in case the rule has been renamed. | ||
* This is only used for documentation purposes. | ||
*/ | ||
extendsBaseRule?: boolean | string; | ||
|
||
/** | ||
* If a string config name, which starting config this rule is enabled in. | ||
* If an object, which settings it has enabled in each of those configs. | ||
*/ | ||
recommended?: RuleRecommendation | RuleRecommendationAcrossConfigs<unknown[]>; | ||
|
||
/** | ||
* Does the rule require us to create a full TypeScript Program in order for it | ||
* to type-check code. This is only used for documentation purposes. | ||
*/ | ||
requiresTypeChecking?: boolean; | ||
} | ||
|
||
export const createRule = ESLintUtils.RuleCreator<ESLintPluginDocs>( | ||
name => `https://typescript-eslint.io/rules/${name}`, | ||
); | ||
|
||
export type ESLintPluginRuleModule = RuleModuleWithMetaDocs< | ||
string, | ||
readonly unknown[], | ||
ESLintPluginDocs | ||
>; |
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
Oops, something went wrong.