Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-mocha-arrows fix produces invalid code with comments #303

Open
gabssnake opened this issue Nov 12, 2021 · 0 comments
Open

no-mocha-arrows fix produces invalid code with comments #303

gabssnake opened this issue Nov 12, 2021 · 0 comments

Comments

@gabssnake
Copy link

gabssnake commented Nov 12, 2021

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant