Skip to content
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

fix: make recommended config a valid flat config #462

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { recommendedRuleSettings } from "./plugin.js";
import { plugin, recommendedRuleSettings } from "./plugin.js";

export { rules } from "./rules/index.js";

export const configs = {
recommended: {
plugins: ["expect-type"],
plugins: {
"expect-type": plugin,
},
rules: recommendedRuleSettings,
},
};
20 changes: 0 additions & 20 deletions src/rules/twoslash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,8 @@
import { expect } from "./expect.js";
import { filename, ruleTester } from "./ruleTester.js";

ruleTester.run("expect", expect, {

Check failure on line 6 in src/rules/twoslash.test.ts

View workflow job for this annotation

GitHub Actions / type_check

Argument of type 'import("/home/runner/work/eslint-plugin-expect-type/eslint-plugin-expect-type/node_modules/.pnpm/@typescript-eslint[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"ExpectedErrorNotFound" | "FileIsNotIncludedInTSConfig" | "Multiple$ExpectTypeAssertio...' is not assignable to parameter of type 'import("/home/runner/work/eslint-plugin-expect-type/eslint-plugin-expect-type/node_modules/.pnpm/@typescript-eslint[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"ExpectedErrorNotFound" | "FileIsNotIncludedInTSConfig" | "Multiple$ExpectTypeAssertio...'.
invalid: [
{
code: dedent`
const square = (x: number) => x * x;
const four = square(2);
// ^? const four: string
`,
errors: [
{
column: 7,
line: 2,
messageId: "TypesDoNotMatch",
},
],
filename,
output: dedent`
const square = (x: number) => x * x;
const four = square(2);
// ^? const four: number
`,
},
Comment on lines -8 to -27
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed test is a duplicate of another one below:

// Fixer for comment that doesn't continue the twoslash comment
{
code: dedent`
const square = (x: number) => x * x;
const four = square(2);
// ^? const four: string
`,
errors: [
{
column: 7,
line: 2,
messageId: "TypesDoNotMatch",
},
],
filename,
output: dedent`
const square = (x: number) => x * x;
const four = square(2);
// ^? const four: number
`,

// Offers a fix for an empty assertion (the usual starting point)
{
code: dedent`
Expand Down
7 changes: 2 additions & 5 deletions src/utils/types.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lint error was being reported here by perfectionist:

.../eslint-plugin-expect-type/src/utils/types.ts
4:28 error Expected "{ [K in Keys]: NonNullable<BaseType[K]>;
}" to come before "Omit<BaseType, Keys>" perfectionist/sort-intersection-types

Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export type SetRequiredNonNullable<
BaseType,
Keys extends keyof BaseType,
> = Omit<BaseType, Keys> & {
export type SetRequiredNonNullable<BaseType, Keys extends keyof BaseType> = {
[K in Keys]: NonNullable<BaseType[K]>;
};
} & Omit<BaseType, Keys>;
Loading