-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Using putout linter on xterm codebase #2953
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderaiser Did you actually look at the replacements? There are several issues with it, see my comments below.
@jerch thank you for review :), I did look at replacement but want to receive feedback before proceeding. I’ll fix all comments when get to a computer. |
@jerch just force pushed updates, we have only 4 rules not disabled, from found list :):
Also |
@coderaiser I think for time critical parts we should resort to good old index-for-loops. For non critical paths imho for-of is good to go with it. @Tyriar Do you see any issues with for-of, like ECMA version supported? Imho it got official with ES6, I am not sure if TS will transpile it for lower targets correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much agree with all your thoughts @jerch. Also I don't think we would want to include an additional linter, I'm trying to slim down out dev deps where possible.
The forEach change seemed negative to me at first, but having it not be inside a callback would help TS understand what's going on, specifically in this case which is just annoying to deal with:
I think for time critical parts we should resort to good old index-for-loops. For non critical paths imho for-of is good to go with it.
I have similar thoughts, I wouldn't even bother trying to convert for loops as we typically only use them not for perf critical parts and when we're working with the index.
Do you see any issues with for-of, like ECMA version supported? Imho it got official with ES6, I am not sure if TS will transpile it for lower targets correctly.
It transpiles down to this for es5 targets:
var a = [1, 2, 3];
for (var _i = 0, a_1 = a; _i < a_1.length; _i++) {
var b = a_1[_i];
console.log(b);
}
This ends up being ~40% slower in Chromium for me which isn't too bad.
remove-empty is the only other rule that I think we may want to run. If that only catches the while (reports.pop()) { }
, which would definitely be better written as reports = []
as suggested anyway.
Co-authored-by: Daniel Imms <[email protected]>
Absolutely agree with you :). The rule
Yep,
Yes, I'll add it, it is have sense :).
@Tyriar I don't suggest to add an additional linter :). I suggest to add results of it work :). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Just read about switching eslint rules to warnings, and want to suggest usage results of putout linter that fixes everything it can find.
Here is list of things in code of
xterm.js
that can be improved:Here is used config
.putout.json
:I'm willing to run
putout
again disabling rules you choose If it's appropriate , I think this can make codebase ofxterm.js
a little bit better :).About an error:
I have the same error on
master
. Have no idea what it is :).