Skip to content
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

feat: Apply private property naming standard. Mangle browser private properties. #620

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Oct 10, 2024

  1. Update private properties and methods to start with a leading underscore.
  2. Update browser terser config to mangle properties that start with an underscore that are not _meta. (It would be nice to have a more elegant way to do this, but this is what we have.)
  3. Add linting rules for typescript naming conventions.
  4. Fix lint issues from rules.

Conventions

Private properties and methods start with _ and CamelCase case names.
Public methods and properties use CamelCase and do not start with an underscore.
Public static properties use PascalCase and do not start with an underscore. (This is negotiable, but required fewer changes.)

sdk-764

@kinyoklion kinyoklion force-pushed the rlamb/mangle-private-variables branch from 58643fd to b22b69f Compare October 10, 2024 20:53
@kinyoklion kinyoklion force-pushed the rlamb/mangle-private-variables branch from b22b69f to 511c58a Compare October 10, 2024 20:54
@@ -47,6 +47,38 @@ module.exports = {
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/valid-expect': 'error',
'no-underscore-dangle': ['error', { allowAfterThis: true }],
'@typescript-eslint/naming-convention': [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically these go broad and then specific. Forbid underscore!... unless private and then require. And again for the properties.

@@ -9,6 +9,7 @@
-->

# ⛔️⛔️⛔️⛔️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint.

json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({ sourcemap: true }),
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs.js'),
plugins: [typescript(), common(), resolve(), terser(), json()],
plugins: [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint.

@kinyoklion kinyoklion marked this pull request as ready for review October 10, 2024 21:32
@kinyoklion kinyoklion requested a review from a team as a code owner October 10, 2024 21:32
@kinyoklion kinyoklion merged commit 3e6d404 into main Oct 10, 2024
21 checks passed
@kinyoklion kinyoklion deleted the rlamb/mangle-private-variables branch October 10, 2024 22:37
@github-actions github-actions bot mentioned this pull request Oct 10, 2024
kinyoklion pushed a commit that referenced this pull request Oct 17, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>akamai-edgeworker-sdk-common: 1.3.0</summary>

##
[1.3.0](akamai-edgeworker-sdk-common-v1.2.1...akamai-edgeworker-sdk-common-v1.3.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from ^2.8.0 to ^2.9.0
</details>

<details><summary>akamai-server-base-sdk: 2.1.18</summary>

##
[2.1.18](akamai-server-base-sdk-v2.1.17...akamai-server-base-sdk-v2.1.18)
(2024-10-17)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.1 to
^1.3.0
    * @launchdarkly/js-server-sdk-common bumped from ^2.8.0 to ^2.9.0
</details>

<details><summary>akamai-server-edgekv-sdk: 1.2.0</summary>

##
[1.2.0](akamai-server-edgekv-sdk-v1.1.17...akamai-server-edgekv-sdk-v1.2.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.1 to
^1.3.0
    * @launchdarkly/js-server-sdk-common bumped from ^2.8.0 to ^2.9.0
</details>

<details><summary>cloudflare-server-sdk: 2.6.0</summary>

##
[2.6.0](cloudflare-server-sdk-v2.5.15...cloudflare-server-sdk-v2.6.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/js-server-sdk-common-edge bumped from 2.4.1 to 2.5.0
</details>

<details><summary>js-client-sdk: 0.1.0</summary>

##
[0.1.0](js-client-sdk-v0.0.1...js-client-sdk-v0.1.0)
(2024-10-17)


### Features

* Add prerequisite information to server-side allFlagsState.
([8c84e01](8c84e01))
* Add support for client-side prerequisite events.
([8c84e01](8c84e01))
* Add support for inspectors.
([#625](#625))
([a986478](a986478))
* Add support for prerequisite details to evaluation detail.
([8c84e01](8c84e01))
* adds ping stream support
([#624](#624))
([dee53af](dee53af))
* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Bug Fixes

* Do not mangle _meta.
([#622](#622))
([f6fc40b](f6fc40b))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.9.0 to 1.10.0
</details>

<details><summary>js-client-sdk-common: 1.10.0</summary>

##
[1.10.0](js-client-sdk-common-v1.9.0...js-client-sdk-common-v1.10.0)
(2024-10-17)


### Features

* Add prerequisite information to server-side allFlagsState.
([8c84e01](8c84e01))
* Add support for client-side prerequisite events.
([8c84e01](8c84e01))
* Add support for inspectors.
([#625](#625))
([a986478](a986478))
* Add support for prerequisite details to evaluation detail.
([8c84e01](8c84e01))
* adds ping stream support
([#624](#624))
([dee53af](dee53af))
* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Bug Fixes

* Prerequisites should not trigger hooks.
([#628](#628))
([70cf3c3](70cf3c3))
* Update sdk-client rollup configuration to match common
([#630](#630))
([e061811](e061811))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.10.0 to 2.11.0
</details>

<details><summary>js-sdk-common: 2.11.0</summary>

##
[2.11.0](js-sdk-common-v2.10.0...js-sdk-common-v2.11.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Bug Fixes

* Update sdk-client rollup configuration to match common
([#630](#630))
([e061811](e061811))
</details>

<details><summary>js-server-sdk-common: 2.9.0</summary>

##
[2.9.0](js-server-sdk-common-v2.8.0...js-server-sdk-common-v2.9.0)
(2024-10-17)


### Features

* Add prerequisite information to server-side allFlagsState.
([8c84e01](8c84e01))
* Add support for client-side prerequisite events.
([8c84e01](8c84e01))
* Add support for prerequisite details to evaluation detail.
([8c84e01](8c84e01))
* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.10.0 to 2.11.0
</details>

<details><summary>js-server-sdk-common-edge: 2.5.0</summary>

##
[2.5.0](js-server-sdk-common-edge-v2.4.1...js-server-sdk-common-edge-v2.5.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.8.0 to 2.9.0
</details>

<details><summary>node-server-sdk: 9.7.0</summary>

##
[9.7.0](node-server-sdk-v9.6.1...node-server-sdk-v9.7.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.8.0 to 2.9.0
</details>

<details><summary>node-server-sdk-dynamodb: 6.2.0</summary>

##
[6.2.0](node-server-sdk-dynamodb-v6.1.23...node-server-sdk-dynamodb-v6.2.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.1 to 9.7.0
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.7.0
</details>

<details><summary>node-server-sdk-otel: 1.1.0</summary>

##
[1.1.0](node-server-sdk-otel-v1.0.15...node-server-sdk-otel-v1.1.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.1 to 9.7.0
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.7.0
</details>

<details><summary>node-server-sdk-redis: 4.2.0</summary>

##
[4.2.0](node-server-sdk-redis-v4.1.23...node-server-sdk-redis-v4.2.0)
(2024-10-17)


### Features

* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.1 to 9.7.0
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.7.0
</details>

<details><summary>react-native-client-sdk: 10.9.0</summary>

##
[10.9.0](react-native-client-sdk-v10.8.0...react-native-client-sdk-v10.9.0)
(2024-10-17)


### Features

* Add support for inspectors.
([#625](#625))
([a986478](a986478))
* adds ping stream support
([#624](#624))
([dee53af](dee53af))
* Apply private property naming standard. Mangle browser private
properties. ([#620](#620))
([3e6d404](3e6d404))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.9.0 to 1.10.0
</details>

<details><summary>vercel-server-sdk: 1.3.19</summary>

##
[1.3.19](vercel-server-sdk-v1.3.18...vercel-server-sdk-v1.3.19)
(2024-10-17)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common-edge bumped from 2.4.1 to 2.5.0
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants