-
Notifications
You must be signed in to change notification settings - Fork 438
chore(repo): Align method prefixes, remove unused unstable methods #7361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
6c6201c
c57388f
082580a
8505a75
49d4d8f
0f83c0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| "@clerk/clerk-js": major | ||
| "@clerk/react": major | ||
| "@clerk/nextjs": major | ||
| "@clerk/vue": major | ||
| "@clerk/astro": major | ||
| "@clerk/expo": major | ||
| "@clerk/chrome-extension": major | ||
| "@clerk/shared": major | ||
| "@clerk/ui": major | ||
| --- | ||
|
|
||
| Align experimental/unstable prefixes to use consistent naming: | ||
|
|
||
| - Renamed all `__unstable_*` methods to `__internal_*` (for internal APIs) | ||
| - Renamed all `experimental__*` and `experimental_*` methods to `__experimental_*` (for beta features) | ||
| - Removed deprecated billing-related props and `experimental__forceOauthFirst` | ||
| - Moved `createTheme` and `simple` to `@clerk/ui/themes/experimental` export path (removed `__experimental_` prefix since they're now in the experimental export) | ||
|
|
||
| **Breaking Changes:** | ||
|
|
||
| ### @clerk/clerk-js | ||
| - `__unstable__environment` → `__internal_environment` | ||
| - `__unstable__updateProps` → `__internal_updateProps` | ||
| - `__unstable__setEnvironment` → `__internal_setEnvironment` | ||
| - `__unstable__onBeforeRequest` → `__internal_onBeforeRequest` | ||
| - `__unstable__onAfterResponse` → `__internal_onAfterResponse` | ||
| - `__unstable__onBeforeSetActive` → `__internal_onBeforeSetActive` (window global) | ||
| - `__unstable__onAfterSetActive` → `__internal_onAfterSetActive` (window global) | ||
|
|
||
| ### @clerk/nextjs | ||
| - `__unstable_invokeMiddlewareOnAuthStateChange` → `__internal_invokeMiddlewareOnAuthStateChange` | ||
|
|
||
| ### @clerk/ui | ||
| - `experimental_createTheme` / `__experimental_createTheme` → `createTheme` (now exported from `@clerk/ui/themes/experimental`) | ||
| - `experimental__simple` / `__experimental_simple` → `simple` (now exported from `@clerk/ui/themes/experimental`) | ||
|
|
||
| ### @clerk/chrome-extension | ||
| - `__unstable__createClerkClient` → `createClerkClient` (exported from `@clerk/chrome-extension/background`) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this should remain experimental/internal 🤔 @tmilewski do you have context?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brkalow Yeah, this can be moved to stable at this point. |
||
|
|
||
| ### Removed (multiple packages) | ||
| - `__unstable_manageBillingUrl` (removed) | ||
| - `__unstable_manageBillingLabel` (removed) | ||
| - `__unstable_manageBillingMembersLimit` (removed) | ||
|
Comment on lines
+42
to
+44
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, these are unused and were to support Dashboard's use of our orgs components a few years ago |
||
| - `experimental__forceOauthFirst` (removed) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Underlying properties on the API response object were removed in core 2, so finishing the cleanup here |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,6 +195,10 @@ Read more about this in the [`clerk-docs` CONTRIBUTING.md](https://github.com/cl | |
|
|
||
| Then, to preview how the `<Typedoc />` component renders, the `clerk-docs` PR will have a Vercel preview. Or to get local previews set up, see the [section in `clerk/clerk` about setting up local docs](https://github.com/clerk/clerk?tab=readme-ov-file#5-optional-set-up-local-docs). | ||
|
|
||
| ### Experimental and internal APIs | ||
|
|
||
| In some cases, we might need to add new methods to our publicly exposed APIs that are meant for internal use, or as experimental releases before the APIs are stabilized. For internal methods or properties, use the `__internal_` prefix. For experimental methods or properties that are attached to existing APIs, use the `__experimental_` prefix. For new exports, it is also acceptable to export from an `/experimental` subpath. Exports from `/experimental` are not covered by regular SemVer guarantees. | ||
|
Comment on lines
+198
to
+200
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documenting new patterns |
||
|
|
||
| ## Opening a Pull Request | ||
|
|
||
| 1. Search our repository for open or closed [Pull Requests](https://github.com/clerk/javascript/pulls) that relate to your submission. You don't want to duplicate effort. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,61 @@ const noNavigateUseClerk = { | |
| }, | ||
| }; | ||
|
|
||
| const noUnstableMethods = { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New ESLint rule that should hopefully avoid any accidental addition of |
||
| meta: { | ||
| type: 'problem', | ||
| docs: { | ||
| description: 'Disallow methods or properties starting with `__unstable_`', | ||
| recommended: false, | ||
| }, | ||
| messages: { | ||
| noUnstable: | ||
| 'Do not define methods or properties starting with `__unstable_`. For internal APIs, use `__internal_`, for experimental APIs, use `__experimental_`.', | ||
| }, | ||
| schema: [], | ||
| }, | ||
| create(context) { | ||
| return { | ||
| MemberExpression(node) { | ||
| if ( | ||
| node.property.type === 'Identifier' && | ||
| typeof node.property.name === 'string' && | ||
| node.property.name.startsWith('__unstable_') | ||
| ) { | ||
| context.report({ | ||
| node: node.property, | ||
| messageId: 'noUnstable', | ||
| }); | ||
| } | ||
| }, | ||
| Property(node) { | ||
| if ( | ||
| node.key.type === 'Identifier' && | ||
| typeof node.key.name === 'string' && | ||
| node.key.name.startsWith('__unstable_') | ||
| ) { | ||
| context.report({ | ||
| node: node.key, | ||
| messageId: 'noUnstable', | ||
| }); | ||
| } | ||
| }, | ||
| MethodDefinition(node) { | ||
| if ( | ||
| node.key.type === 'Identifier' && | ||
| typeof node.key.name === 'string' && | ||
| node.key.name.startsWith('__unstable_') | ||
| ) { | ||
| context.report({ | ||
| node: node.key, | ||
| messageId: 'noUnstable', | ||
| }); | ||
| } | ||
| }, | ||
| }; | ||
| }, | ||
| }; | ||
|
|
||
| export default tseslint.config([ | ||
| { | ||
| name: 'repo/ignores', | ||
|
|
@@ -161,6 +216,11 @@ export default tseslint.config([ | |
| { | ||
| name: 'repo/global', | ||
| plugins: { | ||
| 'custom-rules': { | ||
| rules: { | ||
| 'no-unstable-methods': noUnstableMethods, | ||
| }, | ||
| }, | ||
| 'simple-import-sort': pluginSimpleImportSort, | ||
| 'unused-imports': pluginUnusedImports, | ||
| turbo: pluginTurbo, | ||
|
|
@@ -176,6 +236,7 @@ export default tseslint.config([ | |
| }, | ||
| }, | ||
| rules: { | ||
| 'custom-rules/no-unstable-methods': 'error', | ||
| 'no-label-var': 'error', | ||
| 'no-undef-init': 'warn', | ||
| 'no-restricted-imports': [ | ||
|
|
@@ -359,11 +420,13 @@ export default tseslint.config([ | |
| 'custom-rules': { | ||
| rules: { | ||
| 'no-navigate-useClerk': noNavigateUseClerk, | ||
| 'no-unstable-methods': noUnstableMethods, | ||
| }, | ||
| }, | ||
| }, | ||
| rules: { | ||
| 'custom-rules/no-navigate-useClerk': 'error', | ||
| 'custom-rules/no-unstable-methods': 'error', | ||
| }, | ||
| }, | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to the preferred
/experimentalexport pattern