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

⚡️ [RUMF-1171] prefer const enums #1364

Merged
merged 7 commits into from
Mar 2, 2022
Merged

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

Minified size in bytes:

Package Before After Delta
datadog-logs.js 33188 32690 -1.5%
datadog-rum-slim.js 63867 60910 -4.6%
datadog-rum.js 113044 109360 -3.3%

Changes

  • Enforce and change enum to const enums
  • Fix the disallowEnumExports rule because I noticed that some enums were still exported, and convert the IncrementalSource enum to a plain object

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested review from a team as code owners February 28, 2022 11:10
@BenoitZugmeyer BenoitZugmeyer changed the title Benoit/prefer const enums ⚡️ [RUMF-1171] prefer const enums everywhere Feb 28, 2022
@BenoitZugmeyer BenoitZugmeyer changed the title ⚡️ [RUMF-1171] prefer const enums everywhere ⚡️ [RUMF-1171] prefer const enums Feb 28, 2022
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/prefer-const-enums branch from 44052fb to c15b6ec Compare February 28, 2022 15:48
After the previous commit replacing the `IncrementalSource` enum,
typechecking is failing because we are using types coming from both
`src` (via the `@datadog/browser-rum/test/utils` import) and `cjs`
(other imports). I'm not sure why it fails now.
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/prefer-const-enums branch from c15b6ec to 714894a Compare February 28, 2022 16:01
@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2022

Codecov Report

Merging #1364 (39044db) into main (1cc42c1) will decrease coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1364      +/-   ##
==========================================
- Coverage   91.11%   90.95%   -0.17%     
==========================================
  Files         104      103       -1     
  Lines        4267     4189      -78     
  Branches      948      934      -14     
==========================================
- Hits         3888     3810      -78     
  Misses        379      379              
Impacted Files Coverage Δ
...rc/domain/internalMonitoring/internalMonitoring.ts 98.41% <ø> (-0.08%) ⬇️
packages/core/src/tools/error.ts 90.00% <ø> (-0.91%) ⬇️
packages/core/src/tools/utils.ts 86.69% <ø> (-0.81%) ⬇️
packages/logs/src/domain/logsSessionManager.ts 100.00% <ø> (ø)
packages/rum-core/src/domain/assembly.ts 100.00% <ø> (ø)
packages/rum-core/src/domain/lifeCycle.ts 100.00% <ø> (ø)
packages/rum-core/src/domain/rumSessionManager.ts 88.23% <ø> (-2.01%) ⬇️
packages/rum/src/domain/record/types.ts 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cc42c1...39044db. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer merged commit b52da4f into main Mar 2, 2022
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/prefer-const-enums branch March 2, 2022 15:40
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.

3 participants