You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, the CLI buffers all the input and waits for the end of input before proceeding with work (parsing the TSC errors).
This could be improved to let go of buffering and parse input line by line, as it comes.
Memory usage 📝
The memory usage would probably stay the same, as the CLI captures rawErrorLines for each error, to be able to later display them.
If the raw error lines were only saved for the valid TSC errors (as only those are displayed by the CLI), the memory usage would probably go down. If needed, that will be handled in another issue.
Speed 🐎
The CLI would probably be a bit more performant because parsing of lines would happen as they arrive, compared to waiting for the input to end and then parsing.
Challenges
Parsing the errors line-by-line 👀
Change the parser (parseTscErrors) to be stateful. I imagine the line processing code would look similar to:
consttscErrorParser=createTscErrorParser();// (could be a class)rl.on('line',line=>tscErrorParser.parseLine(line));rl.on('end',()=>{consttscErrors=tscErrorParser.getErrors();// run the rest of the program with tscErrors});
Processing errors one-by-one 🎰
The idea can be enhanced further. The previous approach parses errors line-by-line but processes them all at once.
We could process those errors one-by-one. The pseudocode would look like so:
consttscErrorParser=createTscErrorParser();rl.on('line',line=>tscErrorParser.parseLine(line));constvalidTscErrors=[];constignoredTscErrors=[];consttscErrorsThatCouldBeIgnored=[];tscErrorParser.on('error',(tscError)=>{classifyTscError(tscError,validTscErrors,ignoredTscErrors,tscErrorsThatCouldBeIgnored);});rl.on('end',()=>{// continue with the rest of the program, using the arrays from above:// validTscErrors, ignoredTscErrors, tscErrorsThatCouldBeIgnored});
We could use some kind of EventEmitter or Observable in tscErrorParser when notifying about a new error being parsed.
The text was updated successfully, but these errors were encountered:
I think the usual workflow for contributing to open source is:
Fork the repo
Push the branch to your fork
Create a cross-repo pull request (you will see a button to do that when you go to your repo right after you push)
This is how you can contribute to a repository without having explicit permissions to modify the original repository. Let me know if that does not work for you
At the moment, the CLI buffers all the input and waits for the end of input before proceeding with work (parsing the TSC errors).
This could be improved to let go of buffering and parse input line by line, as it comes.
Memory usage 📝
The memory usage would probably stay the same, as the CLI captures
rawErrorLines
for each error, to be able to later display them.If the raw error lines were only saved for the valid TSC errors (as only those are displayed by the CLI), the memory usage would probably go down. If needed, that will be handled in another issue.
Speed 🐎
The CLI would probably be a bit more performant because parsing of lines would happen as they arrive, compared to waiting for the input to end and then parsing.
Challenges
Parsing the errors line-by-line 👀
Change the parser (
parseTscErrors
) to be stateful. I imagine the line processing code would look similar to:Processing errors one-by-one 🎰
The idea can be enhanced further. The previous approach parses errors line-by-line but processes them all at once.
We could process those errors one-by-one. The pseudocode would look like so:
We could use some kind of
EventEmitter
or Observable intscErrorParser
when notifying about a new error being parsed.The text was updated successfully, but these errors were encountered: