最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin6浏览0评论

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"],

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论