-
Notifications
You must be signed in to change notification settings - Fork 26.6k
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
On v15 all imports are erroring. #2496
Comments
Are you using |
Sure. Here Is one of the files import fs from 'fs/promises';
const subscriptions = new Map();
export default async (client) => {
/**
* loads all modules and their subscriptions
*/
const modules = await fs.readdir('./src/modules');
await Promise.all(
modules.map(async (moduleName) => {
// Loads the module
const module = await import(`./modules/${moduleName}/module.js`);
// skips the module, in case it is disabled.
if (module.enabled) {
// Loads each of it's subscriptions into their according list.
module.subscriptions.forEach((fun, event) => {
if (!subscriptions.has(event)) {
subscriptions.set(event, []);
}
subscriptions.get(event).push(fun);
});
}
})
);
/**
* Setting up all events.
* binds all events inside the subscriptions map to call all functions provided
*/
subscriptions.forEach((funs, event) => {
client.on(event, (...args) => {
funs.forEach(async (fun) => {
try {
await fun(client, ...args);
} catch (e) {
client.emit('error', e);
}
});
});
});
}; I just noticed it isn't all files, but actually just ones I import |
Seems like I can reproduce this; looking into it. Could you file an issue for this (with the same content) on In the meantime, you can disable the rule in your eslint config to avoid the errors. |
Yeah I can do that. Thanks. |
The issue seems to be when you've named a variable It's a bug in eslint-plugin-import; we'll try to resolve it there. |
@ljharb Was this issue resolved? I'm using WebPack along with HMR where WebPack provides a "module" variable. I looked at your comment and removed this line from code and the error vanished.
I took me several hours to get here and realize what exactly the issue was. I'm using the latest packages and the issue is still there. Thank you! |
@hasnaindev if it’s still there in v2.25.3 or later of the import plugin, please file a new issue there. |
bug is still present. reopen |
@jt3k no, but you can file a new issue. |
Hello @jt3k 👋🏼 I looked over at the eslint-plugin-import source code and I can see that for the rule A solution for now would be to avoid using variable As @ljharb suggested, a good idea would be to open an issue in this repo: eslint-plugin-import. I hope this helps. |
Hello there. I'm trying to update to v15 of airbnb base. However, upon doing so all of our imports are throwing
Cannot use import declarations in modules that export using CommonJS (module.exports = 'foo' or exports.bar = 'hi') import/no-import-module-exports
I haven't found anything about what is wrong in my code. If I could get some insight into what I'm doing wrong that would be greatly appreciated. Here is some info.
.eslintrc.json
Eslint version
^8.2.0
A screenshot of the error
The text was updated successfully, but these errors were encountered: