Exports assignments not being picked up by no-unused-modules
See original GitHub issueFirst 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Opened a PR to run the current tests: https://github.com/import-js/eslint-plugin-import/pull/2427
@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 ininvalid
/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