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

⬆️ Update dependency prettier to v3 #4033

Merged
merged 6 commits into from Aug 31, 2023
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .all-contributorsrc
Expand Up @@ -417,4 +417,3 @@
],
"contributorsPerLine": 7
}

8 changes: 4 additions & 4 deletions .github/workflows/scripts/generate-changelog.cjs
Expand Up @@ -141,7 +141,7 @@ async function extractAndParseDiff(fromIdentifier, packageName) {
default:
++numFailed;
errors.push(
`⚠️ Unhandled type: ${type} on [PR-${pr}](https://github.com/dubzzz/fast-check/pull/${pr}) with title ${title}`
`⚠️ Unhandled type: ${type} on [PR-${pr}](https://github.com/dubzzz/fast-check/pull/${pr}) with title ${title}`,
);
break;
}
Expand Down Expand Up @@ -231,13 +231,13 @@ async function run() {
console.debug(`[debug] Checking ${packageName} between tag ${oldTag} and tag ${newTag}`);
const { breakingSection, newFeaturesSection, maintenanceSection, errors } = await extractAndParseDiff(
oldTag,
packageName
packageName,
);

// Build changelog message
const codeUrl = `https://github.com/dubzzz/fast-check/tree/${encodeURIComponent(newTag)}`;
const diffUrl = `https://github.com/dubzzz/fast-check/compare/${encodeURIComponent(oldTag)}...${encodeURIComponent(
newTag
newTag,
)}`;
const breakingBlock = breakingSection
.reverse()
Expand Down Expand Up @@ -297,7 +297,7 @@ async function run() {
.map((b) => b.cwd.substring(process.cwd().length + 1).replace(/\\/g, '/'))
.map(
(packageRelativePath) =>
`https://github.com/dubzzz/fast-check/blob/${branchName}/${packageRelativePath}/CHANGELOG.md`
`https://github.com/dubzzz/fast-check/blob/${branchName}/${packageRelativePath}/CHANGELOG.md`,
);

// Return useful details
Expand Down
8 changes: 8 additions & 0 deletions .yarn/versions/f78ad017.yml
@@ -0,0 +1,8 @@
releases:
"@fast-check/ava": patch
"@fast-check/jest": patch
"@fast-check/packaged": patch
"@fast-check/poisoning": patch
"@fast-check/vitest": patch
"@fast-check/worker": patch
fast-check: patch
6 changes: 3 additions & 3 deletions examples/001-simple/decompPrime/main.spec.ts
Expand Up @@ -11,7 +11,7 @@ describe('decompPrime', () => {
const factors = decompPrime(n);
const productOfFactors = factors.reduce((a, b) => a * b, 1);
return productOfFactors === n;
})
}),
);
});

Expand All @@ -21,7 +21,7 @@ describe('decompPrime', () => {
const n = a * b;
const factors = decompPrime(n);
return factors.length >= 2;
})
}),
);
});

Expand All @@ -33,7 +33,7 @@ describe('decompPrime', () => {
const factorsAB = decompPrime(a * b);
const reorder = (arr: number[]) => [...arr].sort((a, b) => a - b);
expect(reorder(factorsAB)).toEqual(reorder([...factorsA, ...factorsB]));
})
}),
);
});
});
14 changes: 7 additions & 7 deletions examples/001-simple/fibonacci/main.spec.ts
Expand Up @@ -10,7 +10,7 @@ describe('fibonacci', () => {
fc.assert(
fc.property(fc.integer({ min: 2, max: MaxN }), (n) => {
expect(fibo(n)).toBe(fibo(n - 1) + fibo(n - 2));
})
}),
);
});

Expand All @@ -21,7 +21,7 @@ describe('fibonacci', () => {
fc.assert(
fc.property(fc.integer({ min: 1, max: MaxN }), fc.integer({ min: 0, max: MaxN }), (p, q) => {
expect(fibo(p + q)).toBe(fibo(p) * fibo(q + 1) + fibo(p - 1) * fibo(q));
})
}),
);
});

Expand All @@ -30,7 +30,7 @@ describe('fibonacci', () => {
fc.assert(
fc.property(fc.integer({ min: 1, max: MaxN }), (p) => {
expect(fibo(2 * p - 1)).toBe(fibo(p - 1) * fibo(p - 1) + fibo(p) * fibo(p));
})
}),
);
});

Expand All @@ -40,7 +40,7 @@ describe('fibonacci', () => {
const [p, q] = a < b ? [b, a] : [a, b];
const sign = (p - q) % 2 === 0 ? 1n : -1n; // (-1)^(p-q)
expect(fibo(p) * fibo(p) - fibo(p - q) * fibo(p + q)).toBe(sign * fibo(q) * fibo(q));
})
}),
);
});

Expand All @@ -49,15 +49,15 @@ describe('fibonacci', () => {
fc.property(fc.integer({ min: 1, max: MaxN }), (p) => {
const sign = p % 2 === 0 ? 1n : -1n; // (-1)^p
expect(fibo(p + 1) * fibo(p - 1) - fibo(p) * fibo(p)).toBe(sign);
})
}),
);
});

it('should fibo(nk) divisible by fibo(n)', () => {
fc.assert(
fc.property(fc.integer({ min: 1, max: MaxN }), fc.integer({ min: 0, max: 100 }), (n, k) => {
expect(fibo(n * k) % fibo(n)).toBe(0n);
})
}),
);
});

Expand All @@ -81,7 +81,7 @@ describe('fibonacci', () => {
}
};
expect(gcd(fibo(a), fibo(b), 0n)).toBe(fibo(gcd(a, b, 0)));
})
}),
);
});
});
4 changes: 2 additions & 2 deletions examples/001-simple/indexOf/main.spec.ts
Expand Up @@ -6,7 +6,7 @@ describe('indexOf', () => {
fc.assert(
fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => {
return indexOf(a + b + c, b) !== -1;
})
}),
);
});

Expand All @@ -17,7 +17,7 @@ describe('indexOf', () => {
const pattern = b;
const index = indexOf(text, pattern);
return index === -1 || text.substr(index, pattern.length) === pattern;
})
}),
);
});
});
8 changes: 4 additions & 4 deletions examples/001-simple/sort/main.spec.ts
Expand Up @@ -7,7 +7,7 @@ describe('sort', () => {
fc.assert(
fc.property(fc.array(fc.integer()), (data) => {
expect(sort(data)).toHaveLength(data.length);
})
}),
);
});

Expand All @@ -16,7 +16,7 @@ describe('sort', () => {
fc.property(fc.array(fc.integer()), (data) => {
const sorted = sort(data);
expect(_.groupBy(sorted)).toEqual(_.groupBy(data));
})
}),
);
});

Expand All @@ -27,7 +27,7 @@ describe('sort', () => {
for (let idx = 1; idx < sorted.length; ++idx) {
expect(sorted[idx - 1]).toBeLessThanOrEqual(sorted[idx]);
}
})
}),
);
});

Expand All @@ -45,7 +45,7 @@ describe('sort', () => {
// a < b means in terms of ordering a comes before b
// One important property is: a < b and b < c implies a < c
}
})
}),
);
});
});
Expand Up @@ -31,7 +31,7 @@ export const binarySearchTreeWithMaxDepth = (maxDepth: number): fc.Arbitrary<Tre
export const binarySearchTreeWithMaxDepthOldWay = (
maxDepth: number,
minValue: number = Number.MIN_SAFE_INTEGER,
maxValue: number = Number.MAX_SAFE_INTEGER
maxValue: number = Number.MAX_SAFE_INTEGER,
): fc.Arbitrary<Tree<number>> => {
const valueArbitrary = fc.integer({ min: minValue, max: maxValue });
if (maxDepth <= 0) {
Expand Down
14 changes: 7 additions & 7 deletions examples/002-recursive/isSearchTree/main.spec.ts
Expand Up @@ -9,7 +9,7 @@ describe('isSearchTree', () => {
fc.assert(
fc.property(binarySearchTreeWithMaxDepth(3), (tree) => {
return isSearchTree(tree);
})
}),
);
});

Expand All @@ -18,7 +18,7 @@ describe('isSearchTree', () => {
fc.property(binaryTreeWithMaxDepth(3), (tree) => {
fc.pre(!isSorted(traversal(tree, (t) => t.value)));
return !isSearchTree(tree);
})
}),
);
});

Expand All @@ -27,7 +27,7 @@ describe('isSearchTree', () => {
fc.property(binaryTreeWithoutMaxDepth(), (tree) => {
fc.pre(!isSorted(traversal(tree, (t) => t.value)));
return !isSearchTree(tree);
})
}),
);
});

Expand All @@ -36,11 +36,11 @@ describe('isSearchTree', () => {
fc.property(binaryTreeWithMaxDepth(3), (tree) => {
fc.pre(
traversal(tree, (t) => t).some(
(t) => (t.left && t.left.value > t.value) || (t.right && t.right.value <= t.value)
)
(t) => (t.left && t.left.value > t.value) || (t.right && t.right.value <= t.value),
),
);
return !isSearchTree(tree);
})
}),
);
});
});
Expand All @@ -57,6 +57,6 @@ function traversal<TOut>(t: Tree<number>, extract: (node: Tree<number>) => TOut,
function isSorted(d: number[]): boolean {
return _.isEqual(
d,
[...d].sort((a, b) => a - b)
[...d].sort((a, b) => a - b),
);
}
2 changes: 1 addition & 1 deletion examples/003-misc/knight/arbitraries/SpaceArbitrary.ts
Expand Up @@ -12,6 +12,6 @@ export const SpaceArbitrary = fc
})
.filter(({ w, h, cx, cy, sx, sy }) => cx < w && sx < w && cy < h && sy < h)
.map(({ w, h, cx, cy, sx, sy }) =>
new SpaceBuilder().withDimension(w, h).withSolution(cx, cy).withCurrent(sx, sy).build()
new SpaceBuilder().withDimension(w, h).withSolution(cx, cy).withCurrent(sx, sy).build(),
)
.map((space) => [space, Math.ceil(Math.log(Math.max(space.dim_x, space.dim_y)) / Math.log(2))] as [Space, number]);
2 changes: 1 addition & 1 deletion examples/003-misc/knight/main.spec.ts
Expand Up @@ -13,7 +13,7 @@ describe('knight', () => {
const [space, max_guesses] = inputs;
knight(space, max_guesses);
return space.solved();
})
}),
);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/003-misc/knight/src/space.ts
Expand Up @@ -5,7 +5,7 @@ export class Space {
private readonly solution_x: number,
private readonly solution_y: number,
private current_x: number,
private current_y: number
private current_y: number,
) {}
readHint(): string {
let hint = '';
Expand Down
16 changes: 8 additions & 8 deletions examples/003-misc/mazeGenerator/main.spec.ts
Expand Up @@ -9,7 +9,7 @@ describe('mazeGenerator', () => {
const maze = mazeGenerator(seed, ins.dim, ins.startPt, ins.endPt);
expect(maze[ins.startPt.y][ins.startPt.x]).toBe(CellType.Start);
expect(_.flatten(maze).filter((c) => c === CellType.Start)).toHaveLength(1);
})
}),
);
});

Expand All @@ -19,7 +19,7 @@ describe('mazeGenerator', () => {
const maze = mazeGenerator(seed, ins.dim, ins.startPt, ins.endPt);
expect(maze[ins.endPt.y][ins.endPt.x]).toBe(CellType.End);
expect(_.flatten(maze).filter((c) => c === CellType.End)).toHaveLength(1);
})
}),
);
});

Expand All @@ -28,7 +28,7 @@ describe('mazeGenerator', () => {
fc.property(seedArb, inputsArb, (seed, ins) => {
const maze = mazeGenerator(seed, ins.dim, ins.startPt, ins.endPt);
return hasPathFromStartToEnd(maze, ins.startPt);
})
}),
);
});

Expand Down Expand Up @@ -56,11 +56,11 @@ describe('mazeGenerator', () => {
return cell !== null && cell !== CellType.Wall;
})
// Keep the src aka source point in order not to go back on our tracks
.map((nPt) => ({ pt: nPt, src: pt }))
.map((nPt) => ({ pt: nPt, src: pt })),
);
}
return true;
})
}),
);
});

Expand All @@ -74,7 +74,7 @@ describe('mazeGenerator', () => {
else return count + 1;
}, 0);
expect(numPathsLeavingEnd).toBe(1);
})
}),
);
});

Expand All @@ -92,12 +92,12 @@ describe('mazeGenerator', () => {
...neighboorsFor(pt).filter((nPt) => {
const cell = cellTypeAt(maze, nPt);
return cell !== null && cell !== CellType.Wall && cell !== 'Visited';
})
}),
);
}
// All cells are either Walls or marked as visited
expect(_.flatten(maze).filter((c) => c !== CellType.Wall && c !== 'Visited')).toHaveLength(0);
})
}),
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion examples/003-misc/mazeGenerator/src/mazeGenerator.ts
Expand Up @@ -21,7 +21,7 @@ const mazeGeneratorInternal = (
mrng: Random,
dim: Dimension,
startPt: Point,
endPt: Point
endPt: Point,
): { maze: CellType[][]; hasPathLeadingToTheEnd: boolean } => {
// Initialize grid
const maze: CellType[][] = [...Array(dim.height)].map((_) => [...Array(dim.width)].fill(CellType.Wall));
Expand Down