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

fix: make recommended config a valid flat config #462

merged 1 commit into from
Sep 9, 2024

Conversation

fasttime
Copy link
Contributor

@fasttime fasttime commented Sep 9, 2024

PR Checklist

Overview

This PR updates the recommended config to make it a valid flat config. Currently, the recommended config's plugins field is an array, and thus this config cannot be used in flat mode, where plugins is expected to be an object.

It looks like the readme file already contains instructions for embedding the recommended config in a flat config file, but the recommended config itself hasn't been updated yet.

import expectType from "eslint-plugin-expect-type/configs/recommended";

export default [
	// your other ESLint configurations
	expectType,
];

I noticed this problem while working on eslint/eslint#18869.

Comment on lines -8 to -27
{
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
`,
},
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
`,

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

@fasttime fasttime marked this pull request as ready for review September 9, 2024 18:48
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Wonderful, thanks @fasttime! 🙌

@JoshuaKGoldberg
Copy link
Owner

CI failures are unrelated and already on main. I'll fix separately.

@JoshuaKGoldberg JoshuaKGoldberg merged commit 3e89c46 into JoshuaKGoldberg:main Sep 9, 2024
13 of 14 checks passed
@JoshuaKGoldberg
Copy link
Owner

@all-contributors please add @fasttime for code.

🤖 Beep boop! This comment was added automatically by all-contributors-auto-action.
Not all contributions can be detected from Git & GitHub alone. Please comment any missing contribution types this bot missed.
...and of course, thank you for contributing! 💙

Copy link
Contributor

@JoshuaKGoldberg

I've put up a pull request to add @fasttime! 🎉

I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.

JoshuaKGoldberg pushed a commit that referenced this pull request Sep 9, 2024
Adds @fasttime as a contributor for code.

This was requested by JoshuaKGoldberg [in this
comment](#462 (comment))

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
JoshuaKGoldberg added a commit that referenced this pull request Sep 12, 2024
## PR Checklist

- [x] Addresses an existing open issue: fixes #486
- [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

Reverts the part of #462 that changed `src/index.ts`. That file is still
the legacy config format; it's
`eslint-plugin-expect-type/configs/recommended`. Repro:
https://github.com/JoshuaKGoldberg/repros/tree/eslint-plugin-expect-type-eslint-configs

💖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: Flat config (ESLint 9) support
2 participants