繁体   English   中英

带有 Babel plugin-proposal-export-default-from 的 ESLint

[英]ESLint with Babel plugin-proposal-export-default-from

我刚刚添加了这个babel 插件,以便使用export aDefault from 'a/module'

效果很好,因为我可以从其他文件导入这样的导出,但 eslint 并没有放过我。 它无情地突出了我的出口声明。

我们是否有一个 eslint 插件,或者我应该怎么做? 我的.eslintrc.yaml目前扩展了standard .

好吧,我已经用尽了我的选择; 包括将babel-eslint作为eslintrc.json文件中的解析器。

如果有人遇到类似的问题,我决定调整标准规范,使用一些别名,并忘记 babel 语法;

// index.js

export { default as PreferredName, aNamedExport } from 'a/module';
export { default as AnotherPreferredName, anotherNamedExport } from 'another/module';

// or export all the named exports from another/module.js
export * from 'another/module'; // this won't export the default. It will also throw an error if anotherNamedExport has already been exported from another/module.js as above

.eslintrc

"comma-dangle": [
  "error", 
  { 
    "exports": "never",
    "imports": "never"
  }
]

暂无
暂无

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

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