React JSX error : Unclosed regular expression

前端 未结 5 1822
别跟我提以往
别跟我提以往 2021-02-04 06:08

Recently I was facing an issue coding React app on Visual Studio code. Because of this issue, whenever I wrote JSX inside the render function of the React Component and saved it

相关标签:
5条回答
  • 2021-02-04 06:56

    I solved this issue by disabling show syntax errors checkbox in visual studio 2015.

    Tools -> options - > text editor -> javascript -> intelliSense -> general -> show syntax errors(disable)

    0 讨论(0)
  • 2021-02-04 07:02

    If you are using jshint plugin, remove it and install ESLint plugin.

    It is a good replacement for jshint in reactJS work.

    0 讨论(0)
  • 2021-02-04 07:04

    I tried several options like creating a .eslintrc file or .jshintrc file.

    But it turned out that in my Visual Studio Code IDE, there was third party extensions(eslint/jslint/tslint/beautify/jsformatter etc) that were causing a big mess in my JSX code.

    I had to go to the extensions and disable all the extension which could hinder in the natural process of linting and code cleaning of React framework.

    (These extensions are really great. But disabling them helped me in solving this issue of mine, no offense to anyone.)

    If you are facing the same issue and the issue persists event after adding a .jshintrc with content:

    {
        "esversion": 6
    }
    

    then consider disabling the third party extensions.

    Hope my answer helped.

    0 讨论(0)
  • 2021-02-04 07:08

    I had the same problem, but it was "beautify" extension which was causing the error, I uninstalled it and installed prettier. It fixed the problem.

    0 讨论(0)
  • 2021-02-04 07:09

    the extension that did it for me was...

    jshint

    dbaeumer.jshint
    Dirk Baeumer

    as @abhay-shiro says, disabling a few extensions will usually resolve the issue.

    0 讨论(0)
提交回复
热议问题