-
Notifications
You must be signed in to change notification settings - Fork 578
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
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/primer-components/iCknXxFv9ij9ZkXPchbq5w1xovh9 |
src/__tests__/example.js
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated @T-Hugs
There was a problem hiding this 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 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
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 👍 |
Ironically, looks like @VanAnderson deleted this file in #1115. I guess that solves the issue as well 😂 |
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 😄 )