-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
410e17b
commit 5d356c4
Showing
3 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @fileoverview Allow multiple configurations of a rule without overriding it. | ||
* @author | ||
* 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
declare module "@weiran.zsd/multi-eslint-rule-config" { | ||
import { Linter, Rule } from "eslint"; | ||
|
||
interface RuleOptions { | ||
rule: string | Rule.RuleModule; | ||
ruleConfig: Linter.RuleEntry; | ||
asRuleName?: string; | ||
plugin?: { | ||
rules: Record<string, Rule.RuleModule>; | ||
}; | ||
} | ||
|
||
interface ConfigOptions { | ||
name: string; | ||
plugins: { | ||
[prefix: string]: { | ||
meta: { | ||
name: string; | ||
version: string; | ||
}; | ||
rules: Record<string, Rule.RuleModule>; | ||
}; | ||
}; | ||
rules: Record<string, Linter.RuleEntry>; | ||
} | ||
|
||
/** | ||
* Generates a configuration object for ESLint with multiple rule configurations. | ||
* | ||
* @param options - Array or single item containing rule options to configure. | ||
* @param prefix - Optional prefix to use for the plugin (default is "@@"). | ||
* @returns The generated configuration object. | ||
*/ | ||
export function config( | ||
options: RuleOptions | RuleOptions[], | ||
prefix?: string, | ||
): ConfigOptions; | ||
} |
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