refactor: modernization - #972
Open
davidlday wants to merge 10 commits into
Open
Conversation
…ucture - Updated ESLint configuration to include TypeScript support and improved ignore patterns. - Refactored Linter class to accept an OutputChannel for better logging and diagnostics management. - Added methods to clear pending timeouts and diagnostics during deactivation. - Updated package dependencies and adjusted TypeScript version in package.json and package-lock.json. - Enhanced webpack configuration for better development and production builds.
- Modified the "clean" script in package.json to also remove coverage and .nyc_output directories. - Added a new "test:coverage" script to run tests with coverage reporting using c8. - Introduced a new test file for Linter rule logic, implementing tests for spelling rules, warning categories, and ignored rules.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the extension’s runtime/tooling and hardens LanguageTool request handling, while adding targeted tests and improving lifecycle cleanup.
Changes:
- Refactors output/logging to avoid module-load side effects and improves deactivation cleanup (timeouts/diagnostics/service shutdown).
- Replaces
node-fetchusage with Node’s globalfetch+ timeout/abort handling, and adds match-range validation. - Updates build/test tooling (TS/ESLint/coverage) and adds new unit-style test suites.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
webpack.config.ts |
Adds explicit mode/devtool configuration for modernization. |
tsconfig.json |
Updates TS target/lib to ES2022 and switches module resolution to node. |
src/Linter.ts |
Migrates LanguageTool HTTP calls to global fetch with timeout/abort, adds cancellation + range validation, and exposes deactivation cleanup helpers. |
src/extension.ts |
Creates output channel during activation, wires it through managers, registers diagnostics for disposal, and adds deactivation cleanup. |
src/Constants.ts |
Removes global output channel side-effect and introduces SERVICE_REQUEST_TIMEOUT_MS. |
src/ConfigurationManager.ts |
Injects optional output channel, improves managed-service logging, and disables managed service in untrusted workspaces. |
src/FormattingProviderQuotes.ts |
Removes unreachable break in switch (minor cleanup). |
test/suite/onTypeFormattingDispatcher.test.ts |
Adds dispatcher routing tests. |
test/suite/linter.rules.test.ts |
Adds unit-style tests for rule/category/ignore helper logic. |
test/suite/linter.phase3.test.ts |
Adds hardening tests for cancellation and invalid match ranges. |
README.md |
Adds development/validation/CI documentation and test strategy notes. |
package.json |
Updates engines/deps/scripts and adds c8 coverage script. |
package-lock.json |
Locks dependency updates consistent with tooling changes. |
eslint.config.mjs |
Simplifies ESLint flat config and aligns rulesets for TS. |
.github/workflows/publish.yml |
Enables npm cache for faster CI. |
.github/workflows/build-ubuntu.yml |
Enables npm cache for faster CI. |
.github/workflows/build-macos.yml |
Enables npm cache for faster CI. |
.github/workflows/build-windows.yml |
Enables npm cache for faster CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.