Skip to content

Conversation

@katinthehatsite
Copy link
Contributor

Related issues

Fixes STU-1268

Proposed Changes

This PR migrates packages/eslint-plugin-studio/ to vitest.

Testing Instructions

  • Confirm that the tests pass
  • Confirm that eslint works correctly

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the eslint-plugin-studio package to use Vitest and modern ESM-style exports, aligning it with the rest of the repo’s tooling and ESLint 9.

Changes:

  • Update Vitest configuration to include tests under packages/**, including JS tests.
  • Convert eslint-plugin-studio source files from CommonJS (module.exports) to ESM (export default) and mark the package as "type": "module".
  • Replace the Jest-based rule test for require-lock-before-save with a Vitest-based setup using RuleTester.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vitest.config.mts Expands the test include glob to run tests from packages/**, ensuring the eslint-plugin tests are picked up by Vitest.
packages/eslint-plugin-studio/tests/require-lock-before-save.test.ts Migrates the rule test to Vitest and ESLint 9’s RuleTester API, but currently calls ruleTester.run inside a describe/it block, which will register tests dynamically inside another test and can cause the test runner to fail or skip these tests; ruleTester.run should be moved out to top level.
packages/eslint-plugin-studio/src/rules/require-lock-before-save.js Converts the rule module to an ESM default export and adds an explicit JSDoc type for RuleModule, without altering the rule’s runtime logic.
packages/eslint-plugin-studio/src/index.js Switches the plugin entry point to ESM, importing the rule module and exporting the plugin object as a default export for consumption by the flat ESLint config.
packages/eslint-plugin-studio/package.json Marks the plugin package as "type": "module", removes local Jest scripts/devDependencies, and keeps ESLint 9 as the runtime dependency to match the rule/test setup.
Comments suppressed due to low confidence (1)

packages/eslint-plugin-studio/tests/require-lock-before-save.test.ts:15

  • ruleTester.run is being invoked inside a describe/it block, which will cause it to register tests dynamically during a running test. RuleTester itself defines tests using the global describe/it (or equivalent) functions, so nesting ruleTester.run inside another test can lead to invalid "tests within tests" and cause Vitest/Mocha-style runners to error or silently skip these cases. To align with how RuleTester is intended to be used, move the ruleTester.run call to the top level of this file (or at least outside any it callback) and let it register its own test cases with the underlying test framework.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants