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

Guard against redefinition of Date.now #1196

Merged
merged 9 commits into from
Jun 2, 2023

Conversation

eoghanmurray
Copy link
Contributor

Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

@changeset-bot
Copy link

changeset-bot bot commented Mar 31, 2023

🦋 Changeset detected

Latest commit: 005f649

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
rrweb Patch
rrweb-snapshot Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/types Patch
@rrweb/web-extension Patch
rrvideo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eoghanmurray eoghanmurray requested a review from Yuyz0112 March 31, 2023 12:53
packages/rrweb/src/utils.ts Outdated Show resolved Hide resolved
@Juice10
Copy link
Contributor

Juice10 commented Jun 2, 2023

Lets add https://github.com/willklein/eslint-plugin-disallow-methods to the project and add Date.now to the disallowed list as it gets redefined often

@Juice10 Juice10 merged commit 490b3e2 into rrweb-io:master Jun 2, 2023
@eoghanmurray
Copy link
Contributor Author

There's quite a few valid Date.now() present on the replay side which is fine so we'll have to 'police' this manually.

We could add it as an .eslintrc to a future dedicated packages/rrweb-record module if that can get separated out from the rrweb package.

eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Jul 27, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Jul 27, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Jul 27, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Aug 3, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Aug 8, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
eoghanmurray added a commit to eoghanmurray/rrweb that referenced this pull request Aug 8, 2023
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. datejs/Datejs#92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <[email protected]>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <[email protected]>
Co-authored-by: Justin Halsall <[email protected]>
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