Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore lint warning in example test file #1141

Closed
wants to merge 2 commits into from
Closed

Ignore lint warning in example test file #1141

wants to merge 2 commits into from

Conversation

dgreif
Copy link
Member

@dgreif dgreif commented Mar 29, 2021

I noticed there was an eslint warning popping up in all the recent PRs (see image below) because we skip the test in the __tests__/example.js file. Adding an eslint ignore (and correcting the comment above which incorrectly tells you how to enable the test 😄 )

image

@dgreif dgreif requested review from T-Hugs and smockle March 29, 2021 22:28
@changeset-bot
Copy link

changeset-bot bot commented Mar 29, 2021

⚠️ No Changeset found

Latest commit: 52ed403

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

@vercel
Copy link

vercel bot commented Mar 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/iCknXxFv9ij9ZkXPchbq5w1xovh9
✅ Preview: https://primer-components-git-eslint-warning-primer.vercel.app

@dgreif dgreif removed the request for review from T-Hugs March 30, 2021 03:02
@@ -8,7 +8,8 @@ import {COMMON} from '../constants'
// 2. remove this definition; it's just for eslint
function SomeComponent() {}

// 3. remove the leading "x" from this line to enable the test
// 3. remove the ".skip" from this line to enable the test
// eslint-disable-next-line jest/no-disabled-tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for cleaning this up! I don't mind this approach, but since the code is likely to be copied, I wonder if we can do one of these:

ignore the rule in eslint config

I'm wondering if we should add this exception at the eslint config level, just because it's likely this code will be copied. You can add this to src/__tests__/.eslintrc.json:

"overrides": [
    {
      "files": [ "example.js" ],
      "rules": {
        "jest/no-disabled-tests": "off"
      }
    }
  ]

ignore this file in jest config

Another alternative is to just remove the .skip in the example file, and ignore this file in the jest.config.js:

  testPathIgnorePatterns: ['example.js']

Of course, if we do this, we can remove the .skip altogether.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great ideas! I considered the fact this would be copied and was concerned about that as well. I'll go with the testPathIgnorePatterns since that way they can make a straight copy and not even worry about removing the skip.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated @T-Hugs

Copy link
Contributor

@T-Hugs T-Hugs left a comment

Choose a reason for hiding this comment

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

I left a comment; let me know what you think. Thanks for cleaning this up 🚀

@vercel vercel bot temporarily deployed to Preview March 30, 2021 15:09 Inactive
Copy link
Contributor

@T-Hugs T-Hugs left a comment

Choose a reason for hiding this comment

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

🚀

@T-Hugs
Copy link
Contributor

T-Hugs commented Mar 30, 2021

Whoops, hold the phone. I just noticed that Step 2 is also just there for ESLint. If we're disabling rules for this file, might as well disable that too so we can remove that line 👍

@dgreif
Copy link
Member Author

dgreif commented Mar 31, 2021

Ironically, looks like @VanAnderson deleted this file in #1115. I guess that solves the issue as well 😂

@dgreif dgreif closed this Mar 31, 2021
@dgreif dgreif deleted the eslint-warning branch March 31, 2021 04:00
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.

3 participants