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

False error reporting for arrow functions #738

Open
tcm151 opened this issue Jul 17, 2024 · 7 comments
Open

False error reporting for arrow functions #738

tcm151 opened this issue Jul 17, 2024 · 7 comments

Comments

@tcm151
Copy link

tcm151 commented Jul 17, 2024

Arrow functions have been included in ACF since 2018, however CFLint false shows a missing semi colon error when they are used.

Example:
shows error when using arrow function
image
doesn't show error when using the full chunky function syntax
image

@ghedwards
Copy link

@tcm151 cfparser added some support for lambda functions a little while ago I wonder whats tripping it up here? cfparser/cfparser@b6475f7 try using parens around your arguments ?

@ghedwards
Copy link

Also

temp = metadata.filter(m => m.DATA_TYPE != "P" && m.DATA_VALUE != "");

appears to work fine for me ? what version of cflint are you using ? try using this one and let me know if it fixes your issue

https://github.com/cfmleditor/CFLint/releases/tag/1.5.5-SNAPSHOT

@tcm151
Copy link
Author

tcm151 commented Jul 17, 2024

Didn't know there was a snapshot, thanks for that! I've been using 1.5

@ghedwards
Copy link

@tcm151 no guarantees, just wanted to rule out an old version of the parser. The parser can get a bit crossed up with syntax depending on lots of other factors. Often as soon as you isolate the syntax it does fine, but embedded in a file with all kinds of other code can sometimes cause a problem. So if you're able to isolate it and reproduce the problem, that would help with some diagnosis ( but sometimes not an easy fix )

@tcm151
Copy link
Author

tcm151 commented Jul 17, 2024

It's coming from a pretty small file, only 25-30 lines so I don't think there is too much affecting it that way. I'll give the snapshot a try and see if that resolves the issue

@tcm151
Copy link
Author

tcm151 commented Jul 18, 2024

@ghedwards still no luck with the snapshot version, I've tried as many combinations of arrow functions syntax as I can think of

image
image
image
image
image

This is still the only one that works without an error
image

@tcm151
Copy link
Author

tcm151 commented Jul 18, 2024

I'm just going to exclude that rule for the meantime since it's not a major blocker for what I need it for

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

2 participants