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.