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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exports assignments not being picked up by no-unused-modules #1984

Closed
paleite opened this issue Feb 1, 2021 · 7 comments
Closed

Exports assignments not being picked up by no-unused-modules #1984

paleite opened this issue Feb 1, 2021 · 7 comments

Comments

@paleite
Copy link

paleite commented Feb 1, 2021

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.

@ljharb
Copy link
Member

ljharb commented Feb 1, 2021

I think #1974 may have fixed this, but is not yet released.

@paleite
Copy link
Author

paleite commented Feb 1, 2021

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 馃檪

@ljharb
Copy link
Member

ljharb commented Feb 2, 2021

It would be great if you wanted to create a PR with test cases - that would answer it immediately :-)

@ProdigySim
Copy link
Contributor

I think this may be fixed, I tried to create a test case directly for it and it passes:
ProdigySim@308e8ca

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.

@ljharb
Copy link
Member

ljharb commented Apr 7, 2022

Thanks!

@paleite can you confirm? I'll reopen if it's still a problem for you.

@ljharb ljharb closed this as completed Apr 7, 2022
@ProdigySim
Copy link
Contributor

@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:

1e4d413

@ljharb ljharb reopened this Apr 7, 2022
@ProdigySim
Copy link
Contributor

Opened a PR to run the current tests: #2427

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

3 participants