Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Update: Open TS peerDependency, warn non-supported version (fixes #167) #193

Merged
merged 1 commit into from
Apr 9, 2017

Conversation

JamesHenry
Copy link
Member

@JamesHenry JamesHenry commented Mar 18, 2017

This would be one way to address #167

Still not sure how I feel about it, but thought I would stick a working example on a branch and look for feedback.

@soda0289 @eslint/eslint-team

@eslintbot
Copy link

Thanks for the pull request, @JamesHenry! I took a look to make sure it's ready for merging and found some changes are needed:

  • The commit summary needs to begin with a tag (such as Fix: or Update:). Please check out our guide for how to properly format your commit summary and update it on this pull request.

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@soda0289
Copy link
Member

I like this solution. It gives the user more information on what to expect.

For example typescript 2.3 has some breaking changes again. This time with how JSX is handled, need to spend some more time looking into. When typescript upgrades we will have to release a new version and a warning will help user understand why the parser is failing.

@corbinu
Copy link

corbinu commented Mar 18, 2017

This feels like the best solution to me also

@alberto
Copy link
Member

alberto commented Mar 18, 2017

Not sure that will work for non-final releases: http://blog.npmjs.org/post/115305091285/introducing-the-npm-semantic-version-calculator

@soda0289
Copy link
Member

We currently use ~2.2.1 for the typescript devDependency. Which should only include versions between >=2.2.0 and < 2.3.0. According to the calculator, https://semver.npmjs.com/, it will only include version 2.2.1 and not the insider preview 2.2.2-insiders.20170302 or any of the development releases like 2.3.0-dev.20170318. I can't think of any other cases where this would fail.

@soda0289
Copy link
Member

@JamesHenry
I think we may need better logic to get the globally installed version of typescript. If we require('typescript') that will only check the devDependency version, which would always match the package.json, not the globally installed one.

@soda0289
Copy link
Member

The more I think about this I think it will be fine since devDepencies are not installed. It should work as expected.

@JamesHenry
Copy link
Member Author

JamesHenry commented Mar 18, 2017

@soda0289 The reason why we need it as a peerDependency in the first place is that we require('typescript') and use it as a library. A global installation of TypeScript gives you access to the compiler's CLI, but that is not our use-case. The require will use whatever version the user installed in their project, the devDependency is only relevant for this project when it runs its tests.

I think it is fair to say require('typescript') will always be the appropriate "active" TypeScript version

@soda0289
Copy link
Member

That makes sense. I was thinking that typescript was bundled with this parser but that is not the case and only happens during development.

@JamesHenry
Copy link
Member Author

Ok I am going to clean this up and request review

@JamesHenry JamesHenry force-pushed the open-ts-peer-dep branch 2 times, most recently from 8d16f31 to 5297ecc Compare March 18, 2017 22:39
@eslintbot
Copy link

LGTM

@JamesHenry JamesHenry changed the title WIP idea, open up peerDep to allow for beta/rc usage ahead of time Update: Open TS peerDependency, warn non-supported version (fixes #167) Mar 18, 2017
@JamesHenry JamesHenry merged commit dd57f81 into master Apr 9, 2017
@JamesHenry JamesHenry deleted the open-ts-peer-dep branch April 9, 2017 09:25
@@ -52,9 +52,10 @@
},
"dependencies": {
"lodash.unescape": "4.0.0",
"object-assign": "^4.0.1"
"object-assign": "^4.0.1",
"semver": "^4.3.6"
Copy link
Contributor

Choose a reason for hiding this comment

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

any particular reason this is not using 5?

Copy link
Member

Choose a reason for hiding this comment

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

Can't think of one. I looked at the commit log and seems they only dropped support for AMD modules and minifying the code in v5. Do you want to create a PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure!

Interesting message on running npm install here, btw.

npm WARN The package semver is included as both a dev and production dependency.

Copy link
Member

Choose a reason for hiding this comment

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

We don't need it in devDependencies anymore as it is used during runtime.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants