microsoft / microsoft/vscode-cpptools
TS Modernization - Code Cleanup
Open
Nobody has claimed this yet.
Language Service
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
More code cleanup tasks
In the effort to reduce some complexity and technical debt in the extension codebase - the following are the outstanding things to address after the TS Modernization PR is completed: #11085
- clean up
clients.ActiveClientvsgetActiveClient()-- pick one and stick with it. - clean up
uivsgetUI()- consistency - same thing - elminiate use of
null - clean up use of os.platform() everywhere with the use of a constants
- unify use of guards and replace util.is* with guards
- replace filesystem wrappers (those that provide promise-based fs functions) with use of built-in node:fs.promises.XXX functions
- examine all use of new Promise(...) to ensure that there isn't a cleaner use available.
- enable
plugin:@typescript-eslint/strictin eslint and fix all errors (about ~450), including:A record is preferred over an index signatureDo not delete dynamically computed property keysExpected a 'for-of' loop instead of a 'for' loop with this simple iterationExpected an error object to be thrownExplicit enum value must only be a literal value (string, number, boolean, etc)Literals should be exposed using readonly fieldsPrefer using an optional chain expression instead, as it is more concise and easier to readPrefer using nullish coalescing operator ('??') instead of a logical or ('||'), as it is a safer operatorThe generic type arguments should be specified as part of the constructor type argumentsThe two values in this comparison do not have a shared enum typeUnexpected class with only static propertiesUnnecessary conditional, both sides of the expression are literal valuesUnnecessary conditional, expected left-hand side of '??' operator to be possibly null or undefinedUnnecessary conditional, the types have no overlapUnnecessary conditional, value is always falsyUnnecessary conditional, value is always truthyUnnecessary optional chain on a non-nullish valueUse 'as XXX' instead of '<XXX>'Use 'includes()' method insteadUse 'String#startsWith' method insteadUse an 'interface' instead of a 'type'Use the 'String#endsWith' method insteadUseless constructorvoid is not valid as a constituent in a union typevoid is only valid as a return type or generic type argument
Refactoring:
- investigate and fix initialization and remove
BlockingTaskconcept and move to a resettableSignal-- should make blocking at the high-order tasks much cleaner - refactor protocolFilter to ensure order of processed messages is maintained.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the completed TS Modernization PR #11085 and the outstanding cleanup areas listed here. Done requires resolving the identified TypeScript and ESLint issues, simplifying the initialization and protocolFilter designs, and addressing each consistency and promise/filesystem cleanup item.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, node.js, typescript
- Domain
- developer-experience, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100