Skip to content
Advertisement

How to get acornjs to properly style check private class fields and methods?

I’m working on a project where I need to use a style check for my code. I want to use acorn js, however it fails when trying to parse private class fields and class methods.

I’ve tried:

JavaScript

However it fails when running. This is the error message:

JavaScript

I need to be able to use private class fields and methods, but I don’t know how to get acorn to parse it properly.

Advertisement

Answer

The issue is with #a = 2 and not with #b() {}. This is because there are two separate modules for:

So, add acton-class-fields:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement