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

"core-modules" doesn't work for submodules #2380

Closed
arturenault opened this issue Feb 3, 2022 · 3 comments
Closed

"core-modules" doesn't work for submodules #2380

arturenault opened this issue Feb 3, 2022 · 3 comments

Comments

@arturenault
Copy link

I added the following line to my .eslintrc to indicate that aws-sdk is a core module

    "import/core-modules": ["aws-sdk"]

This was working fine until I had to import a submodule of that package:

import { GetParametersByPathResult } from "aws-sdk/clients/ssm"

When this line is in the code I get the following error:

  3:1  error  'aws-sdk' should be listed in the project's dependencies, not devDependencies  import/no-extraneous-dependencies

I'd expect "core-modules" to apply to all submodules of that particular module, right?

@ljharb
Copy link
Member

ljharb commented Feb 3, 2022

aws-sdk/clients/ssm is not a core module, no. Core modules are only the precise path in the list - in the same way, fs and fs/promises are core modules, but if you try to import fs/something you'll get node_modules/fs/something.

@arturenault
Copy link
Author

Interesting, TIL. Thanks for the clarification.

In this particular case I was able to work around this by importing "@aws-sdk/client-ssm" instead of the global "aws-sdk" package.

@ljharb
Copy link
Member

ljharb commented Feb 3, 2022

Either way, I'd suggest including the AWS tools in your package.json (i'm aware that's not necessary when deployed) so that locally and in CI, you can track versions.

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

No branches or pull requests

2 participants