diff --git a/examples/webhook-signing/typescript-node-express/express-ts.ts b/examples/webhook-signing/typescript-node-express/express-ts.ts index 219854fcc0..c0a4c1d4b7 100644 --- a/examples/webhook-signing/typescript-node-express/express-ts.ts +++ b/examples/webhook-signing/typescript-node-express/express-ts.ts @@ -65,9 +65,6 @@ app.post( } ); -app.listen( - 3000, - (): void => { - console.log('Example app listening on port 3000!'); - } -); +app.listen(3000, (): void => { + console.log('Example app listening on port 3000!'); +}); diff --git a/lib/StripeMethod.js b/lib/StripeMethod.js index c256dc3ed3..f4e9ada721 100644 --- a/lib/StripeMethod.js +++ b/lib/StripeMethod.js @@ -22,9 +22,7 @@ const makeAutoPaginationMethods = autoPagination.makeAutoPaginationMethods; function stripeMethod(spec) { if (spec.path !== undefined && spec.fullPath !== undefined) { throw new Error( - `Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${ - spec.fullPath - }).` + `Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).` ); } return function(...args) { diff --git a/package.json b/package.json index fbfe3a3ce8..bf0c358be1 100644 --- a/package.json +++ b/package.json @@ -32,16 +32,16 @@ "chai": "^4.3.6", "chai-as-promised": "~7.1.1", "coveralls": "^3.1.1", - "eslint": "7.32.0", + "eslint": "^7.32.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-chai-friendly": "^0.7.2", - "eslint-plugin-prettier": "3.4.1", + "eslint-plugin-prettier": "^3.4.1", "mocha": "^8.4.0", "mocha-junit-reporter": "^2.1.0", "nock": "^13.2.9", - "node-fetch": "2.6.6", + "node-fetch": "^2.6.7", "nyc": "^15.1.0", - "prettier": "1.16.4", + "prettier": "^1.16.4", "typescript": "^4.8.4" }, "resolutions": { diff --git a/src/StripeMethod.ts b/src/StripeMethod.ts index 5f9911d204..f2c0595988 100644 --- a/src/StripeMethod.ts +++ b/src/StripeMethod.ts @@ -22,9 +22,7 @@ const makeAutoPaginationMethods = autoPagination.makeAutoPaginationMethods; function stripeMethod(spec) { if (spec.path !== undefined && spec.fullPath !== undefined) { throw new Error( - `Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${ - spec.fullPath - }).` + `Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).` ); } return function(...args) { diff --git a/test/StripeResource.spec.js b/test/StripeResource.spec.js index 87f2fd9d95..78b999aedb 100644 --- a/test/StripeResource.spec.js +++ b/test/StripeResource.spec.js @@ -117,9 +117,7 @@ describe('StripeResource', () => { } ) .get( - `${ - options.path - }?customer=cus_123&subscription_items[0][plan]=foo&subscription_items[0][quantity]=2&subscription_items[1][id]=si_123&subscription_items[1][deleted]=true`, + `${options.path}?customer=cus_123&subscription_items[0][plan]=foo&subscription_items[0][quantity]=2&subscription_items[1][id]=si_123&subscription_items[1][deleted]=true`, '' ) .reply(200, '{}'); @@ -257,7 +255,10 @@ describe('StripeResource', () => { path: '/v1/subscriptions/sub_123', data: { customer: 'cus_123', - items: [{plan: 'foo', quantity: 2}, {id: 'si_123', deleted: true}], + items: [ + {plan: 'foo', quantity: 2}, + {id: 'si_123', deleted: true}, + ], }, body: 'customer=cus_123&items[0][plan]=foo&items[0][quantity]=2&items[1][id]=si_123&items[1][deleted]=true', diff --git a/test/autoPagination.spec.js b/test/autoPagination.spec.js index 4f7cf69a96..0dff2fb644 100644 --- a/test/autoPagination.spec.js +++ b/test/autoPagination.spec.js @@ -497,7 +497,10 @@ describe('auto pagination', function() { describe('foward pagination', () => { it('paginates forwards through a page', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4]], + pages: [ + [1, 2], + [3, 4], + ], limit: 10, expectedIds: [1, 2, 3, 4], expectedParamsLog: ['?starting_after=2'], @@ -515,7 +518,11 @@ describe('auto pagination', function() { it('respects limit even when paginating', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4], [5, 6]], + pages: [ + [1, 2], + [3, 4], + [5, 6], + ], limit: 5, expectedIds: [1, 2, 3, 4, 5], expectedParamsLog: ['?starting_after=2', '?starting_after=4'], @@ -524,7 +531,13 @@ describe('auto pagination', function() { it('paginates through multiple full pages', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]], + pages: [ + [1, 2], + [3, 4], + [5, 6], + [7, 8], + [9, 10], + ], limit: 10, expectedIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], expectedParamsLog: [ @@ -540,7 +553,10 @@ describe('auto pagination', function() { describe('backwards pagination', () => { it('paginates forwards through a page', () => { return testCase(mockPagination, { - pages: [[-2, -1], [-4, -3]], + pages: [ + [-2, -1], + [-4, -3], + ], limit: 5, expectedIds: [-1, -2, -3, -4], expectedParamsLog: ['?ending_before=-2'], @@ -560,7 +576,11 @@ describe('auto pagination', function() { it('respects limit', () => { return testCase(mockPagination, { - pages: [[-2, -1], [-4, -3], [-6, -5]], + pages: [ + [-2, -1], + [-4, -3], + [-6, -5], + ], limit: 5, expectedIds: [-1, -2, -3, -4, -5], expectedParamsLog: ['?ending_before=-2', '?ending_before=-4'], @@ -621,7 +641,10 @@ describe('auto pagination', function() { it('paginates forwards through a page', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4]], + pages: [ + [1, 2], + [3, 4], + ], limit: 10, expectedIds: [1, 2, 3, 4], expectedParamsLog: ['?page=2-encoded'], @@ -639,7 +662,11 @@ describe('auto pagination', function() { it('respects limit even when paginating', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4], [5, 6]], + pages: [ + [1, 2], + [3, 4], + [5, 6], + ], limit: 5, expectedIds: [1, 2, 3, 4, 5], expectedParamsLog: ['?page=2-encoded', '?page=4-encoded'], @@ -648,7 +675,13 @@ describe('auto pagination', function() { it('paginates through multiple full pages', () => { return testCase(mockPagination, { - pages: [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]], + pages: [ + [1, 2], + [3, 4], + [5, 6], + [7, 8], + [9, 10], + ], limit: 10, expectedIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], expectedParamsLog: [ diff --git a/test/crypto/SubtleCryptoProvider.spec.js b/test/crypto/SubtleCryptoProvider.spec.js index f3c4015f30..2fc067170d 100644 --- a/test/crypto/SubtleCryptoProvider.spec.js +++ b/test/crypto/SubtleCryptoProvider.spec.js @@ -7,9 +7,7 @@ const expect = require('chai').expect; // webcrypto is only available on Node 15+. if (!webcrypto || !webcrypto.subtle) { console.log( - `Skipping SubtleCryptoProvider tests. No 'webcrypto.subtle' available for ${ - process.version - }.` + `Skipping SubtleCryptoProvider tests. No 'webcrypto.subtle' available for ${process.version}.` ); return; } diff --git a/test/resources/Plans.spec.js b/test/resources/Plans.spec.js index 9786516a95..3757f7dfed 100644 --- a/test/resources/Plans.spec.js +++ b/test/resources/Plans.spec.js @@ -51,7 +51,10 @@ describe('Plans Resource', () => { stripe.plans.create({ currency: 'usd', billing_scheme: 'tiered', - tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}], + tiers: [ + {up_to: 123, amount: 100}, + {up_to: 'inf', amount: 200}, + ], tiers_mode: 'volume', }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -61,7 +64,10 @@ describe('Plans Resource', () => { data: { currency: 'usd', billing_scheme: 'tiered', - tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}], + tiers: [ + {up_to: 123, amount: 100}, + {up_to: 'inf', amount: 200}, + ], tiers_mode: 'volume', }, settings: {}, diff --git a/types/lib.d.ts b/types/lib.d.ts index 16b6724c6b..cf4b19e211 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -14,7 +14,7 @@ declare module 'stripe' { export class StripeResource { static extend< - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any T extends {[prop: string]: any} & { includeBasic?: Array< 'create' | 'retrieve' | 'update' | 'list' | 'del' diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts index 4bb8d1359d..ebd0b7da64 100644 --- a/types/test/typescriptTest.ts +++ b/types/test/typescriptTest.ts @@ -106,13 +106,11 @@ stripe.setHost('host', 'port', 'protocol'); } } - const cusList: Stripe.ApiList< - Stripe.Customer - > = await stripe.customers.list(); + const cusList: Stripe.ApiList = await stripe.customers.list(); - const aThousandCustomers: Array< - Stripe.Customer - > = await stripe.customers.list().autoPagingToArray({limit: 1000}); + const aThousandCustomers: Array = await stripe.customers + .list() + .autoPagingToArray({limit: 1000}); const nothing: void = await stripe.customers .list() diff --git a/yarn.lock b/yarn.lock index 5167555cae..eba80e65a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -913,7 +913,7 @@ eslint-plugin-chai-friendly@^0.7.2: resolved "https://registry.yarnpkg.com/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.7.2.tgz#0ebfbb2c1244f5de2997f3963d155758234f2b0f" integrity sha512-LOIfGx5sZZ5FwM1shr2GlYAWV9Omdi+1/3byuVagvQNoGUuU0iHhp7AfjA1uR+4dJ4Isfb4+FwBJgQajIw9iAg== -eslint-plugin-prettier@3.4.1: +eslint-plugin-prettier@^3.4.1: version "3.4.1" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5" integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g== @@ -952,7 +952,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint@7.32.0: +eslint@^7.32.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== @@ -1814,10 +1814,10 @@ nock@^13.2.9: lodash "^4.17.21" propagate "^2.0.0" -node-fetch@2.6.6: - version "2.6.6" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89" - integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA== +node-fetch@^2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: whatwg-url "^5.0.0" @@ -2016,10 +2016,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@1.16.4: - version "1.16.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" - integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== +prettier@^1.16.4: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== process-on-spawn@^1.0.0: version "1.0.0"