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

Webpack resolver doesn't catch exports for all of entries #605

Closed
lancedikson opened this issue Oct 4, 2016 · 3 comments
Closed

Webpack resolver doesn't catch exports for all of entries #605

lancedikson opened this issue Oct 4, 2016 · 3 comments

Comments

@lancedikson
Copy link

I settled the plugin and a webpack resolver for my webpack-based project.

"eslint-import-resolver-webpack": "^0.6.0",
"eslint-plugin-import": "^1.12.0",

Here is my webpack config:

// ...
var config = {
//...
entry: {
    'widget': [
      path.join(__dirname, 'src', 'js', 'index.js')
    ]
  },
output: {
    filename: '[name].js',
    path: path.join(__dirname, 'lib')
  },
//...

externals: {
    widget: 'VideolyWidget'
  },
//...

/* add extensions to entries */
var excludedNames = ['base'];
fs
  .readdirSync(path.join(__dirname, "src", "extensions"))
  .forEach(function (extension) {
    var extPath = path.join(__dirname, 'src', 'extensions', extension, 'js', 'index.js');
    if (!excludedNames.includes(extension) && fs.existsSync(extPath)) {
      config.entry['extensions/' + extension] = [extPath];
    }
  });
//...

As you can see, I'm trying to make external from the widget entry point and use it in extensions. So, when I start linting process it says:

~/widget/src/extensions/video-catcher/js/index.js
  2:1  warning  'widget' should be listed in the project's dependencies. Run 'npm i -S widget' to add it  import/no-extraneous-dependencies

because of the

import widget from 'widget';

But I'm totally sure that the resolver is trying to resolve it and findExternal returns true here: https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/webpack/index.js#L95

But resolver works because after I installed it I avoided warnings about aliases.

Any ideas why it doesn't use found external and makes warning about it?

@benmosher
Copy link
Member

This is more or less a duplicate of #479: no-extraneous-dependencies doesn't have enough metadata (yet) to know that widget isn't an actual dependency. Working on it! 😅

@lancedikson
Copy link
Author

@benmosher, thanks for the answer! Good to hear, that development doesn't stop 👍 You could give me some extra details if you want a participant in this feature. I'd like to help if I can :)
Is there any card or issue with ideas about this feature?

@benmosher benmosher added this to the v3 - import/order internal milestone Nov 3, 2016
@soryy708
Copy link
Collaborator

Closed as duplicate of #479

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

4 participants