I want to use SonarLint in Visual Studio to parse Javascript code. I am getting below error in Visual Studio output window when selected SonarLint dopdown.

Failed to parse file 'D:\Latest Virtuoso Repo\Accessibility Change\Virtuoso\Source\Virtuoso\Web\Scripts\React_Scripts\Modules\ApprovalDelegation\ApprovalsDelegation\ApprovalsDelegation.jsx' at line 37: PARSING unknown: Support for the experimental syntax 'classProperties' isn't currently enabled (37:21):

  35 |     }
  36 |
> 37 |     activeApprovals = () => {
     |                     ^
  38 |         this.setState({
  39 |             activeTab: 'Approvals'
  40 |         })

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

Even though I have "@babel/plugin-proposal-class-properties" dependency and included in .babelrc, still getting error.

I have tried below options,

  1. Renaming .babelrc to babel.config.js
  2. Defining babel plugins in webpack.config.base.js
  3. Adding babel config in package.json
  4. Adding "@babel/plugin-syntax-class-properties" to babel plugins

Nothing seems to work. Please let me know if you know the solution.

0

There are 0 answers