Skip to content

Commit

Permalink
fix(shared): Add Clerk prefix in deprecation warnings (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkl authored Oct 16, 2023
1 parent 4036073 commit 9b644d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-olives-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/shared': patch
---

Add `Clerk - ` prefix to deprecation warnings
16 changes: 8 additions & 8 deletions packages/shared/src/utils/deprecated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('deprecated(fnName, warning)', () => {
expect(example.getSomeMethod('a', 'b')).toEqual('getSomeMethodValue:a:b');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "getSomeMethod" is deprecated and will be removed in the next major release.\nUse `getSomeMethodElse` instead.',
'Clerk - DEPRECATION WARNING: "getSomeMethod" is deprecated and will be removed in the next major release.\nUse `getSomeMethodElse` instead.',
);

expect(example.getSomeMethod()).toEqual('getSomeMethodValue:-:-');
Expand All @@ -51,7 +51,7 @@ describe('deprecated(fnName, warning)', () => {
expect(Example.getSomeStaticMethod()).toEqual('getSomeStaticMethodValue');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "getSomeStaticMethod" is deprecated and will be removed in the next major release.\nUse `getSomeStaticMethodElse` instead.',
'Clerk - DEPRECATION WARNING: "getSomeStaticMethod" is deprecated and will be removed in the next major release.\nUse `getSomeStaticMethodElse` instead.',
);

expect(Example.getSomeStaticMethod()).toEqual('getSomeStaticMethodValue');
Expand All @@ -68,7 +68,7 @@ describe('deprecated(fnName, warning)', () => {
expect(getSomeFunction()).toEqual('getSomeFunctionValue');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "getSomeFunction" is deprecated and will be removed in the next major release.\nUse `getSomeFunctionElse` instead.',
'Clerk - DEPRECATION WARNING: "getSomeFunction" is deprecated and will be removed in the next major release.\nUse `getSomeFunctionElse` instead.',
);

expect(getSomeFunction()).toEqual('getSomeFunctionValue');
Expand All @@ -85,7 +85,7 @@ describe('deprecated(fnName, warning)', () => {
expect(getSomeFunctionWithKey()).toEqual('getSomeFunctionWithKeyValue');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "getSomeFunctionWithKey" is deprecated and will be removed in the next major release.\nUse `getSomeFunctionWithKeyElse` instead.',
'Clerk - DEPRECATION WARNING: "getSomeFunctionWithKey" is deprecated and will be removed in the next major release.\nUse `getSomeFunctionWithKeyElse` instead.',
);

expect(getSomeFunctionWithKey()).toEqual('getSomeFunctionWithKeyValue');
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
expect(example.someProp).toEqual('someProp-value');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "someProp" is deprecated and will be removed in the next major release.\nUse `somePropElse` instead.',
'Clerk - DEPRECATION WARNING: "someProp" is deprecated and will be removed in the next major release.\nUse `somePropElse` instead.',
);

expect(example.someProp).toEqual('someProp-value');
Expand All @@ -224,7 +224,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
expect(Example.someStaticProp).toEqual('someStaticProp-value');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "someStaticProp" is deprecated and will be removed in the next major release.\nUse `someStaticPropElse` instead.',
'Clerk - DEPRECATION WARNING: "someStaticProp" is deprecated and will be removed in the next major release.\nUse `someStaticPropElse` instead.',
);

expect(Example.someStaticProp).toEqual('someStaticProp-value');
Expand All @@ -247,7 +247,7 @@ describe('deprecatedProperty(cls, propName, warning, isStatic = false)', () => {
expect(example.someReadOnlyProp).toEqual('someReadOnlyProp-value');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "someReadOnlyProp" is deprecated and will be removed in the next major release.\nUse `someReadOnlyPropElse` instead.',
'Clerk - DEPRECATION WARNING: "someReadOnlyProp" is deprecated and will be removed in the next major release.\nUse `someReadOnlyPropElse` instead.',
);

expect(example.someReadOnlyProp).toEqual('someReadOnlyProp-value');
Expand Down Expand Up @@ -330,7 +330,7 @@ describe('deprecatedObjectProperty(obj, propName, warning)', () => {
expect(example.objectProperty).toEqual('objectProperty-value');
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
'DEPRECATION WARNING: "objectProperty" is deprecated and will be removed in the next major release.\nUse `objectPropertyElse` instead.',
'Clerk - DEPRECATION WARNING: "objectProperty" is deprecated and will be removed in the next major release.\nUse `objectPropertyElse` instead.',
);

expect(example.objectProperty).toEqual('objectProperty-value');
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/utils/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const deprecated = (fnName: string, warning: string, key?: string): void
displayedWarnings.add(messageId);

console.warn(
`DEPRECATION WARNING: "${fnName}" is deprecated and will be removed in the next major release.\n${warning}`,
`Clerk - DEPRECATION WARNING: "${fnName}" is deprecated and will be removed in the next major release.\n${warning}`,
);
};
/**
Expand Down

0 comments on commit 9b644d7

Please sign in to comment.