-
Notifications
You must be signed in to change notification settings - Fork 227
no-relative-import-in-test: also skip .d.mts/cts #724
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
no-relative-import-in-test: also skip .d.mts/cts #724
Conversation
I haven't figured out to get the test to pass for this, so I left it untested.
|
@JoshuaKGoldberg I could never figure out the tests for this rule, and I don't have time. I'm going to merge this, but someday I'd like to understand how ts-eslint tests work. |
|
cc @bradzacher - a good area for us to bolster docs on. Or maybe just good motivation for typescript-eslint/typescript-eslint#1891 |
|
This one should be pretty simple to test. Eg something like valid: [
{
code: "some code that would normally error for the rule",
filename: "foo.d.ts"
},
{
code: "some code that would normally error for the rule",
filename: "foo.d.cts"
},
{
code: "some code that would normally error for the rule",
filename: "foo.d.dts"
},
]You can use the Otherwise we have some docs on testing rules https://typescript-eslint.io/developers/custom-rules#testing |
|
Adding the d.cts test produces this output. The new valid test uses the same code as the invalid test, but should pass because it's in a d.cts file. However, both the new valid and existing invalid test now fail. |
|
Oh sorry. I forgot that if the file doesn't exist then it's a parser error. Wherever your test setup's tsconfig is - you'll need to create both files (they can be empty) and ensure the tsconfig includes them. Sadly without a vfs things need to exist on disk for the type checker. |
* Disable improved eslint rules Found by microsoft/DefinitelyTyped-tools#723 microsoft/DefinitelyTyped-tools#724 microsoft/DefinitelyTyped-tools#726 * add missed package
I haven't figured out to get the test to pass for this, so I left it untested. Fixes the failure in fs-extra on DT.