-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
eslint-plugin-promise
(#162)
- Loading branch information
1 parent
694223a
commit 87b27f1
Showing
23 changed files
with
415 additions
and
0 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Eslint promise extensions. | ||
* | ||
* @see [Eslint promise extensions](https://github.com/eslint-community/eslint-plugin-promise#usage) | ||
*/ | ||
export type PromiseExtensions = 'plugin:promise/recommended'; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface AlwaysReturnOption { | ||
ignoreLastCallback?: boolean; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type AlwaysReturnOptions = [AlwaysReturnOption?]; | ||
|
||
/** | ||
* | ||
* @see [always-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/always-return.md) | ||
*/ | ||
export type AlwaysReturnRuleConfig = RuleConfig<AlwaysReturnOptions>; | ||
|
||
/** | ||
* | ||
* @see [always-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/always-return.md) | ||
*/ | ||
export interface AlwaysReturnRule { | ||
/** | ||
* | ||
* @see [always-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/always-return.md) | ||
*/ | ||
'promise/always-return': AlwaysReturnRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [avoid-new](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md) | ||
*/ | ||
export type AvoidNewRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [avoid-new](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md) | ||
*/ | ||
export interface AvoidNewRule { | ||
/** | ||
* | ||
* @see [avoid-new](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md) | ||
*/ | ||
'promise/avoid-new': AvoidNewRuleConfig; | ||
} |
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,33 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface CatchOrReturnOption { | ||
allowFinally?: boolean; | ||
allowThen?: boolean; | ||
terminationMethod?: string | string[]; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type CatchOrReturnOptions = [CatchOrReturnOption?]; | ||
|
||
/** | ||
* | ||
* @see [catch-or-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/catch-or-return.md) | ||
*/ | ||
export type CatchOrReturnRuleConfig = RuleConfig<CatchOrReturnOptions>; | ||
|
||
/** | ||
* | ||
* @see [catch-or-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/catch-or-return.md) | ||
*/ | ||
export interface CatchOrReturnRule { | ||
/** | ||
* | ||
* @see [catch-or-return](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/catch-or-return.md) | ||
*/ | ||
'promise/catch-or-return': CatchOrReturnRuleConfig; | ||
} |
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,34 @@ | ||
import type { AlwaysReturnRule } from './always-return'; | ||
import type { AvoidNewRule } from './avoid-new'; | ||
import type { CatchOrReturnRule } from './catch-or-return'; | ||
import type { NoCallbackInPromiseRule } from './no-callback-in-promise'; | ||
import type { NoMultipleResolvedRule } from './no-multiple-resolved'; | ||
import type { NoNativeRule } from './no-native'; | ||
import type { NoNestingRule } from './no-nesting'; | ||
import type { NoNewStaticsRule } from './no-new-statics'; | ||
import type { NoPromiseInCallbackRule } from './no-promise-in-callback'; | ||
import type { NoReturnInFinallyRule } from './no-return-in-finally'; | ||
import type { NoReturnWrapRule } from './no-return-wrap'; | ||
import type { ParamNamesRule } from './param-names'; | ||
import type { PreferAwaitToCallbacksRule } from './prefer-await-to-callbacks'; | ||
import type { PreferAwaitToThenRule } from './prefer-await-to-then'; | ||
import type { ValidParamsRule } from './valid-params'; | ||
|
||
/** | ||
* All Promise rules. | ||
*/ | ||
export type PromiseRules = ParamNamesRule & | ||
NoReturnWrapRule & | ||
AlwaysReturnRule & | ||
CatchOrReturnRule & | ||
PreferAwaitToCallbacksRule & | ||
PreferAwaitToThenRule & | ||
NoNativeRule & | ||
NoCallbackInPromiseRule & | ||
NoPromiseInCallbackRule & | ||
NoNestingRule & | ||
AvoidNewRule & | ||
NoNewStaticsRule & | ||
NoReturnInFinallyRule & | ||
ValidParamsRule & | ||
NoMultipleResolvedRule; |
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,32 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface NoCallbackInPromiseOption { | ||
exceptions?: string[]; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type NoCallbackInPromiseOptions = [NoCallbackInPromiseOption?]; | ||
|
||
/** | ||
* | ||
* @see [no-callback-in-promise](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md) | ||
*/ | ||
export type NoCallbackInPromiseRuleConfig = | ||
RuleConfig<NoCallbackInPromiseOptions>; | ||
|
||
/** | ||
* | ||
* @see [no-callback-in-promise](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md) | ||
*/ | ||
export interface NoCallbackInPromiseRule { | ||
/** | ||
* | ||
* @see [no-callback-in-promise](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md) | ||
*/ | ||
'promise/no-callback-in-promise': NoCallbackInPromiseRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-multiple-resolved](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-multiple-resolved.md) | ||
*/ | ||
export type NoMultipleResolvedRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-multiple-resolved](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-multiple-resolved.md) | ||
*/ | ||
export interface NoMultipleResolvedRule { | ||
/** | ||
* | ||
* @see [no-multiple-resolved](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-multiple-resolved.md) | ||
*/ | ||
'promise/no-multiple-resolved': NoMultipleResolvedRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-native](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-native.md) | ||
*/ | ||
export type NoNativeRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-native](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-native.md) | ||
*/ | ||
export interface NoNativeRule { | ||
/** | ||
* | ||
* @see [no-native](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-native.md) | ||
*/ | ||
'promise/no-native': NoNativeRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-nesting](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-nesting.md) | ||
*/ | ||
export type NoNestingRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-nesting](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-nesting.md) | ||
*/ | ||
export interface NoNestingRule { | ||
/** | ||
* | ||
* @see [no-nesting](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-nesting.md) | ||
*/ | ||
'promise/no-nesting': NoNestingRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-new-statics](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-new-statics.md) | ||
*/ | ||
export type NoNewStaticsRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-new-statics](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-new-statics.md) | ||
*/ | ||
export interface NoNewStaticsRule { | ||
/** | ||
* | ||
* @see [no-new-statics](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-new-statics.md) | ||
*/ | ||
'promise/no-new-statics': NoNewStaticsRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-promise-in-callback](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-promise-in-callback.md) | ||
*/ | ||
export type NoPromiseInCallbackRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-promise-in-callback](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-promise-in-callback.md) | ||
*/ | ||
export interface NoPromiseInCallbackRule { | ||
/** | ||
* | ||
* @see [no-promise-in-callback](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-promise-in-callback.md) | ||
*/ | ||
'promise/no-promise-in-callback': NoPromiseInCallbackRuleConfig; | ||
} |
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,19 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* | ||
* @see [no-return-in-finally](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-in-finally.md) | ||
*/ | ||
export type NoReturnInFinallyRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* | ||
* @see [no-return-in-finally](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-in-finally.md) | ||
*/ | ||
export interface NoReturnInFinallyRule { | ||
/** | ||
* | ||
* @see [no-return-in-finally](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-in-finally.md) | ||
*/ | ||
'promise/no-return-in-finally': NoReturnInFinallyRuleConfig; | ||
} |
Oops, something went wrong.