Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

ESlint报错

### 问题描述
eslint报错Plugin/Preset files are not allowed to export objects, only functions.
### 问题出现的环境背景及自己尝试过哪些方法
image.png

### 相关代码
粘贴代码文本(请勿用截图)
我的pakage.json:

{
  "name": "delivery-platform",
  "version": "1.0.0",
  "description": "delivery-platform",
  "author": "xcc",
  "private": true,
  "scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "lint": "eslint --ext .js,.vue src",
    "build": "node build/build.js",
    "nw": "node test/nightwatch/runner.js"
  },
  "dependencies": {
    "@babel/cli": "^7.0.0-beta.40",
    "@babel/core": "^7.12.10",
    "@babel/plugin-proposal-class-properties": "^7.12.1",
    "@babel/plugin-syntax-jsx": "^7.12.1",
    "@babel/preset-env": "^7.12.11",
    "@babel/preset-react": "^7.0.0-beta.40",
    "@ecomfe/stylelint-config": "^1.1.1",
    "autoprefixer": "^7.1.2",
    "axios": "^0.19.0",
    "babel-eslint": "^10.1.0",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^8.2.2",
    "babel-plugin-lodash": "^3.3.2",
    "babel-plugin-react-transform": "^3.0.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-2": "^6.22.0",
    "bootstrap": "^4.3.1",
    "chalk": "^2.4.2",
    "clipboard": "^2.0.4",
    "copy-webpack-plugin": "^4.0.1",
    "cron-parser": "^2.13.0",
    "css-loader": "^0.28.11",
    "echarts": "^4.6.0",
    "element-resize-detector": "^1.2.0",
    "element-ui": "^2.12.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-babel": "^5.3.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "jsplumb": "^2.9.2",
    "lodash": "^4.17.15",
    "mockjs": "^1.1.0",
    "node-notifier": "^5.1.2",
    "node-sass": "^4.12.0",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "qs": "^6.9.4",
    "rimraf": "^2.6.0",
    "sass-loader": "^7.3.1",
    "sass-resources-loader": "^2.0.1",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "style-loader": "^1.0.0",
    "stylelint": "^13.8.0",
    "stylus-loader": "^3.0.2",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "url-loader": "^0.5.8",
    "uuid": "^3.4.0",
    "vue": "^2.6.0",
    "vue-awesome-swiper": "^3.1.3",
    "vue-axios": "^2.1.4",
    "vue-codemirror": "^4.0.6",
    "vue-eslint-parser": "^7.3.0",
    "vue-rippler": "^1.3.3",
    "vue-router": "^3.0.1",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.6.0",
    "vuedraggable": "^2.23.2",
    "vuex": "^3.1.1",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.11.5",
    "webpack-merge": "^4.1.0",
    "xlsx": "^0.15.1"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.12.1",
    "@babel/eslint-plugin": "^7.12.1",
    "@ecomfe/eslint-config": "^7.0.0",
    "chromedriver": "^87.0.4",
    "eslint": "^7.17.0",
    "eslint-plugin-vue": "^7.4.1",
    "nightwatch": "^1.3.7",
    "nightwatch-html-reporter": "^2.0.6",
    "url-loader": "^0.5.9",
    "vue-loader": "^13.7.3"
  },
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

我的.eslintrc.js

module.exports = {
    // presets: [
    //     "@babel/preset-env",
    //     "@babel/preset-react"
    // ],
    // plugins: [
    //     [
    //         "@babel/plugin-proposal-class-properties",
    //     ]
    // ],
    extends: [
        '@ecomfe/eslint-config/default', // 根据代码库ES版本选择default或es5
        '@ecomfe/eslint-config/defect',
        '@ecomfe/eslint-config/vue'
    ],
    query: {
        presets: ['@babel/react', '@babel/stage-0'],
        plugins: ['@babel/proposal-class-properties']
    }
};

### 你期待的结果是什么?实际看到的错误信息又是什么?
貌似是兼容性的问题,但是调试很久没有结果,请教大佬如何配置


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

看你main.js里面写的啥


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...