带Babel插件的ESLint-proposal-export-default-from

时间:2019-03-13 15:47:57

标签: javascript node.js babel eslint

我刚刚添加了this babel插件以利用该import glob import os import pandas as pd indir= "C:\\My Directory" outfile = indir + "\\Combined.csv" os.chdir(indir) fileList=glob.glob("*.csv") dfList=[] cols = [0, 2, 6, 7, 9, 10, 11, 21, 22, 29, 31, 32] for filename in fileList: print(filename) df=pd.read_csv(filename, skiprows=[1, 2], usecols=cols) dfList.append(df) concatDf=pd.concat(dfList,axis=0) concatDf.to_csv(outfile,index=None)`

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

我们是否有eslint插件,还是应该怎么做?我的export aDefault from 'a/module'当前扩展了.eslintrc.yaml

2 个答案:

答案 0 :(得分:0)

嗯,我已经用尽了所有选择;包括将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

答案 1 :(得分:0)

.eslintrc

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