Skip to content

Typescript Docs Question #2586

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

Closed
Nfinished opened this issue Nov 4, 2022 · 9 comments
Closed

Typescript Docs Question #2586

Nfinished opened this issue Nov 4, 2022 · 9 comments
Labels

Comments

@Nfinished
Copy link
Contributor

The following bit is unclear to me.

# TypeScript

You may use the following shortcut or assemble your own config using the granular settings described below.

Make sure you have installed [`@typescript-eslint/parser`] and [`eslint-import-resolver-typescript`] which are used in the following configuration.

```yaml
extends:
  - eslint:recommended
  - plugin:import/recommended
# the following lines do the trick
  - plugin:import/typescript
settings:
  import/resolver:
    # You will also need to install and configure the TypeScript resolver
    # See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
    typescript: true
    node: true


[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
[`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript

Does "You may use the following shortcut" and "the following lines do the trick" indicate that plugin:import/typescript should preclude any other configuration? Or do I still need to add the configuration outlined in https://github.com/import-js/eslint-import-resolver-typescript#configuration

Thank you!

@ljharb
Copy link
Member

ljharb commented Nov 4, 2022

it says lines, plural, so you'd need all of them.

@Nfinished
Copy link
Contributor Author

Nfinished commented Nov 4, 2022

Including configuring the resolver or are there defaults?

# You will also need to install and configure the TypeScript resolver
# See also https://github.com/import-js/eslint-import-resolver-typescript#configuration

@ljharb
Copy link
Member

ljharb commented Nov 4, 2022

Yes, you still need the resolver.

@Nfinished
Copy link
Contributor Author

I understand that I need it but is the ootb configuration enough or do I need to follow the configuration steps listed here? https://github.com/import-js/eslint-import-resolver-typescript#configuration

@ljharb
Copy link
Member

ljharb commented Nov 4, 2022

You need to follow all the steps listed there - that's why they're listed.

@Nfinished
Copy link
Contributor Author

Can you see how I found You may use the following shortcut or assemble your own config using the granular settings described below. unclear given the rest of the section? What is the following shortcut? As I'm reading it I only see a guide to assembling my own config.

@ljharb
Copy link
Member

ljharb commented Nov 4, 2022

Indeed I can; happy to review a PR that makes it more clear.

To clarify, "all those lines" are the shortcut - the granular settings are the other sections of the document.

@Nfinished
Copy link
Contributor Author

Ah understood, thank you. It also threw me that eslint-import-resolver-typescript's config example uses the bare import plugin rather that import/recommended so it's unclear if any of that comes with /recommended

@soryy708
Copy link
Collaborator

The associated PR was merged, so this is clearly complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants