LAB-2974 - Update linting dependencies, migrate tests to Vitest, and add custom ESLint rule - #189
LAB-2974 - Update linting dependencies, migrate tests to Vitest, and add custom ESLint rule#189pr0uxx wants to merge 10 commits into
Conversation
Bump ESLint, typescript-eslint, eslint-plugin-jsdoc, and @types/node to newer patch/minor releases, along with the npm package manager version and the corresponding lockfile updates.
Adds Vitest as a dev dependency along with the V8 coverage provider so the repo can run tests and collect coverage.
Replaces Node’s built-in test runner scripts with Vitest for both unit and integration suites. Adds dedicated Vitest config files for each suite, including separate coverage output directories and include patterns, plus new unit watch and coverage scripts. Also updates the ESLint unit test to use Vitest’s `describe`/`it`/`expect` APIs.
Adds a custom ESLint rule that enforces V8 ignore directives on all assertGuardEquals calls. The rule verifies that each call has the exact preceding comment '/* v8 ignore next -- @preserve */' and provides automatic fixes to update legacy or missing directives. Includes comprehensive unit tests covering various edge cases.
Register the new `v8-ignore-assert-guard-equals` custom rule in the base ESLint config and enable it at warning level. This makes the rule available across the shared lint baseline.
Updates the package version from 3.0.1-beta to 3.0.2-alpha1 for the next prerelease.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repo’s linting and test tooling by introducing a custom ESLint rule to enforce a specific V8 ignore directive for assertGuardEquals, integrating it into the base ESLint config, and migrating unit/integration tests to Vitest alongside dependency updates.
Changes:
- Added and enabled a custom ESLint rule (
custom-rules/v8-ignore-assert-guard-equals) with autofix support plus a dedicated test suite. - Migrated tests from Node’s built-in runner to Vitest, adding Vitest config for unit/integration runs and coverage.
- Updated lint/tooling dependencies and bumped the package version.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.unit.config.ts | Adds Vitest unit test/coverage configuration. |
| vitest.integration.config.ts | Adds Vitest integration test/coverage configuration. |
| test/unit/linter/customRules/v8IgnoreAssertGuardEquals.test.ts | Adds Vitest + RuleTester coverage for the new custom ESLint rule. |
| test/unit/eslint.test.ts | Migrates existing lint-config import test to Vitest. |
| package.json | Updates scripts to use Vitest; bumps versions and adds Vitest deps. |
| package-lock.json | Locks updated dependency graph including Vitest additions. |
| config/linter/customRules/v8IgnoreAssertGuardEquals.ts | Introduces the new custom ESLint rule enforcing the V8 ignore directive. |
| config/linter/base.ts | Registers and enables the new custom rule via a custom-rules plugin. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Register the custom ESLint plugin before other plugins and keep its rule in the main rules section for consistent loading. Also add `coverage/` to the ignored paths so generated reports are excluded from linting.
The `describe` callback in `test/unit/eslint.test.ts` no longer uses `async`, since there are no awaited operations in the suite setup. This keeps the test definition synchronous and avoids unnecessary async wrapping.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: pr0uxx <michow289@hotmail.com>
Import `SourceCode` as a type in the custom ESLint rule to match the existing type-only usage.
LAB-2974
This pull request introduces a new custom ESLint rule to enforce that all
assertGuardEqualscalls are preceded by a specific V8 ignore comment, integrates this rule into the linting configuration, migrates the test runner from Node's built-in test module to Vitest, and updates several dependencies. The changes improve code quality enforcement, modernize the testing workflow, and ensure better maintainability.Custom ESLint Rule and Linting Enhancements:
v8-ignore-assert-guard-equals) that requires allassertGuardEqualscalls to be preceded by the comment/* v8 ignore next -- @preserve */. The rule auto-fixes legacy or missing comments and is documented and tested. (config/linter/customRules/v8IgnoreAssertGuardEquals.ts)custom-rulesplugin, and enabled it as a warning. (config/linter/base.ts) [1] [2] [3]Testing and Tooling Modernization:
package.json)package.json)vitest.unit.config.ts,vitest.integration.config.ts) [1] [2]test/unit/eslint.test.ts)RuleTester. (test/unit/linter/customRules/v8IgnoreAssertGuardEquals.test.ts)Dependency and Version Updates:
package.json)package.json) [1] [2]