gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Syntax Highlighting for ES6 with JSX #838

Open loliver opened 7 years ago

loliver commented 7 years ago

Syntax highlighting in ES6 files with JSX appears to break when using arrow functions that use the implicit return pattern by not providing curly braces ({ & }) for the function.

For example:

export const ShowHideButton = (props) => (
  props.value && props.value.length > 0
  ? (
    <StyledButton onClick={() => props.toggleShowHide(props.type)}>
      {props.type === 'password' ? 'Show' : 'Hide'}
    </StyledButton>
  )
  : null
)

export const PasswordField = (props) => (
  <TextField type={props.type} {...props} afterField={<ShowHideButton {...props} />} />
)

Everything from </StyledButton> inclusive is green up to the final ) character where correct highlighting begins again.