Skip to content

Commit

Permalink
Added single-run / multi-run comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jul 17, 2024
1 parent 87de835 commit 27ac09f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/creators/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { writeEvenCaseFiles } from "./createEvenCaseFiles.js";
import { writeProjectsCaseFiles } from "./createProjectsCaseFiles.js";
import { writeWideCaseFiles } from "./createWideCaseFiles.js";

export function createESLintConfigFile(types: CaseTypes) {
export function createESLintConfigFile(data: CaseData) {
return `
import tseslint from "typescript-eslint";
Expand All @@ -14,7 +14,8 @@ export function createESLintConfigFile(types: CaseTypes) {
files: ["**/*.ts"],
languageOptions: {
parserOptions: {
${types === "service" ? "projectService" : "project"}: true,
${data.singleRun ? "disallowAutomaticSingleRunInference: true," : ""}
${data.types === "service" ? "projectService" : "project"}: true,
tsconfigRootDir: import.meta.dirname,
},
},
Expand Down
6 changes: 5 additions & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ export const caseEntries = [
{
label: "files",
// values: [1, 32, 64, 128, 256, 512, 1024],
values: [1, 128, 512, 1024],
values: [512, 1024],
},
{
label: "layout",
values: ["even" /* , "projects" , "wide" */],
},
{
label: "singleRun",
values: [false, true],
},
{
label: "types",
values: ["project", "service"],
Expand Down
12 changes: 5 additions & 7 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ async function createCase(data: CaseData): Promise<NamedCaseData> {

await fs.mkdir(path.join(directory, "src"), { recursive: true });

await writeFile(
directory,
"eslint.config.js",
createESLintConfigFile(data.types),
);
await writeFile(directory, "eslint.config.js", createESLintConfigFile(data));

await writeFile(
directory,
Expand Down Expand Up @@ -75,8 +71,10 @@ const cases: NamedCaseData[] = [];

for (const files of caseEntries[0].values) {
for (const layout of caseEntries[1].values) {
for (const types of caseEntries[2].values) {
cases.push(await createCase({ files, layout, types }));
for (const singleRun of caseEntries[2].values) {
for (const types of caseEntries[3].values) {
cases.push(await createCase({ files, layout, singleRun, types }));
}
}
}
}
Expand Down
18 changes: 16 additions & 2 deletions src/measure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,28 @@ const results: unknown[] = [];
for (const files of caseEntries[0].values) {
results.push({
files,
"project (even)": await runProjectLint({
"project (multi-run)": await runProjectLint({
files,
layout: "even",
singleRun: false,
types: "project",
}),
"service (even)": await runProjectLint({
"project (single-run)": await runProjectLint({
files,
layout: "even",
singleRun: true,
types: "project",
}),
"service (multi-run)": await runProjectLint({
files,
layout: "even",
singleRun: false,
types: "service",
}),
"service (single-run)": await runProjectLint({
files,
layout: "even",
singleRun: true,
types: "service",
}),
// "project (wide)": await runProjectLint({
Expand Down

0 comments on commit 27ac09f

Please sign in to comment.