-
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
Halloween Lint using Putout (part 5) #3538
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.
Looks like this caused tsc strict errors:
src/common/InputHandler.ts(64,18): error TS7006: Parameter 'a' implicitly has an 'any' type.
src/common/InputHandler.ts(561,45): error TS2339: Property 'substring' does not exist on type 'string | Uint8Array'.
Property 'substring' does not exist on type 'Uint8Array'.
src/common/InputHandler.ts(562,43): error TS2339: Property 'subarray' does not exist on type 'string | Uint8Array'.
Property 'subarray' does not exist on type 'string'.
src/common/input/WriteBuffer.test.ts(12,18): error TS7006: Parameter 'a' implicitly has an 'any' type.
src/common/input/WriteBuffer.test.ts(49,75): error TS2345: Argument of type 'string | Uint8Array' is not assignable to parameter of type 'Uint8Array'.
Type 'string' is not assignable to type 'Uint8Array'.
src/common/parser/EscapeSequenceParser.test.ts(17,18): error TS7006: Parameter 'a' implicitly has an 'any' type.
src/common/parser/EscapeSequenceParser.test.ts(1737,7): error TS2322: Type 'unknown' is not assignable to type 'string | undefined'.
Type 'unknown' is not assignable to type 'string'.
addons/xterm-addon-attach/src/AttachAddon.ts(10,18): error TS7006: Parameter 'a' implicitly has an 'any' type.
addons/xterm-addon-attach/src/AttachAddon.ts(32,24): error TS2345: Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'string | Uint8Array'.
Type 'ArrayBuffer' is not assignable to type 'string | Uint8Array'.
Type 'ArrayBuffer' is missing the following properties from type 'Uint8Array': BYTES_PER_ELEMENT, buffer, byteOffset, copyWithin, and 22 more.
addons/xterm-addon-attach/src/AttachAddon.ts(32,63): error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'ArrayBuffer'.
Type 'string' is not assignable to type 'ArrayBuffer'.
error TS2688: Cannot find type definition file for '../../../out-test/api/TestUtils'.
The file is in the program because:
Entry point of type library '../../../out-test/api/TestUtils' specified in compilerOptions
error TS2688: Cannot find type definition file for '../../../out-test/api/TestUtils'.
The file is in the program because:
Entry point of type library '../../../out-test/api/TestUtils' specified in compilerOptions
error TS2688: Cannot find type definition file for '../../../out-test/api/TestUtils'.
The file is in the program because:
Entry point of type library '../../../out-test/api/TestUtils' specified in compilerOptions
error TS2688: Cannot find type definition file for '../../../out-test/api/TestUtils'.
The file is in the program because:
Entry point of type library '../../../out-test/api/TestUtils' specified in compilerOptions
d5bbb2a
to
8d87eae
Compare
8d87eae
to
c4e66ac
Compare
On a sidenote: most promises removed from tests, are actually needed to force the return of a promise testing promise handling in the parser. So they should not be removed there. |
c4e66ac
to
0753d24
Compare
@jerch just got back promises |
0753d24
to
c41f4e9
Compare
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.
Lots of good changes here, I especially like the optional chaining.
new ThroughputRuntimeCase('', () => (({ | ||
payloadSize: serializeAddon.serialize().length | ||
})), { fork: false }).showAverageThroughput(); |
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.
This was more readable before imo, also it doubled up the params for some reasons.
@@ -41,7 +41,7 @@ export default async function load(fontFamily: string, cacheSize: number): Promi | |||
name: 'local-fonts' | |||
}); | |||
if (status && status.state !== 'granted') { | |||
throw new Error('Permission to access local fonts not granted.'); | |||
throw Error('Permission to access local fonts not granted.'); |
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 kind of prefer new Error
and new Array
, let's remove that rule as well so this PR becomes a lot smaller. This is something a compiler should remove if they are equivalent imo.
src/common/CircularList.ts
Outdated
@@ -52,7 +52,7 @@ export class CircularList<T> implements ICircularList<T> { | |||
|
|||
// Reconstruct array, starting at index 0. Only transfer values from the | |||
// indexes 0 to length. | |||
const newArray = new Array<T | undefined>(newMaxLength); | |||
const newArray = Array(newMaxLength); |
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.
Not sure this was a safe thing to do removing the type here?
ff7a354
to
82f8e06
Compare
Disabled: |
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, always appreciated 🙂
After successfully merged linting sessions part 1, part 2 and part 3, part 4 the time is come for part 5 :).
As usual, any rule can be disabled.
Command used:
putout . --fix
Applied rules:
Current config for putout v21:
Happy Halloween 🎃!