我们的团队始终使用eslint来确保正确的编码标准,以便在编写代码时遵循规则和规定。我们使用了eslint-plugin-import。它很好地解决了我们的一些问题,但不是全部。
以下面这个例子为例:
Foo.js
const Foo = "Foo"
export default Foo
Run Code Online (Sandbox Code Playgroud)
Foo.jsx
import Bar from './foo';
// This still works.
// It can cause confusion.
// I want to use the original exported default name Foo instead of Bar
// otherwise show some error in the Code Editor
Run Code Online (Sandbox Code Playgroud)
我想要发生的是使用该模块或文件的默认导出的原始名称。否则会在代码编辑器中抛出一些错误。
如果有人可以提供帮助,我们将不胜感激。提前致谢。