jquery / jquery/esprima

JSX Identify the problem

Open
#2,107 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

React class component arrow function cannot be recognized.

Example Content:

import React from 'react'

class test extends React.Component{
constructor(props) {
super(props);
this.state = {
}
}

initData = (item) =>{
}

render() {
return (


)
}
}

export default connect(mapStateToProps)(LinkageSwitchItem)

Steps to reproduce
esprima.parse('some code')
Expected output
Actual output
Relevant references

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reducing the supplied class-component example to an esprima.parse call and determine the parser error or incorrect result. The issue provides no expected or actual AST, named source file, or test, so completion would first require defining the expected JSX and class-property parse behavior, then adding a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.