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

Rule Proposal: disallow thirdparty module which has the same name as a core module. #66

Closed
mysticatea opened this issue Feb 21, 2017 · 0 comments · Fixed by singapore/lint-condo#246

Comments

@mysticatea
Copy link
Owner

mysticatea commented Feb 21, 2017

If you depend on third-party modules which have the same name as a core module indirectly, you may use the third-party modules instead of core modules silently because of flattening node_modules. This might cause unintentional behaviors.

This rule reports use of such third-party modules.

This rule ignores deprecated core modules.

{
    "node/no-hide-core-modules": ["error", {
        "allow": [],
        "checkMode": "indirectOnly"
    }]
}
  • allow is the option to allow to hide specific core modules. E.g. allow: ["util"].
  • checkMode
    • "all" disallows such third-party modules.
    • "directOnly" disallows such third-party modules but allows those if those are in indirect dependencies.
    • "indirectOnly" (default) disallows such third-party modules but allows those if those are in direct dependencies. This option allows those if you wrote those in package.json explicitly.
@mysticatea mysticatea self-assigned this Feb 21, 2017
brettz9 pushed a commit to brettz9/eslint-plugin-node that referenced this issue Jul 24, 2024
…ea#139)

* feat: Use enhanced-resolve for imports

* chore: Improve the metadata from "ImportTarget"

* chore: remove "enhanced-resolve" from "no-hide-core-modules"

* test: Add a test for mysticatea#66

* feat!: Allow ts paths aliases (mysticatea#84)

* feat: Allow for "allowImportingTsExtensions" (mysticatea#134)

* feat: Add test for import maps (mysticatea#147)

* Update lib/util/import-target.js

Co-authored-by: Sebastian Good <[email protected]>

* test: Add test for n/no-missing-require eslint/use-at-your-own-risk

* chore: Remove esbuild

* feat: Allow for settings.cwd to be used before process.cwd

* chore: replace reference to eslint/use-at-your-own-risk

* chore: Remove more unused packages

* chore: update rule test options to flat config

* fix: incorrect env in tests

---------

Co-authored-by: 唯然 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant