felipeochoa / rjsx-mode

A JSX major mode for Emacs
https://github.com/felipeochoa/rjsx-mode
MIT License
641 stars 32 forks source link

Linter fails on coma-dangle #128

Closed YievCkim closed 3 years ago

YievCkim commented 3 years ago

Hi,

I am working on a project which follows airbnb coding style.

This coding style allow coma-dangle, and the project refuse to build if this rule is broken.

Conversally, in emacs in RJSX-mode, I get an error from the linter about this and this has an impact on syntax highlighting.

By instance:

This fails to build but raise no warning from rjsx linter:

const a =
      {
        x: (
          a,
          b,
          c
        ) => console.log(a, b, c),
        y: "test"
      }

console.log(a.x(1, 2, 3))
console.log(a.x(2, 1, 3))
console.log(a.y)

Instead this build without issue but raise en error in emacs:

const a =
      {
        x: (
          a,
          b,
          c,
        ) => console.log(a, b, c),
        y: "test"
      }

console.log(a.x(1, 2, 3))
console.log(a.x(2, 1, 3))
console.log(a.y)

In this last case the arrow appears red and display this error: "missing formal parameter".

I have tried to workaround with this in js2-mode settings but didn't find nothing.

How can I do to get a good syntax highlighting on this project from emacs ?

wyuenho commented 3 years ago

This is a long standing bug on js2-mode. If you have the time, you can dig into the parser to fix it.

As an aside, I'd thought tree-sitter will be able to highlight this, but apparently it does not.

YievCkim commented 3 years ago

Ok thank you. I will try to see that but I am not expert with Elisp. I have started to follow the issue on js2mode-repo too.

dgutov commented 3 years ago

This has been fixed in js2-mode.

YievCkim commented 3 years ago

that's a very good news. Thanks !