Tslint: Invalid violation with the arrow-parens rule when using async on a function

Created on 7 Aug 2016  ·  11Comments  ·  Source: palantir/tslint

Bug Report

  • TSLint version: 3.14.0
  • TypeScript version: 1.8.10
  • Running TSLint via: VS Code

    TypeScript code being linted

export const configure = async (aurelia: Aurelia) => {
    // ...
};

with tslint.json configuration:

"arrow-parens": true

Actual behavior

Parentheses are required around the parameters of an arrow function definition

Expected behavior

No error/warning.

Related to #1442.

Fixed Bug

Most helpful comment

I don't expect this edge case...
I'll try to fix it. Please wait for my PR.

All 11 comments

cc @YuichiNukiyama. Good catch @glen-84, didn't think of this edge case!

I don't expect this edge case...
I'll try to fix it. Please wait for my PR.

I see this issue still present in v3.15.1 cc: @JKillian

"arrow-parens": true,

return Bluebird.mapSeries(keys, async (key) => { ... });

@internetcowboy I tested your sample code on my machine and can't reproduce what you're seeing. Can you double-check and make sure you're using 3.15.1 and the latest TypeScript?

@JKillian strange. It's not the end of the world on my end but figured I would voice it. I still see the issue though after an uninstall/reinstall of tslint and typescript locally and globally. It could just be an issue with this box though.


xxx:server xxx$ npm list tslint
[email protected] /Users/xxx/Documents/development/xxx/server
└── [email protected]

xxx:server xxx$ npm list tslint -g
/usr/local/lib
└── [email protected]

xxx:server xxx$ npm list typescript -g
/usr/local/lib
└── [email protected]

xxx:server xxx$ npm list typescript
[email protected] /Users/xxx/Documents/development/xxx/server
├── [email protected]

@internetcowboy double-checked on my end too, and still couldn't reproduce it. If you want, maybe post the whole function and the exact error message with line and column number?

Looks like the versions you have of both packages is correct.

I'm getting this issue as well.

image

@jeffijoe which versions of typescript and tslint are you using?

@adidahiya

"typescript": "^2.2.0-dev.20161130"
"tslint": "^4.0.2"

this issue breaks the build of the greenkeeper pull request to upgrade typescript from 2.0.10 to 2.1.4
https://travis-ci.org/gms1/node-sqlite3-orm/builds/182024200

tslint version is 4.0.2

I think @IllusionMH gets it right here -- https://github.com/palantir/tslint/issues/1572#issuecomment-249455843 -- this unfortunately a breaking change in the TS language services and we'll have to change the code to handle both cases.

Was this page helpful?
0 / 5 - 0 ratings