我想棉絨添加到我的Express應用程序和我得到一些錯誤棉短絨約ES6,即‘export’ is only available in ES6 (use esnext option)
,’const’ is only available in JavaScript 1.7
和’arrow function syntax’ is only available in Javascript 1.7
。我不知道如何擺脫這些錯誤 - 任何幫助將不勝感激。我目前已經嘗試安裝幾個東西,包括Sublime Text 2 linter和babel-eslint,但可能會接近這個錯誤。如何修復「僅適用於ES6」linter錯誤?
從相關的package.json:
{
"dependencies": {
"babel-cli": "^6.10.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-2": "^6.5.0",
"bcrypt-nodejs": "0.0.3",
"botkit-sms": "^1.1.0",
"dotenv": "^2.0.0",
"express": "^4.14.0",
"jwt-simple": "^0.5.0",
"mongoose": "^4.6.3",
"passport": "^0.3.2",
"passport-jwt": "^2.2.1",
"passport-local": "^1.0.0",
"request": "^2.76.0",
"routific": "0.0.2"
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^2.13.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-jsx-a11y": "^1.4.2",
"eslint-plugin-react": "^5.1.1",
"nodemon": "^1.9.2"
}
}
.babelrc:
{
"presets": ["es2015", "stage-2"]
}
.eslintrc:
{
extends: ["airbnb", "esnext"],
parser: "babel-eslint",
env: {
browser: false,
node: true,
es6: true
},
rules: {
strict: 0,
quotes: [2, "single"],
no-else-return: 0,
new-cap: ["error", {"capIsNewExceptions": ["Router"]}],
no-console: 0,
import/no-unresolved: [2, { commonjs: true}],
no-unused-vars: ["error", { "vars": "all", "args": "none" }],
no-underscore-dangle: 0,
arrow-body-style: ["error", "always"],
no-shadow: ["error", { "allow": ["done", "res", "cb", "err", "resolve", "reject"] }],
no-use-before-define: ["error", { "functions": false }],
max-len: 0
},
plugins: [
'import'
],
ecmaFeatures: {
jsx: true,
modules: true
}
}