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 positive on object methods with arrow functions inside #26

Open
ChALkeR opened this issue Jun 10, 2020 · 1 comment · May be fixed by #29
Open

False positive on object methods with arrow functions inside #26

ChALkeR opened this issue Jun 10, 2020 · 1 comment · May be fixed by #29
Labels

Comments

@ChALkeR
Copy link

ChALkeR commented Jun 10, 2020

const isArrow = require('is-arrow-function')
const x = {
  foo() {
    return 42
  },
  bar() {
    return (() => 10)()
  },
  buz() {
    // if this was an arrow function, it would have included => in it
    return 123
  },
}
console.log(x.foo(), x.bar(), x.buz())
console.log(isArrow(x.foo))
console.log(isArrow(x.bar)) // fail
console.log(isArrow(x.buz)) // fail
@ljharb ljharb added the bug label Jun 11, 2020
@ljharb
Copy link
Member

ljharb commented Jun 11, 2020

This feels similar to #15 - short of including an actual JS parser, I'm not sure how to reliably handle cases like these.

@lionel-rowe lionel-rowe linked a pull request May 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants