"ecmaVersion": "2017" gives Parsing error: Unexpected token ( on async method
See original GitHub issue- ESLint Version: v4.10.0
- Node Version: v8.10.0
- npm Version: 6.0.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": "2017"
},
"plugins": [
"node"
],
"rules": {
"arrow-parens": ["error", "always"],
"no-var": "error",
"prefer-const": "error",
"array-bracket-spacing": ["error", "never"],
"comma-dangle": ["error", "never"],
"computed-property-spacing": ["error", "never"],
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"indent": ["error", 2, { "SwitchCase": 1 }],
"no-confusing-arrow": ["error", {"allowParens": false}],
"no-extend-native": "error",
"no-mixed-spaces-and-tabs": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-unused-vars": "error",
"no-use-before-define": ["error", "nofunc"],
"object-curly-spacing": ["error", "always"],
"prefer-arrow-callback": "error",
"quotes": ["error", "single", "avoid-escape"],
"semi": ["error", "always"],
"space-infix-ops": "error",
"spaced-comment": ["error", "always"],
"keyword-spacing": ["error", { before: true, after: true }],
"template-curly-spacing": ["error", "never"],
"semi-spacing": "error",
"strict": "error",
"no-console": "off",
"node/no-unsupported-features": ["error", {"version": 8}],
"node/no-missing-require": "error"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
class DeadLetter {
constructor(options = {}) {
if (!options.queueUrl)
throw new Error('queueUrl is undefined');
this.options = options;
this.sqs = new AWS.SQS({
region: url.parse(options.queueUrl).host.split('.')[1],
params: { QueueUrl: options.queueUrl }
});
this.cfn = new AWS.CloudFormation({
region: url.parse(options.queueUrl).host.split('.')[1],
});
const actions = { purse, writeOut, replay, triage };
findQueues(this.cfn, options);
const queues = selectQueue(queues);
const queue = triageSelection(queue);
const data = actions[data.action](sqs, data.queue);
}
async findQueues(options) {
return new Promise((resolve) => {
let res = await this.cfn.describeStacks({ StackName: options.stackName}).promise();
npm run lint
this basically runs eslint.
What did you expect to happen?
I don’t think the ( on async should error. When I change the "ecmaVersion": "8"
, I get
Parsing error: The keyword 'class' is reserved
on the first line which also shouldn’t be the case.
What actually happened? Please include the actual, raw output from ESLint.
"ecmaVersion": "2017"
33:1 error Parsing error: Unexpected token (
"ecmaVersion": "8"
11:1 error Parsing error: The keyword 'class' is reserved
I checked on gitter channel members on this, seems like saying "ecmaVersion": "8"
should work here, haven’t looked a lot on this, is there something in local setup or what else am I missing here?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
@Aladdin-ADD async/await was added in ES2017.
Did this solve your issue after all?
Agreed that we should catch this.