eslint-plugin-mocha
eslint-plugin-mocha copied to clipboard
`no-mocha-arrows` fix produces invalid code with comments
Hi, thanks for your work, love this eslint-plugin :)
I encountered an issue where some code, admittedly very bad, produces invalid output after fixing no-mocha-arrows
.
it("writes code in strange ways", () =>
// This is a disaster waiting to happen
assert(true)
);
When running eslint --fix
it produces output:
it("writes code in strange ways", function ()// This is a disaster waiting to happen { return assert(true)
});
Here's a failing test case (not sure of the expected code) :
+++ b/test/rules/no-mocha-arrows.js
@@ -31,6 +31,11 @@ ruleTester.run('no-mocha-arrows', rules['no-mocha-arrows'], {
+ {
+ code: 'it(() => \n//hello\nassert(hello, false))',
+ errors,
+ output: 'it(function() {\n//hello\nreturn assert(hello, false); })'
+ },
Do you have any pointers for a fix? I'll be happy to contribute!
Kind regards,