Exports assignments not being picked up by no-unused-modules
First of all, thanks for a great plugin! This has aided our team and saved us HOURS of debugging and it makes our imports and exports really consistent 🙂
I'm using export assignments (export = , see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require ) in some of my TypeScript modules and no-unused-modules claims the modules aren't exporting anything.
Background, I'm writing my ESLint config in TypeScript, and want the compiled TypeScript code to say module.exports = eslintConfig
My ESLint config for the rule looks like this:
"import/no-unused-modules": ["error", { missingExports: true }]
And the module looks like this:
index.ts:
const eslintConfig = {
rules: {
"import/no-unused-modules": ["error", { missingExports: true }],
},
};
export = eslintConfig;
no-unused-modules with missingExports set to true will claim index.ts does not export a module.
I think #1974 may have fixed this, but is not yet released.
Interesting, but I'm not sure it's the same.
I looked through the PR, but I couldn't find anything regarding exports in there, only regarding imports.
Either way, I'll make sure to monitor the status of this. Thanks again 🙂
It would be great if you wanted to create a PR with test cases - that would answer it immediately :-)
I think this may be fixed, I tried to create a test case directly for it and it passes: https://github.com/ProdigySim/eslint-plugin-import/commit/308e8ca29623d9868919b66fb7e944d9fd6c516b
I am still having issues with exports of this style in my project, but it may be due to misconfiguration or outdated versions. I'll try to update here if I fix it.
Thanks!
@paleite can you confirm? I'll reopen if it's still a problem for you.
@ljharb actually, I think none of the TypeScript tests in named.js are wired up to actually run... it looks like the tests are collected in invalid/valid arrays but they are not run at all. So I was accidentally not running my test.
I pushed up another commit to run the tests and now my test case fails + another TS test is actually failing already:
https://github.com/import-js/eslint-plugin-import/commit/1e4d413f7ce74345e424c74196f54c35d7dcde53
Opened a PR to run the current tests: https://github.com/import-js/eslint-plugin-import/pull/2427