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

Arrow function with expression body results function size error #364

Open
zymbth opened this issue Sep 30, 2024 · 2 comments
Open

Arrow function with expression body results function size error #364

zymbth opened this issue Sep 30, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@zymbth
Copy link

zymbth commented Sep 30, 2024

Describe the bug
Arrow function with expression body results the error calculation of function rows.

To Reproduce
Steps to reproduce the behavior:

  1. What is the exact code you are analyzing?
const sum = (a, b) => a + b

const someVal = 100

function func() {
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
  // ...
}
  1. What is the output you are getting?
-  rrd ~ function size
   src\views\Test\test.js
   👉 Functions must be shorter than 20 lines. See: https://vue-mess-detector.webmania.cc/rules/rrd/function-size.html
   function (sum#1) is too long: 24 lines 🚨

Expected behavior
Arrow function with expression body should be calculated correctly.

Screenshots
image

Used version number of vue-mess-detector: 0.57.0

Used version number of node & yarn: [email protected], [email protected]

@zymbth zymbth added the bug Something isn't working label Sep 30, 2024
@David-Pena
Copy link
Collaborator

Added failing test for reference

@David-Pena
Copy link
Collaborator

I'm working on a refactor of the functionSize rule using babel parser to handle better and avoid this common false positives or edge-cases. I just removed the .todo from the test added in this issue and it works 🫡

Soon you will be able to try it out and that code health will be 100% 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants