-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate codebase to use the new rule-tester package
- Loading branch information
1 parent
2ce1c1d
commit 3a2d8da
Showing
158 changed files
with
559 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { ESLintUtils } from '@typescript-eslint/utils'; | ||
import path from 'path'; | ||
|
||
function getFixturesRootDir(): string { | ||
return path.join(__dirname, 'fixtures'); | ||
} | ||
|
||
const { batchedSingleLineTests, RuleTester } = ESLintUtils; | ||
|
||
export { RuleTester, batchedSingleLineTests, getFixturesRootDir }; | ||
export { RuleTester } from '@typescript-eslint/rule-tester'; | ||
export { getFixturesRootDir }; |
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin-internal/tests/rules/no-poorly-typed-ts-props.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
import { ESLintUtils } from '@typescript-eslint/utils'; | ||
import type { | ||
InvalidTestCase, | ||
ValidTestCase, | ||
} from '@typescript-eslint/rule-tester'; | ||
import { batchedSingleLineTests as batchedSingleLineTestsBase } from '@typescript-eslint/utils/eslint-utils'; | ||
import * as path from 'path'; | ||
|
||
function getFixturesRootDir(): string { | ||
export function getFixturesRootDir(): string { | ||
return path.join(__dirname, 'fixtures'); | ||
} | ||
|
||
const { batchedSingleLineTests } = ESLintUtils; | ||
export { | ||
RuleTester, | ||
RunTests, | ||
ValidTestCase, | ||
InvalidTestCase, | ||
noFormat, | ||
} from '@typescript-eslint/utils/eslint-utils/rule-tester'; | ||
|
||
export { batchedSingleLineTests, getFixturesRootDir }; | ||
// TODO - migrate the codebase off of this utility | ||
// this re-export exists to re-type the utility with the types from @typescript-eslint/rule-tester | ||
export const batchedSingleLineTests = batchedSingleLineTestsBase as { | ||
/** | ||
* Converts a batch of single line tests into a number of separate test cases. | ||
* This makes it easier to write tests which use the same options. | ||
* | ||
* Why wouldn't you just leave them as one test? | ||
* Because it makes the test error messages harder to decipher. | ||
* This way each line will fail separately, instead of them all failing together. | ||
*/ | ||
<TOptions extends Readonly<unknown[]>>( | ||
test: ValidTestCase<TOptions>, | ||
): ValidTestCase<TOptions>[]; | ||
/** | ||
* Converts a batch of single line tests into a number of separate test cases. | ||
* This makes it easier to write tests which use the same options. | ||
* | ||
* Why wouldn't you just leave them as one test? | ||
* Because it makes the test error messages harder to decipher. | ||
* This way each line will fail separately, instead of them all failing together. | ||
* | ||
* Make sure you have your line numbers correct for error reporting, as it will match | ||
* the line numbers up with the split tests! | ||
*/ | ||
<TMessageIds extends string, TOptions extends Readonly<unknown[]>>( | ||
test: InvalidTestCase<TMessageIds, TOptions>, | ||
): InvalidTestCase<TMessageIds, TOptions>[]; | ||
}; |
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/eslint-rules/no-dupe-args.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/eslint-rules/no-implicit-globals.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.