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

add dependency on core-js@^3.6.5 #359

Closed
wants to merge 1 commit into from

Conversation

esetnik
Copy link

@esetnik esetnik commented Jun 13, 2020

When using @babel/preset-env you need to take a dependency on core-js because it will inject runtime references in either entry or usage (in this case we are using usage).

https://babeljs.io/docs/en/babel-preset-env#usebuiltins

Fixes #348

@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2020

Codecov Report

Merging #359 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #359   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          208       208           
  Branches        42        42           
=========================================
  Hits           208       208           

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 06d40ec...bbe5485. Read the comment docs.

chrisbobbe added a commit to zulip/zulip-mobile that referenced this pull request Aug 11, 2020
This reverts commit 01593b3.

We should redo the upgrade when we can take a version of
`prettier-eslint` in which `core-js` is re-introduced as a
dependency; prettier/prettier-eslint#348 is the closest issue for
that. The commands listed in 01593b3 should make it easy to redo
the upgrade mechanically, and without having to think about rebase
conflicts.

The version (11.0.0) of `prettier-eslint` that we got in 01593b3
was affected by a bug with symptoms quite similar to ones we see
with the Prettier VSCode extension (a.k.a. `esbenp.prettier-vscode`)
at version 5 and above [1]. We'll have to resolve the problem with
the VSCode extension at some point (see discussion for a likely way
we'll do that), since we can't assume it will always be fine to stay
below version 5, and version 5 causes problems because of an
intentional design change.

But, from experimentation, it appears that this time the problem is
just caused by `prettier-eslint` not having the right version of
`core-js`. At 10.1.0, the latest version before the problem starts
happening, we can remove
`node_modules/prettier-eslint/node_modules/core-js`, and we see the
problem. Version 10.1.1, which ships with the problem, removed
`core-js` as a dependency, and an issue with a different bad symptom
(prettier/prettier-eslint#348) was soon filed, and a PR
(prettier/prettier-eslint#359) came along to add `core-js` back in.

[1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/SOLVED.3A.20Prettier.20auto-formatting/near/893164
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this pull request Aug 11, 2020
This reverts commit 01593b3.

We should redo the upgrade when we can take a version of
`prettier-eslint` in which `core-js` is re-introduced as a
dependency; prettier/prettier-eslint#348 is the closest issue for
that. The commands listed in 01593b3 should make it easy to redo
the upgrade mechanically, and without having to think about rebase
conflicts.

The version (11.0.0) of `prettier-eslint` that we got in 01593b3
was affected by a bug with symptoms quite similar to ones we see
with the Prettier VSCode extension (a.k.a. `esbenp.prettier-vscode`)
at version 5 and above [1]. We'll have to resolve the problem with
the VSCode extension at some point (see discussion for a likely way
we'll do that), since we can't assume it will always be fine to stay
below version 5, and version 5 causes problems because of an
intentional design change.

But, from experimentation, it appears that this time the problem is
just caused by `prettier-eslint` not having the right version of
`core-js`. At 10.1.0, the latest version before the problem starts
happening, we can remove
`node_modules/prettier-eslint/node_modules/core-js`, and we see the
problem. Version 10.1.1, which ships with the problem, removed
`core-js` as a dependency, and an issue with a different bad symptom
(prettier/prettier-eslint#348) was soon filed, and a PR
(prettier/prettier-eslint#359) came along to add `core-js` back in.

We can't just back up to version 10.1.0, because then we're at risk
of it not working with ESLint 6 [2]. So, just revert the entire
ESLint 6 upgrade.

[1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/SOLVED.3A.20Prettier.20auto-formatting/near/893164
[2] prettier/prettier-eslint#338 (comment)
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this pull request Aug 11, 2020
This reverts commit 01593b3.

We should redo the upgrade when we can take a version of
`prettier-eslint` in which `core-js` is re-introduced as a
dependency; prettier/prettier-eslint#348 is the closest issue for
that. The commands listed in 01593b3 should make it easy to redo
the upgrade mechanically, and without having to think about rebase
conflicts.

The version (11.0.0) of `prettier-eslint` that we got in 01593b3
was affected by a bug with symptoms quite similar to ones we see
with the Prettier VSCode extension (a.k.a. `esbenp.prettier-vscode`)
at version 5 and above [1]. We'll have to resolve the problem with
the VSCode extension at some point (see discussion for a likely way
we'll do that), since we can't assume it will always be fine to stay
below version 5, and version 5 causes problems because of an
intentional design change.

But, from experimentation, it appears that this time the problem is
just caused by `prettier-eslint` not having the right version of
`core-js`. At 10.1.0, the latest version before the problem starts
happening, we can remove
`node_modules/prettier-eslint/node_modules/core-js`, and we see the
problem. Version 10.1.1, which ships with the problem, removed
`core-js` as a dependency, and an issue with a different bad symptom
(prettier/prettier-eslint#348) was soon filed, and a PR
(prettier/prettier-eslint#359) came along to add `core-js` back in.

We can't just back up to version 10.1.0, because then we're at risk
of it not working with ESLint 6 [2]. So, just revert the entire
ESLint 6 upgrade.

[1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/SOLVED.3A.20Prettier.20auto-formatting/near/893164
[2] prettier/prettier-eslint#338 (comment)
chrisbobbe added a commit to zulip/zulip-mobile that referenced this pull request Aug 12, 2020
A redo of 01593b3, after we reverted it in e3e8d9a.

One thing we realized [1] is that we don't have to wait for
`prettier-eslint` to fix the problem of its missing `core-js`
dependency; we can provide it ourselves. We do so by just adding it
directly to our own `dependencies`.

So, in addition to the commands listed in 01593b3, also run
`yarn add core-js@^3.1.4`. We choose ^3.1.4 because that's what was
there before prettier/prettier-eslint#338. The open PR I mention in
e3e8d9a (prettier/prettier-eslint#359) suggests ^3.6.5, but it
seems to do so at random; might as well approach as closely as
possible a configuration that we know works.

Now, we have the ESLint upgrade, and format-on-save works as
expected.

[1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/SOLVED.3A.20Prettier.20auto-formatting/near/982426

Fixes: #4120
@github-actions
Copy link
Contributor

Stale pull request

@octref
Copy link

octref commented Aug 13, 2020

@zimme @kentcdodds Do you mind merging and publishing a minor version? Multiple editor formatters would need to install core-js separately to use prettier-eslint.

@kentcdodds
Copy link
Member

I haven't worked on this project in years. I'm definitely not fit to merge any pull requests at this point. Sorry. 😬

If there are no other maintainers who can merge pull requests, then let me know and I'll give somebody the rights.

@octref
Copy link

octref commented Aug 14, 2020

Seems @hamzahamidi is still doing maintenance.

@github-actions github-actions bot closed this Aug 22, 2020
@clovis1122
Copy link

Hello, would be nice to have this one merged! @hamzahamidi @kentcdodds any way we can help?

@hamzahamidi
Copy link
Collaborator

hamzahamidi commented Nov 25, 2020

I'm not fan of adding core-js as a dependency, maybe as a peer-dependency instead?

@hamzahamidi hamzahamidi reopened this Nov 25, 2020
@codecov-io
Copy link

codecov-io commented Nov 26, 2020

Codecov Report

Merging #359 (bbe5485) into master (06d40ec) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #359   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          208       208           
  Branches        42        42           
=========================================
  Hits           208       208           

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 06d40ec...bbe5485. Read the comment docs.

@exah
Copy link

exah commented Dec 1, 2020

I think best way is to compile without corejs (as this is node library) or target newer version of node.js (as required polyfills no longer needed).

require("core-js/modules/es.array.iterator")
require("core-js/modules/es.string.trim-start")
require("core-js/modules/es.string.trim-end")

All features should be available in node 10

@chrisbobbe
Copy link
Contributor

All features should be available in node 10

I think Node 10 is now targeted: 8f35b25

(I haven't independently verified that this solves anything, but it sound like it might?)

@chrisbobbe
Copy link
Contributor

Oh I think this can be closed because core-js stopped being imported in #539. Is that right?

@esetnik esetnik closed this Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find module 'core-js/modules/es.array.iterator'
9 participants