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

chore: add typescript as optionalDependency #1046

Closed

Conversation

kaicataldo
Copy link
Member

While debugging eslint/eslint#12376, I was kindly directed by @JamesHenry to #828 (comment). Thought this could maybe made clearer with a README change and adding typescript as an optional dependency. Testing with npm<6.11, it seems the optionalDependencies key is ignored.

Happy to remove the optional dependency addition if the team feels just having the documentation is a better fix for now.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @kaicataldo!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@@ -16,6 +16,8 @@
npm install @typescript-eslint/parser --save-dev
```

Note: `@typescript-eslint/parser` assumes you have `typescript` already installed. Please read the documentation [here](https://github.com/typescript-eslint/typescript-eslint#supported-typescript-version) for more details.
Copy link
Member

Choose a reason for hiding this comment

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

probably want this in eslint-plugin as well, as eslint-plugin also directly consumes typescript.

@@ -61,5 +61,8 @@
"glob": "^7.1.4",
"lodash.isplainobject": "4.0.6",
"typescript": "*"
},
"optionalDependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

ditto for needing this in eslint-plugin - might as well be consistent :)
parser consumes typescript-estree so it isn't needed there.

@@ -220,7 +220,7 @@ We will always endeavor to support the latest stable version of TypeScript. Some

**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.7.0`.**

This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `optionalDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
Copy link
Member

Choose a reason for hiding this comment

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

maybe would be good to add a comment stating explicitly that we expect the user to install typescript in the project root?

might as well be explicit.

@ark120202
Copy link

optionalDependencies is pretty much the same as regular dependencies (with an exception that it doesn't fail when dependency can't be installed), so #828 (comment) applies there

@bradzacher
Copy link
Member

I didn't realise optionalDependencies would get installed.

In this case, we'd rather have a peer dependency with peerDependenciesMeta setting it to optional:

{
  "peerDependencies": {
    "typescript": "*"
  },
  "peerDependenciesMeta": {
    "typescript": {
      "optional": true
    }
  }
}

Yarn's had this supported for a bit, pnpm has support for it, and npm added support about a month ago.
It's probably getting to be a decent time for us to just use this and advise those that complain about warnings to upgrade.

@bradzacher
Copy link
Member

I'm going to close this infavour of #990, which I missed earlier, and is doing the optional peer deps config.

@bradzacher bradzacher closed this Oct 10, 2019
@kaicataldo kaicataldo deleted the add-ts-as-optional-dep branch October 10, 2019 18:00
@kaicataldo
Copy link
Member Author

Sounds good!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
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.

None yet

3 participants