Skip to content

Commit 8777f35

Browse files
authored
chore(shared): Bump target/lib to ES2022 (#6892)
1 parent 83b4cff commit 8777f35

File tree

9 files changed

+46
-12
lines changed

9 files changed

+46
-12
lines changed

.changeset/quiet-lobsters-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/shared": patch
3+
---
4+
5+
Bump target/lib for `@clerk/shared` to ES2022

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ export default tseslint.config([
445445
'jsdoc/require-description-complete-sentence': 'warn',
446446
'jsdoc/require-param': ['warn', { ignoreWhenAllParamsMissing: true }],
447447
'jsdoc/require-param-description': 'warn',
448+
'jsdoc/require-description-complete-sentence': 'off',
448449
'jsdoc/require-returns': 'off',
449450
'jsdoc/tag-lines': [
450451
'warn',

packages/clerk-js/vitest.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default defineConfig({
3232
},
3333
test: {
3434
coverage: {
35-
enabled: true,
35+
enabled: false,
3636
provider: 'v8',
3737
reporter: ['text', 'json', 'html'],
3838
include: ['src/**/*.{ts,tsx}'],

packages/clerk-js/vitest.setup.mts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,40 @@ import * as crypto from 'node:crypto';
44
import { TextDecoder, TextEncoder } from 'node:util';
55

66
import { cleanup, configure } from '@testing-library/react';
7-
import { afterAll, afterEach, beforeAll, vi } from 'vitest';
7+
import { afterAll, afterEach, beforeAll, beforeEach, vi } from 'vitest';
88

99
configure({});
1010

11-
afterEach(cleanup);
11+
// Track all timers created during tests to clean them up
12+
const activeTimers = new Set<ReturnType<typeof setTimeout>>();
13+
const originalSetTimeout = global.setTimeout;
14+
const originalClearTimeout = global.clearTimeout;
15+
16+
// Wrap setTimeout to track all timers
17+
global.setTimeout = ((callback: any, delay?: any, ...args: any[]) => {
18+
const timerId = originalSetTimeout(callback, delay, ...args);
19+
activeTimers.add(timerId);
20+
return timerId;
21+
}) as typeof setTimeout;
22+
23+
// Wrap clearTimeout to remove from tracking
24+
global.clearTimeout = ((timerId?: ReturnType<typeof setTimeout>) => {
25+
if (timerId) {
26+
activeTimers.delete(timerId);
27+
originalClearTimeout(timerId);
28+
}
29+
}) as typeof clearTimeout;
30+
31+
beforeEach(() => {
32+
activeTimers.clear();
33+
});
34+
35+
afterEach(() => {
36+
cleanup();
37+
// Clear all tracked timers to prevent post-test execution
38+
activeTimers.forEach(timerId => originalClearTimeout(timerId));
39+
activeTimers.clear();
40+
});
1241

1342
// Store the original method
1443
// eslint-disable-next-line @typescript-eslint/unbound-method
@@ -43,6 +72,7 @@ if (typeof window !== 'undefined') {
4372
TextEncoder: { value: TextEncoder },
4473
Response: { value: FakeResponse },
4574
crypto: { value: crypto.webcrypto },
75+
isSecureContext: { value: true, writable: true },
4676
});
4777

4878
// Mock ResizeObserver

packages/shared/src/__tests__/deprecated.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
191191

192192
test('deprecate class property shows warning', () => {
193193
class Example {
194-
someProp: string;
194+
declare someProp: string;
195195
constructor(someProp: string) {
196196
this.someProp = someProp;
197197
}
@@ -234,7 +234,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
234234

235235
test('deprecate class readonly property shows warning', () => {
236236
class Example {
237-
readonly someReadOnlyProp: string;
237+
declare readonly someReadOnlyProp: string;
238238
constructor(someReadOnlyProp: string) {
239239
this.someReadOnlyProp = someReadOnlyProp;
240240
}
@@ -265,7 +265,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
265265

266266
test('deprecate class readonly property does not show warning', () => {
267267
class Example {
268-
readonly someReadOnlyPropInProd: string;
268+
declare readonly someReadOnlyPropInProd: string;
269269
constructor(someReadOnlyPropInProd: string) {
270270
this.someReadOnlyPropInProd = someReadOnlyPropInProd;
271271
}
@@ -293,7 +293,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
293293

294294
test('deprecate class readonly property does not show warning', () => {
295295
class Example {
296-
readonly someReadOnlyPropInProd: string;
296+
declare readonly someReadOnlyPropInProd: string;
297297
constructor(someReadOnlyPropInProd: string) {
298298
this.someReadOnlyPropInProd = someReadOnlyPropInProd;
299299
}

packages/shared/src/react/hooks/useOrganization.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jsdoc/require-description-complete-sentence */
21
import type {
32
ClerkPaginatedResponse,
43
GetDomainsParams,

packages/shared/src/react/hooks/useOrganizationList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jsdoc/require-description-complete-sentence */
21
import type {
32
ClerkPaginatedResponse,
43
CreateOrganizationParams,

packages/shared/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2019",
3+
"target": "ES2022",
44
"esModuleInterop": true,
55
"forceConsistentCasingInFileNames": true,
66
"isolatedModules": true,
@@ -12,7 +12,7 @@
1212
"outDir": "dist",
1313
"resolveJsonModule": true,
1414
"jsx": "react",
15-
"lib": ["ES6", "DOM", "WebWorker"],
15+
"lib": ["ES2022", "DOM", "WebWorker"],
1616
"allowJs": true
1717
},
1818
"exclude": ["node_modules"],

packages/shared/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig(overrideOptions => {
2424
minify: false,
2525
sourcemap: true,
2626
dts: true,
27-
target: 'es2020',
27+
target: 'es2022',
2828
external: ['react', 'react-dom'],
2929
esbuildPlugins: [WebWorkerMinifyPlugin as any],
3030
define: {

0 commit comments

Comments
 (0)