-
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 part 2 #3133
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.
Thx for looking into that - looks good to me for most changes, but a few remarks below.
src/browser/Terminal.test.ts
Outdated
@@ -717,7 +717,7 @@ describe('Terminal', () => { | |||
|
|||
describe('unicode - surrogates', () => { | |||
it('2 characters per cell', function (): void { | |||
this.timeout(10000); // This is needed because istanbul patches code and slows it down | |||
this.timeout(10_000); // This is needed because istanbul patches code and slows it down |
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.
I think this notation is still way too new and we should not yet rely on it. Same goes for the other occurrences.
src/common/Platform.ts
Outdated
@@ -17,7 +17,7 @@ const isNode = (typeof navigator === 'undefined') ? true : false; | |||
const userAgent = (isNode) ? 'node' : navigator.userAgent; | |||
const platform = (isNode) ? 'node' : navigator.platform; | |||
|
|||
export const isFirefox = !!~userAgent.indexOf('Firefox'); | |||
export const isFirefox = !!userAgent.includes('Firefox'); |
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.
Since .includes
already returns a boolean, the !!
type conversion gets redundant.
src/common/tsconfig.json
Outdated
@@ -2,7 +2,7 @@ | |||
"extends": "../tsconfig-library-base", | |||
"compilerOptions": { | |||
"lib": [ | |||
"es2015" | |||
"es2017" |
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.
Whats the reason for ES2017? I have no strong obligations against ES2017, but would not like to change that for a non-obvious reason. Being more vanilla/old-school is not a bad thing in terms of supported targets while maintaining the same functionality.
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.
The thing is es2017
needs to be set to have ability to build files that contains includes
with typescript
.
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 👍 Ah ok, well I'm fine to move on to ES2017 then, but would like to hear @Tyriar and @mofux 's opinion in this regard first.
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.
My only thought is if we commit to this, that we also update all the other tsconfig.json files so they're not inconsistent. Since we only target evergreen browsers, I think this is safe to do?
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.
@Tyriar I think it will change certain output shims. Imho our codebase is not really affected by that (Was it around generators? Or promises with async/await? Cant remember...)
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.
Well that's for the target, the lib is just which typings to include. I see there is a lib "ES2016.Array.Include"
, that sounds like exactly what we want without needing to think about changing es2015.
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.
@Tyriar, I updated browser/tsconfig.json
. Should I updatetsconfig.json
in addons directories? They don't have lib option right now.
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 no need if they don't use lib, does ES2016.Array.Include
work instead of es2017
?
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.
@Tyriar yes, it works, just pushed
src/common/tsconfig.json
Outdated
@@ -2,7 +2,7 @@ | |||
"extends": "../tsconfig-library-base", | |||
"compilerOptions": { | |||
"lib": [ | |||
"es2015" | |||
"es2017" |
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.
My only thought is if we commit to this, that we also update all the other tsconfig.json files so they're not inconsistent. Since we only target evergreen browsers, I think this is safe to do?
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.
Thanks for the clean up 🙂
Latest PR (#2953) was successfully merged, so I decide to do more checks with updated version of putout and discuss improving codebase with rules approved earlier and I can disable any of rules that not fits to current code style :).
So here is config: