shaketbaby / directory-named-webpack-plugin

A Webpack plugin that treats a file with the name of directory as the index file
MIT License
182 stars 17 forks source link

Is there an eslint rule I can enable to behave like this? #27

Open nuclearspike opened 6 years ago

nuclearspike commented 6 years ago

I like this plugin, but the issue is I have to shut off some eslint rules or my IDE complains the files don't exist since it's altering valid import rules. Is there an eslint plugin that allows my code to still be checked for valid imports but with similar options?

shaketbaby commented 6 years ago

Not that I know of, sorry

mkg0 commented 6 years ago

If you change resolver behavior completely to webpack resolver, eslint shouldn't throw any error.

you can try this https://www.npmjs.com/package/eslint-import-resolver-webpack

martin-eq commented 6 years ago

Tried to use eslint-import-resolver-webpack but it doesn't work for me using Webpack 4.23.1 and ESLint 5.7.0. Does it work for you @mkg0?

EDIT: Nevermind, there was a configuration issue in my webpack.config.js that was breaking eslint. I'm exporting a function to get access to env and argv parameters but eslint-import-resolver-webpack doesn't pass that argument to Webpack:

module.exports = (env, argv) => {
  [...]
  return config;
}

Works properly with eslint-import-resolver-webpack!

livathos commented 3 years ago

In my case eslint-import-resolver-webpack didn't help me because in my project webpack configuration returns Promise. So I made eslint package which solve this problem and it works fine for me. Package support aliases. If anyone is interested, the package is available here: https://www.npmjs.com/package/eslint-import-resolver-directory-named