簡體   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