Skip to content

Cannot detect jsx syntax with .js extension

Summary

.jsx is not a recommend extension for ReactJS (See facebook/create-react-app#87).

However, GitLab does not see to able to differentiate JSX with .js. This makes its highlight the code with wrong syntax.

From #15135 (closed), I know that GitLab use Rouge to highlight. I don't know this problem belongs to Rouge or it needs to fix by GitLab detection.

Steps to reproduce

  1. Use create-react-app to create a sample project.
  2. Push the project to GitLab.

Example Project

Here is one of the example JSX file with .js.

https://gitlab.com/joshuaavalon/DockerRegistryUI/blob/master/web/src/App.js

What is the current bug behavior?

Apply JavaScript syntax highlight instead of JSX. For exmaple, > is highlight as error.

What is the expected correct behavior?

Detect the correct JavaScript type and apply the correct syntax highlight.