microsoft / vscode-jshint

VSCode extension to integrate jshint into VSCode
https://marketplace.visualstudio.com/items?itemName=dbaeumer.jshint
MIT License
72 stars 48 forks source link

Closing HTML tag shows "unclosed regular expression" error #29

Open vsccarl opened 8 years ago

vsccarl commented 8 years ago

Code Version: 1.1.0-alpha Windows 10

When returning HTML code inside a class (using React Native) shows a jshint error that should be valid.

jshinterrorhtml

quicklikerabbit commented 7 years ago

Code Version 1.9.0 MacOS 10.12.3

Having the same error with my jsx files. screen shot 2017-02-07 at 9 19 17 pm

rhernandog commented 7 years ago

Same here.

Also I reported it on the JSHint repo as well if anyone has anything to add or wants to track it:

https://github.com/jshint/jshint/issues/3097

Windows 7 64b Code 1.9.0 Plugin version 0.10.15

JSX Issue

rhernandog commented 7 years ago

Hi, another thing that I forgot to add is that when I wrap the tag with the issue, the error is thrown on a different place in the code.


Here the error is happens on the closing h3 tag: JSHint error 2


Here the same code is wrapped around a div tag and the error goes to the first level div tag JSHint error 3

RMacfarlane commented 6 years ago

The extension is running jshint on the entire jsx file, but jshint doesn't support jsx syntax. I think the correct fix would be for the extension to parse and identify the jsx portions of the file and not lint those, but this is a difficult fix that will take a while. Would it be useful to have an option to not run jshint on jsx files?

One workaround for now would be to manually turn off jshint around the functions returning HTML using /* jshint ignore:start */ and /* jshint ignore:end */

ghost commented 5 years ago

Any elegant solution? I met this problem on my vscode as well.

mobimation commented 5 years ago

I adopted the RMacfarlane way; rather than do a vscode global disabling of jshint (Code->Preferences->Settings->User extensions->JSHint configuration->JSHint:Enable tick box off) i surround a return statement that use JSX syntax with the /* jshint ignore:start */ and /* jshint ignore:end */ statements. Cleanest might be a jsxhint evolution; some kind of jshint superset that understands JSX as well.

Supakoa commented 4 years ago

you can disable(workspace). I can do this It's work.

Screen Shot 2563-04-14 at 01 44 35
axelmm commented 4 years ago

Still not configurable? 4 years!?

Hundreds of "Unclosed regular expression. (E015)" ... I have literally no regexps in the whole project! "Unrecoverable syntax error. (88% scanned). (E041)"

I'd like to just ignore/disable these/some errors.

Why only Warnings can be optionally ('.jshintrc') ignored? By design? Just enable configurable ignoring for Errors?

There is 'Report Warnings As Errors', maybe Report All Errors as Warnings? (with renaming/renumbering if required, f.e. E015>W1015) ... and making possible to ignore with '.jshintrc' ?

hardyfan commented 4 years ago

在vscode里直接禁用jshint就可以了。如果我们是在编写react的代码,就会经常出现/这种关闭标签的语法,就会提出这个错误。所以既然不想看到这个错误就直接禁用了jshint吧。

askusWT commented 3 years ago

bump, I hear react is popular.

d3mage commented 3 years ago

bump, I didn't know about programming when this issue was opened

tim-stack commented 3 years ago

2021, the problem's still not resolved

schiavoni commented 2 years ago

It's 2022! Happy birthday little bug :D

philn5d-ar commented 2 years ago

c'est terrible! Just add a suppress array to config plz!!!

Nurmukhammad1 commented 2 years ago

It's a summer 2022! When are you going to solve this problem?

victory-ft commented 2 years ago

This problem will most likely never be solved. Best thing you can do is just uninstall jshint and use eslint instead, it's the better linter as long as you're working in react.