简体   繁体   English

ESLint 规则在可用时更喜欢从 index.js 导入?

[英]ESLint rule to prefer import from index.js when available?

If I export a module through index.js, I now have two ways I can import that module.如果我通过 index.js 导出一个模块,我现在有两种方法可以导入该模块。 Is there a way to have ESLint enforce that the import through index.js should be used instead of directly importing the module?有没有办法让 ESLint 强制使用通过 index.js 导入而不是直接导入模块?

规则是no-internal-modules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM