Skip to content

Conversation

@Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented May 19, 2025

Description

This PR modifies the ESLint configuration to disable the import/no-extraneous-dependencies rule for test and storybook files, allowing these files to import development dependencies without triggering linting errors.

Changes

  • Updated .eslintrc.json to turn off import/no-extraneous-dependencies rule for:
    • Test files (**/test/**/*.test.{js,ts,jsx,tsx})
    • Storybook files (**/stories/**/*.{js,ts,jsx,tsx})
  • Simplified the file patterns in the override configuration
  • Maintained the rule for all other source files

Impact

This change:

  • Reduces noise in the linting output for test and storybook files
  • Allows test and storybook files to freely import development dependencies
  • Maintains strict dependency checking for the main source code

Motivation and context

Related issue(s)

  • N/A

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Create a test commit in your local branch or in this branch

    1. Update any file in your code and try to add any test or storybook file to your commit
    2. Try to push this commit
    3. Commit passes without any errors stating missing dependencies

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@Rajdeepc Rajdeepc self-assigned this May 19, 2025
@Rajdeepc Rajdeepc requested a review from a team as a code owner May 19, 2025 06:45
@changeset-bot
Copy link

changeset-bot bot commented May 19, 2025

⚠️ No Changeset found

Latest commit: 5af5279

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

Branch preview

Review the following VRT differences

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@github-actions
Copy link
Contributor

Tachometer results

Currently, no packages are changed by this PR...

@Rajdeepc Rajdeepc requested a review from castastrophe May 19, 2025 07:24
Comment on lines 88 to 89
"**/test/**/*.test.{js,ts,jsx,tsx}",
"**/stories/**/*.{js,ts,jsx,tsx}"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks great but do we want to scope these a little more?

Suggested change
"**/test/**/*.test.{js,ts,jsx,tsx}",
"**/stories/**/*.{js,ts,jsx,tsx}"
"{packages,tools}/*/test/*.test.ts",
"{packages,tools}/*/stories/*.ts"

To make sure we're not ignoring assets we want to validate?

Copy link
Contributor

@castastrophe castastrophe left a comment

Choose a reason for hiding this comment

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

Approved with a suggestion about making the selectors more specific.

@Rajdeepc Rajdeepc added the Status: Ready for review PR ready for review or re-review. label May 19, 2025
"overrides": [
{
"files": [
"{packages,tools}/*/test/*.test.ts",
Copy link
Contributor

@caseyisonit caseyisonit May 19, 2025

Choose a reason for hiding this comment

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

nit: what if we made these agnostic so we don't miss any rogue files in the repo?

Suggested change
"{packages,tools}/*/test/*.test.ts",
"**/test/*.test.ts",
"**/stories/*.ts"

Copy link
Contributor

@caseyisonit caseyisonit May 19, 2025

Choose a reason for hiding this comment

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

@Rajdeepc reopened this as tools has no context inside of packages. I recommend keeping the stars and adding the same rule to tools.

cc @castastrophe

Copy link
Contributor Author

@Rajdeepc Rajdeepc May 21, 2025

Choose a reason for hiding this comment

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

To avoid confusion, I have added the check to switch off it under

"files": [
      "*.test.ts",
      "*.stories.ts",
      "**/benchmark/*.ts",
      "**/test/*.ts"
  ],

@caseyisonit caseyisonit added the Status: Ready for merge PR has 2 approvals, all tests pass, and is ready to merge label May 21, 2025
@caseyisonit
Copy link
Contributor

@Rajdeepc I think during cutover I needed to add this rule in to get around linter errors in script testing. Can you confirm that's correct in main (that's what I see in the conflict). If it is correct and included in main, we can close this with a comment calling out the cutover PR resolved this.

@caseyisonit
Copy link
Contributor

Confirmed with @Rajdeepc that this is covered in main now and we can close this PR. Resolved in #5472

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

Labels

Status: Ready for merge PR has 2 approvals, all tests pass, and is ready to merge Status: Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants