We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
$
While validating this plugin against a big codebase, I found an edge case where it auto-fixes incorrectly.
If the function has a dollar sign ($) on its body, it gets incorrectly transformed somehow.
export function foo() { const bar = '$'; return bar };
Gets transformed into an invalid syntax. Notice the lack of the dollar sign, the missing single quote, and the extra semicolon at the end:
export const foo = () => { const bar = '; return bar };;
If the dollar sign is in backticks:
export function foo() { const bar = `$`; return bar };
Then this happens:
export const foo = () => { const bar = `(PARAMS)RETURN_TYPE => ; return bar };;
(PARAMS)RETURN_TYPE => is leaking from the writeArrowFunction function somehow
(PARAMS)RETURN_TYPE =>
writeArrowFunction
eslint-plugin-prefer-arrow-functions/src/prefer-arrow-functions.ts
Lines 137 to 146 in 9b76409
If there are two dollar signs, then the transformation is different, but still incorrect:
export function foo() { const bar = `$$`; return bar };
And this happens:
export const foo = () => { const bar = `const foo = ; return bar };;
No idea why that happens, so I'd have to investigate. Probably need to escape $ when replacing or something?
I just need time to look into that.
The text was updated successfully, but these errors were encountered:
haha wow, this is an interesting one.
Sorry, something went wrong.
534527e
No branches or pull requests
Description
While validating this plugin against a big codebase, I found an edge case where it auto-fixes incorrectly.
If the function has a dollar sign (
$
) on its body, it gets incorrectly transformed somehow.Example 1
Gets transformed into an invalid syntax. Notice the lack of the dollar sign, the missing single quote, and the extra semicolon at the end:
Example 2
If the dollar sign is in backticks:
Then this happens:
(PARAMS)RETURN_TYPE =>
is leaking from thewriteArrowFunction
function somehoweslint-plugin-prefer-arrow-functions/src/prefer-arrow-functions.ts
Lines 137 to 146 in 9b76409
Example 3
If there are two dollar signs, then the transformation is different, but still incorrect:
And this happens:
Suggested Solution
No idea why that happens, so I'd have to investigate. Probably need to escape
$
when replacing or something?Help Needed
I just need time to look into that.
The text was updated successfully, but these errors were encountered: