TristonJ / eslint-plugin-prefer-arrow

ESLint plugin to prefer arrow functions
MIT License
55 stars 10 forks source link

prefer-arrow-functions rule autofix breaks for loop condition in function body #7

Closed romick101 closed 5 years ago

romick101 commented 6 years ago

Try adding the following to the invalid section of unit tests: ['function withLoop() { return () => { for (i = 0; i < 5; i++) {}}}', 'const withLoop = () => () => { for (i = 0; i < 5; i++) {}};'] The test will fail because produced code will look like this: const withLoop = () => () => { for (i = 0; i < 5i++) {}}; The second semicolon is removed which leads to syntax error in the code.

TristonJ commented 5 years ago

This should be fixed in https://github.com/TristonJ/eslint-plugin-prefer-arrow/commit/f15d389074cd2efa00824d83391d46b720451840