uhyo / eslint-plugin-import-access

https://www.npmjs.com/package/eslint-plugin-import-access
MIT License
355 stars 9 forks source link

`import * as namespace` is not checked #17

Open whzx5byb opened 6 months ago

whzx5byb commented 6 months ago

When import a file via import * as, there is still a chance to expose package/private exports to outside. Is it a bug or design limitation?

// ----- sub/foo.ts -----
/** @public */
export const public_var = 0;

/** @package */
export const package_var = 0;

// ----- baz.ts -----
import * as Foo from "./sub/foo";
Foo.public_var;
Foo.package_var;
    // ^ expect error here
uhyo commented 6 months ago

Thanks for the report!

I don't remember any technical difficulty about this, so it should be just an oversight. I'm not quite sure what we should do against Foo[runtime_value] though...

Want to work on this, but I have limited spare time now... Leaving a help wanted label for now.