eslintrc - Resolve eslint(nodeno-unsupported-featureses-syntax) - How to support JavaScript modules in ESLint? - Stack Overflow

I'm writing a game in JavaScript Redux. I'm unable to configure my .eslintrc.json file so th

I'm writing a game in JavaScript/ Redux. I'm unable to configure my .eslintrc.json file so that it supports the latest JavaScript syntax - I get a message saying

"Import and export declarations are not supported yet" eslint(node/no-unsupported-features/es-syntax).

I've read the official configuration docs for ESLint and tried (I thought all) binations over the past few hours (changing environments, ecmaVersions, parsers and parser options).

The latest thing I've tried is to install a babel-eslint parser and so at the moment my .eslintrc.json looks like this:

{
  "extends": ["airbnb-base", "prettier", "plugin:node/remended"],
  "plugins": ["prettier"],
  "env": {
    "es2020": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module"
  },
  "rules": {
    "prettier/prettier": "error"
  }
}

And my package.json:

{
  "name": "astroman-game",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "scripts": {
    "build": "webpack",
    "start": "webpack-dev-server --open",
    "eslint": "eslint ./"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
    "babel-eslint": "^10.0.3",
    "babel-loader": "^8.0.6",
    "eslint": "^6.1.0",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-config-node": "^4.0.0",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-prettier": "^3.1.2",
    "prettier": "^1.19.1",
    "webpack": "^4.39.3",
    "webpack-cli": "^3.3.7",
    "webpack-dev-server": "^3.8.0"
  },
  "dependencies": {
    "redux-starter-kit": "^0.6.3"
  }
}

But it also didn't solve the problem. I appreciate your help!

I'm writing a game in JavaScript/ Redux. I'm unable to configure my .eslintrc.json file so that it supports the latest JavaScript syntax - I get a message saying

"Import and export declarations are not supported yet" eslint(node/no-unsupported-features/es-syntax).

I've read the official configuration docs for ESLint and tried (I thought all) binations over the past few hours (changing environments, ecmaVersions, parsers and parser options).

The latest thing I've tried is to install a babel-eslint parser and so at the moment my .eslintrc.json looks like this:

{
  "extends": ["airbnb-base", "prettier", "plugin:node/remended"],
  "plugins": ["prettier"],
  "env": {
    "es2020": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module"
  },
  "rules": {
    "prettier/prettier": "error"
  }
}

And my package.json:

{
  "name": "astroman-game",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "scripts": {
    "build": "webpack",
    "start": "webpack-dev-server --open",
    "eslint": "eslint ./"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
    "babel-eslint": "^10.0.3",
    "babel-loader": "^8.0.6",
    "eslint": "^6.1.0",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-config-node": "^4.0.0",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-prettier": "^3.1.2",
    "prettier": "^1.19.1",
    "webpack": "^4.39.3",
    "webpack-cli": "^3.3.7",
    "webpack-dev-server": "^3.8.0"
  },
  "dependencies": {
    "redux-starter-kit": "^0.6.3"
  }
}

But it also didn't solve the problem. I appreciate your help!

Share Improve this question edited Feb 1, 2020 at 18:33 Soviut 91.8k53 gold badges209 silver badges282 bronze badges asked Jan 31, 2020 at 19:33 AgaAga 631 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

You are extending from plugin:node/remended which is for NodeJS. Node only supports require() which are CommonJS-style imports. There is no reason for your frontend application to be using this set of remendations.

Remove plugin:node/remended from the extends list

"extends": ["airbnb-base", "prettier"],

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744274237a4566250.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信