From 29539cd70044a8be734920d88f8f8fffc69a73ee Mon Sep 17 00:00:00 2001 From: Annie Li Date: Mon, 6 Mar 2023 12:26:51 -0800 Subject: [PATCH] reviewer comments --- .eslintrc.js | 19 ++++++++++++------- src/ResourceNamespace.ts | 2 +- src/Types.d.ts | 11 ----------- src/resources/Accounts.ts | 2 +- src/resources/OAuth.ts | 12 ++++++++++++ 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1d3c9ec1d2..0aaf7e55c4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,12 +18,6 @@ module.exports = { allowSingleLine: true, }, ], - camelcase: [ - 'error', - { - properties: 'never', - }, - ], 'capitalized-comments': 'off', 'class-methods-use-this': 'off', 'comma-dangle': 'off', @@ -267,7 +261,18 @@ module.exports = { '@typescript-eslint/triple-slash-reference': 0, '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-empty-function': 0, - '@typescript-eslint/camelcase': 0, + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'default', + format: ['camelCase', 'UPPER_CASE', 'PascalCase'], + leadingUnderscore: 'allow', + }, + { + selector: 'property', + format: null, + }, + ], '@typescript-eslint/no-explicit-any': 0, '@typescript-eslint/explicit-function-return-type': 'error', '@typescript-eslint/no-var-requires': 0, diff --git a/src/ResourceNamespace.ts b/src/ResourceNamespace.ts index 17cfc334cf..79ac396107 100644 --- a/src/ResourceNamespace.ts +++ b/src/ResourceNamespace.ts @@ -16,7 +16,7 @@ function ResourceNamespace( export function resourceNamespace( namespace: string, - resources: Record + resources: Record void> ): (stripe: StripeObject) => StripeResourceNamespaceObject { return function(stripe: StripeObject): StripeResourceNamespaceObject { return new (ResourceNamespace as any)(stripe, resources); diff --git a/src/Types.d.ts b/src/Types.d.ts index 0c13ca1c90..97080f342d 100644 --- a/src/Types.d.ts +++ b/src/Types.d.ts @@ -240,14 +240,3 @@ type UserProvidedConfig = { telemetry?: boolean; appInfo?: AppInfo; }; -type OAuthAuthorizeUrlParams = { - response_type?: 'code'; - client_id?: string; - scope?: string; -}; -type OAuthAuthorizeUrlOptions = { - express?: boolean; -}; -type OAuthDeauthorizeParams = { - client_id?: string; -}; diff --git a/src/resources/Accounts.ts b/src/resources/Accounts.ts index 2c4269c2c1..469f2a83a4 100644 --- a/src/resources/Accounts.ts +++ b/src/resources/Accounts.ts @@ -12,7 +12,7 @@ export const Accounts = StripeResource.extend({ fullPath: '/v1/accounts', }), - retrieve(id: string | null | undefined, ...args: any[]) { + retrieve(id: string, ...args: any[]) { // No longer allow an api key to be passed as the first string to this function due to ambiguity between // old account ids and api keys. To request the account for an api key, send null as the id if (typeof id === 'string') { diff --git a/src/resources/OAuth.ts b/src/resources/OAuth.ts index 24a27eded9..3adc27a8fe 100644 --- a/src/resources/OAuth.ts +++ b/src/resources/OAuth.ts @@ -3,6 +3,18 @@ import {StripeResource} from '../StripeResource'; import {stringifyRequestData} from '../utils'; +type OAuthAuthorizeUrlParams = { + response_type?: 'code'; + client_id?: string; + scope?: string; +}; +type OAuthAuthorizeUrlOptions = { + express?: boolean; +}; +type OAuthDeauthorizeParams = { + client_id?: string; +}; + const stripeMethod = StripeResource.method; const oAuthHost = 'connect.stripe.com';