-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add versionsToTest option to support multiple TypeScript versio…
…ns (#635) ## PR Checklist - [x] Addresses an existing open issue: fixes #107 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Switches all `ts from "typescript"` imports to be `import type`. A `tsModule` is now passed around to all functions that need runtime `ts.*` values. Differs from the DefinitelyTyped-tools implementation by using [`get-tsconfig`](https://www.npmjs.com/package/get-tsconfig) instead of a manual `findUp` function.
- Loading branch information
1 parent
96810ea
commit 153f83e
Showing
23 changed files
with
597 additions
and
123 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { TSESLint } from "@typescript-eslint/utils"; | ||
|
||
export const messages = { | ||
CouldNotRequireTypeScript: | ||
"Could not require TypeScript specified with name '{{ name }}' at path '{{ path }}': {{ error }}.", | ||
DuplicateTSVersionName: | ||
"Multiple TypeScript versions specified with name '{{ name }}'.", | ||
ExpectedErrorNotFound: "Expected an error on this line, but found none.", | ||
ExpectedErrorNotFoundForVersion: | ||
"Expected an error for TypeScript version {{ version }} on this line, but found none.", | ||
Multiple$ExpectTypeAssertions: | ||
"This line has 2 or more $ExpectType assertions.", | ||
OrphanAssertion: "Can not match a node to this assertion.", | ||
SyntaxError: "Syntax Error: {{ message }}", | ||
TypesDoNotMatch: "Expected type to be: {{ expected }}, got: {{ actual }}", | ||
TypesDoNotMatchForVersion: | ||
"Expected type for TypeScript version {{ version }} to be: {{ expected }}, got: {{ actual }}", | ||
TypeSnapshotDoNotMatch: | ||
"Expected type from snapshot to be: {{ expected }}, got: {{ actual }}", | ||
TypeSnapshotDoNotMatchForVersion: | ||
"Expected type for TypeScript version {{ version }} from snapshot to be: {{ expected }}, got: {{ actual }}", | ||
TypeSnapshotNotFound: | ||
"Type Snapshot not found. Please consider running ESLint in FIX mode: eslint --fix", | ||
}; | ||
|
||
export type ExpectRuleContext = TSESLint.RuleContext<MessageIds, [Options]>; | ||
|
||
export type MessageIds = keyof typeof messages; | ||
|
||
export interface Options { | ||
readonly disableExpectTypeSnapshotFix: boolean; | ||
readonly versionsToTest?: VersionToTestOption[]; | ||
} | ||
|
||
export interface VersionToTestOption { | ||
name: string; | ||
path: string; | ||
} |
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.