New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser version of 5.15.x does not work in IE 11 #11504
Browser version of 5.15.x does not work in IE 11 #11504
Comments
Thanks for the report, I can reproduce this issue. It seems like |
Thanks so much for the fix! It still doesn't quite work though. As I stated above, as soon as you load the ES5 compatible <script src="eslint.js"></script>
<script>
var linter = new eslint();
console.log(linter.verify("var foo = 1", {
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"semi": "warn"
}
}));
</script> P.S. Pardon the german error messages 😅 |
Can you paste the whole line? Thanks. |
Sure, sorry about that! Edit: Format the bad line to look like in Browserify var $flags = __webpack_require__(199);
var $RegExp = global.RegExp;
var Base = $RegExp;
var proto = $RegExp.prototype;
var re1 = /a/g;
var re2 = /a/g; // "new" creates a new object, old webkit buggy here
var CORRECT_NEW = new $RegExp(re1) !== re1;
if (__webpack_require__(7) && (!CORRECT_NEW || __webpack_require__(8)(function () {
re2[__webpack_require__(28)('match')] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match
return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))) {
$RegExp = function RegExp(p, f) {
var tiRE = this instanceof $RegExp;
var piRE = isRegExp(p);
var fiU = f === undefined;
return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
: inheritIfRequired(CORRECT_NEW
? new Base(piRE && !fiU ? p.source : p, f)
: Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
, tiRE ? this : proto, $RegExp);
}; |
Did you build ESLint by yourself? |
Yes, I pulled the current master branch and build ESLint by running npm run webpack |
Well, this is a bug from Look at Line 4795 in the picture you gave. There is a comment which is It seems that we're using |
Hm, according to the changelog this was introduced 4 years ago
Why did it work with Browserify in version Edit var $flags = _dereq_(44);
var $RegExp = global.RegExp;
var Base = $RegExp;
var proto = $RegExp.prototype;
var re1 = /a/g;
var re2 = /a/g;
// "new" creates a new object, old webkit buggy here
var CORRECT_NEW = new $RegExp(re1) !== re1;
if (_dereq_(36) && (!CORRECT_NEW || _dereq_(42)(function () {
re2[_dereq_(128)('match')] = false;
// RegExp constructor can alter flags and IsRegExp works correct with @@match
return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))) {
$RegExp = function RegExp(p, f) {
var tiRE = this instanceof $RegExp;
var piRE = isRegExp(p);
var fiU = f === undefined;
return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
: inheritIfRequired(CORRECT_NEW
? new Base(piRE && !fiU ? p.source : p, f)
: Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
, tiRE ? this : proto, $RegExp);
}; Apart from the dependecy mangement, it does look the same to me... |
It's not a bug from |
recently we are using |
@aladdin-add You are right! It is the This whole "syntax error" thing threw me off; for some reason I assumed this whole time that the error occurs during the parsing phase of the file 😩🤦♂️ |
I was under the impression that babel can polyfill the behavior of unicode regexes. Is that not the case? |
Hm, it can in principle (Babel Regex). But I think there would be limitations for usages like return new RegExp(LINEBREAK_MATCHER.source, "gu");
// or
new RegExp(somePatternVariable, someFlagVariable) because it can't really manipulate the content of those variables, right? |
I thought it would polyfill the |
It's too costly for runtime. |
Babel apparently uses the regexpu package to do the transform which has this exact limitation. I couldn't find any polyfill of the |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Tell us about your environment
What did you do?
Built ESLint using
and ran it in IE 11 (more precisely, in a web worker and in conjunction with the Monaco editor but that should not matter). The source code couldn't be parsed because it contains a lot of ES2015+ syntax like
const
andlet
since the recent change to Webpack. The Browserify version in5.14.x
works in IE 11.You can get a step further by changing the Webpack config to also transpile files from
node_modules
(including.mjs
files apparently) like shown below. This makes sure to transpile to ES5 but I got stuck at this stage because IE still throws the errorIncorrect syntax in regular expression
. Since I saw nothing obvious in the source code I gave up at this point.So the question boils down to: What browsers do you intend to support with the browser variant of ESLint?
Are you willing to submit a pull request to fix this bug?
Not at the moment, sorry.
The text was updated successfully, but these errors were encountered: