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

Support TypeScript 3.7 (and drop Node 6 support for direct inst… #6657

Merged
merged 33 commits into from
Oct 28, 2019

Conversation

Cryrivers
Copy link
Contributor

@Cryrivers Cryrivers commented Oct 15, 2019

This PR addresses TypeScript 3.7 supports, which includes:

Fixes #6569

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to the CHANGELOG.unreleased.md file following the template.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@lydell
Copy link
Member

lydell commented Oct 15, 2019

Looks like your snapshots aren’t up-to-date?

@Cryrivers
Copy link
Contributor Author

@lydell Yeah, it's still WIP.

@Cryrivers Cryrivers marked this pull request as ready for review October 15, 2019 06:18
@Cryrivers Cryrivers changed the title WIP: Support TypeScript 3.7 Support TypeScript 3.7 Oct 15, 2019
@Cryrivers
Copy link
Contributor Author

@suchipi fyi

@Cryrivers
Copy link
Contributor Author

@lydell updated

@Cryrivers
Copy link
Contributor Author

Cryrivers commented Oct 15, 2019

btw @typescript-eslint/typescript-estree has chokidar as a dependency for watch feature, which doesn't make rollup happy. could i get any advice for that?

@lydell
Copy link
Member

lydell commented Oct 15, 2019

I think it should be possible to stub chokidar out. Maybe @fisker can help?

@fisker
Copy link
Member

fisker commented Oct 15, 2019

@lydell Even if we can make this work, still new version @typescript-eslint/typescript-estree can't update due to node version problem

like I said in #6601

Notice: @typescript-eslint/typescript-estree@2.3.2 requires node >=8 , so this PR might can't merge until prettier@2

@Cryrivers Cryrivers mentioned this pull request Oct 15, 2019
4 tasks
@lydell
Copy link
Member

lydell commented Oct 15, 2019

Ah, thanks, I forgot about that.

@radiosilence
Copy link

radiosilence commented Oct 16, 2019

@lydell Even if we can make this work, still new version @typescript-eslint/typescript-estree can't update due to node version problem

like I said in #6601

Notice: @typescript-eslint/typescript-estree@2.3.2 requires node >=8 , so this PR might can't merge until prettier@2

How long might that be? Surely node 6 counts as legacy now. Node 8 was released 2 years ago. I'm not sure node 6 is even in its LTS maintenance window any more.

@SimenB
Copy link
Contributor

SimenB commented Oct 16, 2019

I'm not sure node 6 is even in its LTS maintenance window any more.

6 has been EOL since April. (12 will be LTS Monday next week)

https://github.com/nodejs/Release/blob/master/README.md

@Cryrivers
Copy link
Contributor Author

@duailibe @ikatyang could i know what you think about dropping the support for Node 6?

@fisker
Copy link
Member

fisker commented Oct 17, 2019

#3919

@Cryrivers

@alexander-akait
Copy link
Member

alexander-akait commented Oct 17, 2019

#3919 (comment)

I think it is time to drop node 6 for direct-from-GitHub installs

@radiosilence
Copy link

I'm not sure node 6 is even in its LTS maintenance window any more.

6 has been EOL since April. (12 will be LTS Monday next week)

https://github.com/nodejs/Release/blob/master/README.md

Can we drop support for it then?

@alexander-akait
Copy link
Member

/cc @prettier/core I think it is time to use babel on our source code to avoid breaking change also we drop node 6 for direct-from-GitHub installs, what do you think about it?

@lydell
Copy link
Member

lydell commented Oct 17, 2019

drop node 6 for direct-from-GitHub installs

Sounds good to me!

@Cryrivers
Copy link
Contributor Author

Cryrivers commented Oct 20, 2019

@fisker could you help advice how to shim chokidar?

@fisker
Copy link
Member

fisker commented Oct 20, 2019

@Cryrivers

I already merged your code into #6680

About how to make it work, you can read my PR there is build script in another repo.

@Cryrivers
Copy link
Contributor Author

@fisker great, i'll close my PR when yours has been merged.

@Cryrivers
Copy link
Contributor Author

FYI, typescript-estree removed the dependency on chokidar in 2.5.0

@Cryrivers
Copy link
Contributor Author

Now you can try in the playground for this PR!

@alexander-akait
Copy link
Member

/cc @Cryrivers Thanks for great work

/cc @fisker and @Cryrivers Can you work together (comments/reviews/etc) in one PR? Because we have two PRs #6657 and #6680, it is create unnecessary noise for contributors and developers who wait this

@fisker
Copy link
Member

fisker commented Oct 22, 2019

actually Its your call, drop node 6, merge this.

support node 6, merge #6680.

they are the same

@alexander-akait
Copy link
Member

@fisker

actually Its your call, drop node 6, merge this.

It is just proposal, we need consider this

/cc @prettier/core Which solution will we choose?

@alexander-akait alexander-akait added this to the 1.19 milestone Oct 22, 2019
Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

Formatting some following cases incorrectly removes the parentheses and results in a syntax error when reformatting.

let f = () => ({}?.());
a = () => ({}?.() && a);
a = () => ({}?.()() && a);
(a) => ({}?.()?.b && 0);
(x) => ({}?.()());
(x) => ({}?.().b);
({}?.a().b());
({ a: 1 }?.entries());

We should add OptionalCallExpression to this line to fix this.(And also need to add tests)

However, these occur even in Babel's OptionalChaining format and have not been pointed out so far, so I think we can ignore it in this PR.

@thorn0
Copy link
Member

thorn0 commented Oct 26, 2019

@sosukesuzuki Optional chaining is going to become much more popular after TS 3.7 gets released, so better to catch all these parens issues in this PR and be ready.

Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

Thank you, @Cryrivers and @thorn0, LGTM!

@ikatyang
Copy link
Member

@Cryrivers

@ikatyang could i know what you think about dropping the support for Node 6?

Sorry for the late response. FWIW, I'm in favor of dropping legacy Node, but we've promised to our user that we won't make breaking changes in minor/patch release (according to semver) so we shouldn't introduce such change in minor release IMO, though I'm still not quite sure if this rule should be applied here. One possible backward-compatible workaround would be to introduce some postinstall scripts to hide those breaking changes until 2.0.

@lydell
Copy link
Member

lydell commented Oct 27, 2019

@ikatyang Just in case you weren’t aware, we only drop Node 6 support for direct installation from GitHub. The version released on npm will still work – even in Node.js 4. See also: typescript-eslint/typescript-eslint#1108 (comment)

Not sure if that changes your opinion, but just in case 🤷‍♂

@ikatyang
Copy link
Member

Yeah, I'm aware. I meant that we've explicitly specified node>=6 in package.json, which looks like a promise to me, I'm not sure how many people use it this way though.

@thorn0
Copy link
Member

thorn0 commented Oct 27, 2019

@ikatyang IMHO the contents of package.json on GitHub can't be a promise unless such a promise is documented somehow, otherwise we could call any piece of code a promise.

@ikatyang
Copy link
Member

@thorn0 Yes, but we did mention that we support installation from GitHub in https://prettier.io/versions.html, that's why I'm still not sure if it is considered a promise. Anyway, this is just a suggestion, not a requirement.

@thorn0
Copy link
Member

thorn0 commented Oct 27, 2019

@ikatyang It's called "next" there though, not 1.x.x.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Great job 👍

@soroushm
Copy link

So we are waiting to release :)

@kirananto
Copy link

Awesome.. waiting for the release.. 💯

@alexander-akait
Copy link
Member

@ikatyang I agree with @thorn0 , next also can be unstable, for example for 2.0 we also will be have next, but with breaking changes

@lydell lydell changed the title Support TypeScript 3.7 (and drop Node 6 support for direct installation from GitHub) Support TypeScript 3.7 (and drop Node 6 support for direct inst… Oct 28, 2019
@lydell lydell merged commit 2cfd8fb into prettier:master Oct 28, 2019
@deser
Copy link

deser commented Oct 29, 2019

Guys, when it's planned to deliver this to npm?

@damiangreen
Copy link

Is anyone getting Error: Cannot find module 'source-map-support' issues with this?

@thorn0
Copy link
Member

thorn0 commented Oct 29, 2019

@damiangreen What exactly are you doing to get it?

@damiangreen
Copy link

@thorn0 It appears to happen on our Bamboo build server.

@thorn0
Copy link
Member

thorn0 commented Oct 29, 2019

@damiangreen What exactly is that build server doing when this happens? Do you have any stack traces or something?

@damiangreen
Copy link

damiangreen commented Oct 29, 2019

@thorn0 Our devops guys just pulled this down from AWS Console.

I just switched back from "prettier": "https://github.com/Cryrivers/prettier.git",to using "prettier": "^1.18.2", and the error went away.

Note I have the latest "source-map-support": "^0.5.15", in my dependencies

09:01:51
internal/modules/cjs/loader.js:638

09:01:51
throw err;

09:01:51
^

09:01:51
Error: Cannot find module 'source-map-support'

09:01:51
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

09:01:51
at Function.Module._load (internal/modules/cjs/loader.js:562:25)

09:01:51
at Module.require (internal/modules/cjs/loader.js:692:17)

09:01:51
at require (internal/modules/cjs/helpers.js:25:18)

09:01:51
at Object.<anonymous> (/usr/src/app/server.js:1:1)

09:01:51
at Module._compile (internal/modules/cjs/loader.js:778:30)

09:01:51
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

09:01:51
at Module.load (internal/modules/cjs/loader.js:653:32)

09:01:51
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

09:01:51
at Function.Module._load (internal/modules/cjs/loader.js:585:3)

@thorn0
Copy link
Member

thorn0 commented Oct 29, 2019

@damiangreen You still haven't written what this process is doing. How does it use Prettier? Is this stack trace full?

BTW, let's stop spamming everyone who follows this PR. Feel free to open an issue with a proper error report.

@prettier prettier locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet