-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
import/namespace
creates false positives for 'prettier' in v2.30.0
#3069
Comments
hmm, i wonder if this is caused by ExportMap changes (cc @soryy708) |
I don't know if it helps, but it also reports for |
|
Is this a regression or is this a configuration error in relation to |
Since |
@marikaner Is this about a TypeScript project? or just JavaScript? If TypeScript, what versions of @typescript-eslint/parser and eslint-import-resolver-typescript? |
Oh yes, it is a TypeScript project. We do not have these dependencies and now I wonder how this ever worked. After I added them we have a lot of other (legit) findings, but this one is gone. Thanks for your support! |
This should be reopened, as it can be reproduced in a plain JavaScript project with ES modules:
import eslintImport from "eslint-plugin-import";
export default [
eslintImport.flatConfigs.recommended,
{ languageOptions: { ecmaVersion: "latest" } },
];
import * as prettier from "prettier";
(async () => {
console.log(await prettier.format("x=1", { filepath: "test.js" }));
})(); $ node foo.mjs
x = 1;
$ npx eslint foo.mjs
/tmp/test/foo.mjs
1:8 error No exported names found in module 'prettier' import/namespace
4:30 error 'format' not found in imported namespace 'prettier' import/namespace
✖ 2 problems (2 errors, 0 warnings) |
@andersk TS's module system is broken unless you're using esModuleInterop and synthetic imports. If you do that, what happens? |
@ljharb There is no TS at all in my example. |
ah, i saw Either way, if it's still a problem, please file a new issue and I'll do my best to look into it. |
In general, a namespace import ( In any case, I get errors both ways, as detailed in my new issue: |
Hey, I am using prettier within a generator cli. I am trying to upgrade to version 2.30.0 but it shows me the following error when I do:
import * as prettier from 'prettier';
:No exported names found in module 'prettier'.
.When I import it with
import { format } from 'prettier'
it does not complain, proving that the name actually exists.I am using prettier version 3.3.3 with CJS.
The text was updated successfully, but these errors were encountered: