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

ESLint 9, flat config migration #1537

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

ESLint 9, flat config migration #1537

wants to merge 47 commits into from

Conversation

Copy link

changeset-bot bot commented Apr 11, 2024

🦋 Changeset detected

Latest commit: 1246869

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@renovate renovate bot force-pushed the renovate-eslint-9.x branch 5 times, most recently from f9c56b1 to a873c0d Compare April 17, 2024 06:37
@renovate renovate bot requested a review from a team as a code owner April 18, 2024 00:09
@samchungy
Copy link
Contributor

Wait for downstream to support: typescript-eslint/typescript-eslint#8211

@samchungy samchungy marked this pull request as draft April 18, 2024 00:16
@samchungy samchungy mentioned this pull request Apr 18, 2024
1 task
@72636c 72636c removed the request for review from a team April 18, 2024 00:31
@renovate renovate bot force-pushed the renovate-eslint-9.x branch 5 times, most recently from 8daf0c5 to 567c233 Compare April 24, 2024 00:39
@renovate renovate bot force-pushed the renovate-eslint-9.x branch 4 times, most recently from 07fed65 to bff669d Compare May 9, 2024 11:34
@renovate renovate bot force-pushed the renovate-eslint-9.x branch 3 times, most recently from 63c0c88 to c64c909 Compare May 22, 2024 04:35
@renovate renovate bot force-pushed the renovate-eslint-9.x branch 6 times, most recently from 3df0fe5 to c294e56 Compare June 5, 2024 00:14
.changeset/thick-taxis-vanish.md Outdated Show resolved Hide resolved
packages/eslint-config-skuba/index.js Show resolved Hide resolved
@@ -25,7 +25,13 @@ echo '--- pnpm build'
pnpm build

echo '--- pnpm pack'
# I'm sure there's a better way to do this
eslint_config_skuba_tar="$(pwd)/packages/eslint-config-skuba/$(cd packages/eslint-config-skuba && pnpm pack | grep -o 'eslint-config-skuba-.*\.tgz')"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmmm why is this needed again?

Copy link
Contributor

Choose a reason for hiding this comment

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

Integration tests were annoyingly running against the published version of eslint-config-seek, which horribly broke everything. Idk how to get it to do sane things

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh gotcha because we're packing the thing but the eslint config dep is workspace:* it injects the workspace's current version into that so when we install it, it pulls latest. Damn

src/cli/adapter/eslint.ts Outdated Show resolved Hide resolved
},
);

const replaceAllUntilStable = (
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Could we use replaceAll instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately not. The regex replaces pairs into one; but for cases of three or more in a row, it needs multiple rounds to condense them. I'm open to better approaches, this was a tricky one because I didn't want to parse the file (and end up fully reformatting it when writing it back out), so everything I considered was piles of hacks (including this!)

@AaronMoat AaronMoat mentioned this pull request Sep 23, 2024
1 task
Copy link
Contributor

@samchungy samchungy left a comment

Choose a reason for hiding this comment

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

👏

Comment on lines +89 to +91
for (const [file, content] of Object.entries(contents)) {
await fsp.writeFile(path.join(dir, file), content);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (const [file, content] of Object.entries(contents)) {
await fsp.writeFile(path.join(dir, file), content);
}
await Promise.all(
Object.entries(contents).map(([file, content]) =>
fsp.writeFile(path.join(dir, file), content)
)
);

'tmp*/',
],
},
...base.map(({ plugins: { jest: _jest, ...restPlugins } = {}, ...conf }) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why do we need to ignore the jest plugin from the base?

@@ -25,7 +25,13 @@ echo '--- pnpm build'
pnpm build

echo '--- pnpm pack'
# I'm sure there's a better way to do this
eslint_config_skuba_tar="$(pwd)/packages/eslint-config-skuba/$(cd packages/eslint-config-skuba && pnpm pack | grep -o 'eslint-config-skuba-.*\.tgz')"
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh gotcha because we're packing the thing but the eslint config dep is workspace:* it injects the workspace's current version into that so when we install it, it pulls latest. Damn

Comment on lines +36 to +40
buildkiteFiles
.map((name, i) => [name, i] as const)
.filter(([, i]) => replaced[i] !== input[i])
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
.map(([name, i]) => fs.writeFile(name, replaced[i]!)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
buildkiteFiles
.map((name, i) => [name, i] as const)
.filter(([, i]) => replaced[i] !== input[i])
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
.map(([name, i]) => fs.writeFile(name, replaced[i]!)),
buildkiteFiles.flatMap((name, i) =>
replaced[i] !== input[i] ? [fs.writeFile(name, replaced[i]!)] : []
),

Is the first map doing much?

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.

lint: Create migration path to FlatESLint lint: eslintrc rules difficult to override
3 participants