1

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

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

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

4

2 回答 2

3

好吧,我已经用尽了我的选择;包括在文件中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
于 2019-03-13T19:44:12.483 回答
0

.eslintrc

"comma-dangle": [
  "error", 
  { 
    "exports": "never",
    "imports": "never"
  }
]
于 2020-03-19T02:03:52.940 回答