-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest 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 |
f9c56b1
to
a873c0d
Compare
Wait for downstream to support: typescript-eslint/typescript-eslint#8211 |
b9e81ce
to
b026cb9
Compare
8daf0c5
to
567c233
Compare
07fed65
to
bff669d
Compare
63c0c88
to
c64c909
Compare
3df0fe5
to
c294e56
Compare
@@ -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')" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Co-authored-by: Sam Chung <samc@seek.com.au>
src/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.ts
Outdated
Show resolved
Hide resolved
src/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.ts
Outdated
Show resolved
Hide resolved
}, | ||
); | ||
|
||
const replaceAllUntilStable = ( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!)
src/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
for (const [file, content] of Object.entries(contents)) { | ||
await fsp.writeFile(path.join(dir, file), content); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }) => ({ |
There was a problem hiding this comment.
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')" |
There was a problem hiding this comment.
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
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]!)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
FlatESLint
#1157