From 755d81db0f85c524ad66046e6655eb15c4baca19 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Mon, 2 Jan 2023 14:03:51 +0100 Subject: [PATCH] feat: add `eslint-plugin-promise` --- package.json | 1 + pnpm-lock.yaml | 11 ++++++ .../generate-rule-files/src/plugins-map.ts | 6 ++++ src/config/extends/eslint-plugin-promise.d.ts | 6 ++++ src/config/extends/index.d.ts | 2 ++ src/config/plugin.d.ts | 1 + src/rules/index.d.ts | 2 ++ src/rules/promise/always-return.d.ts | 31 +++++++++++++++++ src/rules/promise/avoid-new.d.ts | 19 +++++++++++ src/rules/promise/catch-or-return.d.ts | 33 ++++++++++++++++++ src/rules/promise/index.d.ts | 34 +++++++++++++++++++ src/rules/promise/no-callback-in-promise.d.ts | 32 +++++++++++++++++ src/rules/promise/no-multiple-resolved.d.ts | 19 +++++++++++ src/rules/promise/no-native.d.ts | 19 +++++++++++ src/rules/promise/no-nesting.d.ts | 19 +++++++++++ src/rules/promise/no-new-statics.d.ts | 19 +++++++++++ src/rules/promise/no-promise-in-callback.d.ts | 19 +++++++++++ src/rules/promise/no-return-in-finally.d.ts | 19 +++++++++++ src/rules/promise/no-return-wrap.d.ts | 31 +++++++++++++++++ src/rules/promise/param-names.d.ts | 32 +++++++++++++++++ .../promise/prefer-await-to-callbacks.d.ts | 19 +++++++++++ src/rules/promise/prefer-await-to-then.d.ts | 19 +++++++++++ src/rules/promise/valid-params.d.ts | 22 ++++++++++++ 23 files changed, 415 insertions(+) create mode 100644 src/config/extends/eslint-plugin-promise.d.ts create mode 100644 src/rules/promise/always-return.d.ts create mode 100644 src/rules/promise/avoid-new.d.ts create mode 100644 src/rules/promise/catch-or-return.d.ts create mode 100644 src/rules/promise/index.d.ts create mode 100644 src/rules/promise/no-callback-in-promise.d.ts create mode 100644 src/rules/promise/no-multiple-resolved.d.ts create mode 100644 src/rules/promise/no-native.d.ts create mode 100644 src/rules/promise/no-nesting.d.ts create mode 100644 src/rules/promise/no-new-statics.d.ts create mode 100644 src/rules/promise/no-promise-in-callback.d.ts create mode 100644 src/rules/promise/no-return-in-finally.d.ts create mode 100644 src/rules/promise/no-return-wrap.d.ts create mode 100644 src/rules/promise/param-names.d.ts create mode 100644 src/rules/promise/prefer-await-to-callbacks.d.ts create mode 100644 src/rules/promise/prefer-await-to-then.d.ts create mode 100644 src/rules/promise/valid-params.d.ts diff --git a/package.json b/package.json index 3f029039..6c0a62e6 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "eslint-plugin-n": "~15.6.0", "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~4.2.1", + "eslint-plugin-promise": "~6.1.1", "eslint-plugin-sonarjs": "~0.17.0", "eslint-plugin-spellcheck": "~0.0.20", "eslint-plugin-unicorn": "~45.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 312a69f8..17ebd6b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,7 @@ specifiers: eslint-plugin-n: ~15.6.0 eslint-plugin-node: ~11.1.0 eslint-plugin-prettier: ~4.2.1 + eslint-plugin-promise: ~6.1.1 eslint-plugin-sonarjs: ~0.17.0 eslint-plugin-spellcheck: ~0.0.20 eslint-plugin-unicorn: ~45.0.2 @@ -61,6 +62,7 @@ devDependencies: eslint-plugin-n: 15.6.0_eslint@8.31.0 eslint-plugin-node: 11.1.0_eslint@8.31.0 eslint-plugin-prettier: 4.2.1_xtjuwoibeoaqavcvkna3ocxxbu + eslint-plugin-promise: 6.1.1_eslint@8.31.0 eslint-plugin-sonarjs: 0.17.0_eslint@8.31.0 eslint-plugin-spellcheck: 0.0.20_eslint@8.31.0 eslint-plugin-unicorn: 45.0.2_eslint@8.31.0 @@ -1898,6 +1900,15 @@ packages: prettier-linter-helpers: 1.0.0 dev: true + /eslint-plugin-promise/6.1.1_eslint@8.31.0: + resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + eslint: 8.31.0 + dev: true + /eslint-plugin-sonarjs/0.17.0_eslint@8.31.0: resolution: {integrity: sha512-jtGtxI49UbJJeJj7CVRLI3+LLH+y+hkR3GOOwM7vBbci9DEFIRGCWvEd2BJScrzltZ6D6iubukTAfc9cyG7sdw==} engines: {node: '>=14'} diff --git a/scripts/generate-rule-files/src/plugins-map.ts b/scripts/generate-rule-files/src/plugins-map.ts index 1db34408..a84fdd65 100644 --- a/scripts/generate-rule-files/src/plugins-map.ts +++ b/scripts/generate-rule-files/src/plugins-map.ts @@ -7,6 +7,8 @@ import eslintPluginJSDoc from 'eslint-plugin-jsdoc'; import eslintPluginJsonc from 'eslint-plugin-jsonc'; import * as eslintPluginMdx from 'eslint-plugin-mdx'; // @ts-expect-error +import eslintPluginPromise from 'eslint-plugin-promise'; +// @ts-expect-error import eslintPluginNode from 'eslint-plugin-node'; // @ts-expect-error import eslintPluginN from 'eslint-plugin-n'; @@ -72,6 +74,10 @@ export const PLUGIN_REGISTRY: Readonly> = { name: 'Node', rules: (eslintPluginNode as Plugin).rules, }, + promise: { + name: 'Promise', + rules: (eslintPluginPromise as Plugin).rules, + }, sonarjs: { name: 'SonarJS', prefix: 'sonarjs', diff --git a/src/config/extends/eslint-plugin-promise.d.ts b/src/config/extends/eslint-plugin-promise.d.ts new file mode 100644 index 00000000..a049d916 --- /dev/null +++ b/src/config/extends/eslint-plugin-promise.d.ts @@ -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'; diff --git a/src/config/extends/index.d.ts b/src/config/extends/index.d.ts index 9daf4c5f..fe9eabc3 100644 --- a/src/config/extends/index.d.ts +++ b/src/config/extends/index.d.ts @@ -7,6 +7,7 @@ import type { MdxExtensions } from './eslint-plugin-mdx'; import type { NExtensions } from './eslint-plugin-n'; import type { NodeExtensions } from './eslint-plugin-node'; import type { PrettierExtensions } from './eslint-plugin-prettier'; +import type { PromiseExtensions } from './eslint-plugin-promise'; import type { SonarjsExtensions } from './eslint-plugin-sonarjs'; import type { UnicornExtensions } from './eslint-plugin-unicorn'; import type { VueExtensions } from './eslint-plugin-vue'; @@ -27,6 +28,7 @@ export type KnownExtensions = LiteralUnion< | NExtensions | NodeExtensions | PrettierExtensions + | PromiseExtensions | SonarjsExtensions | TypescriptEslintExtensions | UnicornExtensions diff --git a/src/config/plugin.d.ts b/src/config/plugin.d.ts index c76631f3..061f60a7 100644 --- a/src/config/plugin.d.ts +++ b/src/config/plugin.d.ts @@ -9,6 +9,7 @@ export type Plugin = LiteralUnion< | 'jsdoc' | 'mdx' | 'prettier' + | 'promise' | 'sonarjs' | 'spellcheck' | 'unicorn' diff --git a/src/rules/index.d.ts b/src/rules/index.d.ts index 99e8769d..e005b71e 100644 --- a/src/rules/index.d.ts +++ b/src/rules/index.d.ts @@ -5,6 +5,7 @@ import type { JSDocRules } from './jsdoc'; import type { JsoncRules } from './jsonc'; import type { NRules } from './n'; import type { NodeRules } from './node'; +import type { PromiseRules } from './promise'; import type { RuleConfig } from './rule-config'; import type { SonarJSRules } from './sonarjs'; import type { SpellcheckRules } from './spellcheck'; @@ -27,6 +28,7 @@ export type Rules = Partial< JsoncRules & NodeRules & NRules & + PromiseRules & SonarJSRules & SpellcheckRules & TypeScriptRules & diff --git a/src/rules/promise/always-return.d.ts b/src/rules/promise/always-return.d.ts new file mode 100644 index 00000000..c21ad346 --- /dev/null +++ b/src/rules/promise/always-return.d.ts @@ -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; + +/** + * + * @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; +} diff --git a/src/rules/promise/avoid-new.d.ts b/src/rules/promise/avoid-new.d.ts new file mode 100644 index 00000000..21734d3e --- /dev/null +++ b/src/rules/promise/avoid-new.d.ts @@ -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; +} diff --git a/src/rules/promise/catch-or-return.d.ts b/src/rules/promise/catch-or-return.d.ts new file mode 100644 index 00000000..3c8d409f --- /dev/null +++ b/src/rules/promise/catch-or-return.d.ts @@ -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; + +/** + * + * @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; +} diff --git a/src/rules/promise/index.d.ts b/src/rules/promise/index.d.ts new file mode 100644 index 00000000..a02465b3 --- /dev/null +++ b/src/rules/promise/index.d.ts @@ -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; diff --git a/src/rules/promise/no-callback-in-promise.d.ts b/src/rules/promise/no-callback-in-promise.d.ts new file mode 100644 index 00000000..b10db7da --- /dev/null +++ b/src/rules/promise/no-callback-in-promise.d.ts @@ -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; + +/** + * + * @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; +} diff --git a/src/rules/promise/no-multiple-resolved.d.ts b/src/rules/promise/no-multiple-resolved.d.ts new file mode 100644 index 00000000..b2571a39 --- /dev/null +++ b/src/rules/promise/no-multiple-resolved.d.ts @@ -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; +} diff --git a/src/rules/promise/no-native.d.ts b/src/rules/promise/no-native.d.ts new file mode 100644 index 00000000..c6d08bc2 --- /dev/null +++ b/src/rules/promise/no-native.d.ts @@ -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; +} diff --git a/src/rules/promise/no-nesting.d.ts b/src/rules/promise/no-nesting.d.ts new file mode 100644 index 00000000..ff24de8f --- /dev/null +++ b/src/rules/promise/no-nesting.d.ts @@ -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; +} diff --git a/src/rules/promise/no-new-statics.d.ts b/src/rules/promise/no-new-statics.d.ts new file mode 100644 index 00000000..80531e0c --- /dev/null +++ b/src/rules/promise/no-new-statics.d.ts @@ -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; +} diff --git a/src/rules/promise/no-promise-in-callback.d.ts b/src/rules/promise/no-promise-in-callback.d.ts new file mode 100644 index 00000000..c234c540 --- /dev/null +++ b/src/rules/promise/no-promise-in-callback.d.ts @@ -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; +} diff --git a/src/rules/promise/no-return-in-finally.d.ts b/src/rules/promise/no-return-in-finally.d.ts new file mode 100644 index 00000000..ecfaf66d --- /dev/null +++ b/src/rules/promise/no-return-in-finally.d.ts @@ -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; +} diff --git a/src/rules/promise/no-return-wrap.d.ts b/src/rules/promise/no-return-wrap.d.ts new file mode 100644 index 00000000..6bf77fc8 --- /dev/null +++ b/src/rules/promise/no-return-wrap.d.ts @@ -0,0 +1,31 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export interface NoReturnWrapOption { + allowReject?: boolean; +} + +/** + * Options. + */ +export type NoReturnWrapOptions = [NoReturnWrapOption?]; + +/** + * + * @see [no-return-wrap](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-wrap.md) + */ +export type NoReturnWrapRuleConfig = RuleConfig; + +/** + * + * @see [no-return-wrap](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-wrap.md) + */ +export interface NoReturnWrapRule { + /** + * + * @see [no-return-wrap](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-wrap.md) + */ + 'promise/no-return-wrap': NoReturnWrapRuleConfig; +} diff --git a/src/rules/promise/param-names.d.ts b/src/rules/promise/param-names.d.ts new file mode 100644 index 00000000..9e22a44a --- /dev/null +++ b/src/rules/promise/param-names.d.ts @@ -0,0 +1,32 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export interface ParamNamesOption { + resolvePattern?: string; + rejectPattern?: string; +} + +/** + * Options. + */ +export type ParamNamesOptions = [ParamNamesOption?]; + +/** + * + * @see [param-names](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/param-names.md) + */ +export type ParamNamesRuleConfig = RuleConfig; + +/** + * + * @see [param-names](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/param-names.md) + */ +export interface ParamNamesRule { + /** + * + * @see [param-names](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/param-names.md) + */ + 'promise/param-names': ParamNamesRuleConfig; +} diff --git a/src/rules/promise/prefer-await-to-callbacks.d.ts b/src/rules/promise/prefer-await-to-callbacks.d.ts new file mode 100644 index 00000000..1d39ec82 --- /dev/null +++ b/src/rules/promise/prefer-await-to-callbacks.d.ts @@ -0,0 +1,19 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * + * @see [prefer-await-to-callbacks](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md) + */ +export type PreferAwaitToCallbacksRuleConfig = RuleConfig<[]>; + +/** + * + * @see [prefer-await-to-callbacks](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md) + */ +export interface PreferAwaitToCallbacksRule { + /** + * + * @see [prefer-await-to-callbacks](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md) + */ + 'promise/prefer-await-to-callbacks': PreferAwaitToCallbacksRuleConfig; +} diff --git a/src/rules/promise/prefer-await-to-then.d.ts b/src/rules/promise/prefer-await-to-then.d.ts new file mode 100644 index 00000000..c6b12fa5 --- /dev/null +++ b/src/rules/promise/prefer-await-to-then.d.ts @@ -0,0 +1,19 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * + * @see [prefer-await-to-then](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md) + */ +export type PreferAwaitToThenRuleConfig = RuleConfig<[]>; + +/** + * + * @see [prefer-await-to-then](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md) + */ +export interface PreferAwaitToThenRule { + /** + * + * @see [prefer-await-to-then](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md) + */ + 'promise/prefer-await-to-then': PreferAwaitToThenRuleConfig; +} diff --git a/src/rules/promise/valid-params.d.ts b/src/rules/promise/valid-params.d.ts new file mode 100644 index 00000000..545e43ce --- /dev/null +++ b/src/rules/promise/valid-params.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Ensures the proper number of arguments are passed to Promise functions. + * + * @see [valid-params](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md) + */ +export type ValidParamsRuleConfig = RuleConfig<[]>; + +/** + * Ensures the proper number of arguments are passed to Promise functions. + * + * @see [valid-params](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md) + */ +export interface ValidParamsRule { + /** + * Ensures the proper number of arguments are passed to Promise functions. + * + * @see [valid-params](https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md) + */ + 'promise/valid-params': ValidParamsRuleConfig; +}