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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No internal module export #1481

Closed
adjerbetian opened this issue Sep 18, 2019 · 1 comment · Fixed by #1691
Closed

No internal module export #1481

adjerbetian opened this issue Sep 18, 2019 · 1 comment · Fixed by #1691

Comments

@adjerbetian
Copy link

Proposition

Make the rule no-internal-modules also prevent exporting the submodules of other modules.
(currently it only prevents importing)

Description of the problem

When no-internal-modules is set to error, here is what we have:

import { f } from "./modules/submodule"  // error
export { f } from "./modules/submodule"  // no error

This is annoying because it breaks the idea that a folder decides what it makes available to the exterior, and therefore, everything is accessible.

Example

For instance, one could have

module1/
    private/
        f.js
module2/
    hacked_f.js
    g.js

with

//hacked_f.js
export { f } from "../module1/private/f"

//g.js
import { f } from "./hacked_f.js"
@ljharb
Copy link
Member

ljharb commented Sep 19, 2019

This seems like a good thing to add - although it would have to be behind an option to avoid being semver-major.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants