Skip to content

Commit 82d4b5e

Browse files
committed
fix prettier integration
1 parent 68e98cf commit 82d4b5e

File tree

22 files changed

+171
-123
lines changed

22 files changed

+171
-123
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919
"editor.renderFinalNewline": "off",
2020
"files.insertFinalNewline": true,
2121
"editor.formatOnSave": true
22+
"editor.defaultFormatter": "esbenp.prettier-vscode",
23+
"[javascript]": {
24+
"editor.defaultFormatter": "esbenp.prettier-vscode"
25+
}
2226
}

packages/core/eslint.config.mjs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default [
7373

7474
plugins: {
7575
"@typescript-eslint": typescriptEslint,
76-
"headers": headersEslint
76+
headers: headersEslint,
7777
},
7878

7979
languageOptions: {
@@ -93,16 +93,19 @@ export default [
9393
"headers/header-format": [
9494
"error",
9595
{
96-
"source": "string",
97-
"linePrefix": "",
98-
"blockPrefix": "\n",
99-
"blockSuffix": "\n",
100-
"content": readFileSync(path.join(__dirname, "../../.license-header"), 'utf-8').trim(),
101-
"variables": {
102-
"year": `${new Date().getFullYear()}`,
103-
}
104-
}
105-
]
96+
source: "string",
97+
linePrefix: "",
98+
blockPrefix: "\n",
99+
blockSuffix: "\n",
100+
content: readFileSync(
101+
path.join(__dirname, "../../.license-header"),
102+
"utf-8",
103+
).trim(),
104+
variables: {
105+
year: `${new Date().getFullYear()}`,
106+
},
107+
},
108+
],
106109
},
107110
},
108111
];

packages/core/rollup.config.mjs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,39 +47,39 @@ export default [
4747
{ dir: "dist/types", types: true, input },
4848
].map(
4949
({ dir, types, input }) =>
50-
/** @type {import("rollup").RollupOptions} */({
51-
input,
52-
treeshake: true,
53-
output: {
54-
dir,
55-
format: "es",
56-
sourcemap: true,
57-
exports: "named",
58-
...(!types && {
59-
entryFileNames: ({ name }) =>
60-
`[name].${executables[name] ? "mjs" : "js"}`,
61-
}),
62-
},
63-
plugins: [
64-
hashbang.default(),
65-
resolve({
66-
preferBuiltins: true,
67-
}),
68-
...(types
69-
? [
70-
dts({
71-
respectExternal: true,
72-
}),
73-
]
74-
: [
75-
esbuild({
76-
exclude: ["tests/**", "ux/**", "node_modules/**"],
77-
}),
78-
commonjs({
79-
esmExternals: true
80-
}),
81-
]),
82-
],
83-
external: ["better-sqlite3", "@types/better-sqlite3", "fsevents"],
84-
}),
50+
/** @type {import("rollup").RollupOptions} */ ({
51+
input,
52+
treeshake: true,
53+
output: {
54+
dir,
55+
format: "es",
56+
sourcemap: true,
57+
exports: "named",
58+
...(!types && {
59+
entryFileNames: ({ name }) =>
60+
`[name].${executables[name] ? "mjs" : "js"}`,
61+
}),
62+
},
63+
plugins: [
64+
hashbang.default(),
65+
resolve({
66+
preferBuiltins: true,
67+
}),
68+
...(types
69+
? [
70+
dts({
71+
respectExternal: true,
72+
}),
73+
]
74+
: [
75+
esbuild({
76+
exclude: ["tests/**", "ux/**", "node_modules/**"],
77+
}),
78+
commonjs({
79+
esmExternals: true,
80+
}),
81+
]),
82+
],
83+
external: ["better-sqlite3", "@types/better-sqlite3", "fsevents"],
84+
}),
8585
);

packages/core/scripts/release.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ eexec({ dryrun: true })`git hook run pre-commit`;
7676

7777
exec`npm version ${positionals.length ? positionals.map(quoteArg).join(" ") : "prerelease"}`;
7878
const { version } = JSON.parse(readFileSync("./package.json", "utf-8"));
79-
exec({ cwd: '../favor' })`npm version ${version}`;
79+
exec({ cwd: "../favor" })`npm version ${version}`;
8080

8181
function quoteArg(arg) {
8282
return `'${arg.replace(/'/g, `'"'"'`)}'`;
@@ -109,7 +109,7 @@ console.log("\n\n--- building and publishing to registry ---");
109109

110110
eexec({ dryrun: true, cwd: resolve("../favor") })`npm install`;
111111
eexec({ dryrun: true, cwd: resolve("../favor") })`npm run package`;
112-
eexec`npm publish${env.REGISTRY ? ` --registry="${env.REGISTRY}"` : ''}`;
112+
eexec`npm publish${env.REGISTRY ? ` --registry="${env.REGISTRY}"` : ""}`;
113113

114114
console.log("\n\n--- commiting version updates ---");
115115

packages/core/src/core/pardon.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,11 @@ export const PardonFetchExecution = pardonExecution({
342342
return {
343343
request: {
344344
...rendered.output,
345-
values: cleanRequestValues(getContextualValues(rendered.context, {
346-
secrets: true,
347-
})),
345+
values: cleanRequestValues(
346+
getContextualValues(rendered.context, {
347+
secrets: true,
348+
}),
349+
),
348350
} satisfies RequestObject,
349351
redacted: {
350352
...redacted.output,
@@ -464,7 +466,9 @@ export const PardonFetchExecution = pardonExecution({
464466
return {
465467
output,
466468
scope: context.scope,
467-
values: cleanResponseValues(getContextualValues(context, { secrets })),
469+
values: cleanResponseValues(
470+
getContextualValues(context, { secrets }),
471+
),
468472
};
469473
}),
470474
);
@@ -515,7 +519,7 @@ function cleanRequestValues(request: Record<string, unknown>) {
515519
pathname: undefined,
516520
origin: undefined,
517521
search: undefined,
518-
method: undefined
522+
method: undefined,
519523
} as Record<string, unknown>);
520524
}
521525

packages/core/src/core/schema/core/schema-ops.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export function maybeResolve<T>(
5050
context: SchemaContext<T>,
5151
): T | undefined {
5252
const { resolve } = exposeSchema<SchemaOps<T>>(schema);
53-
return resolve?.(context) ?? (context.mode === 'match' ? context.template as T : undefined);
53+
return (
54+
resolve?.(context) ??
55+
(context.mode === "match" ? (context.template as T) : undefined)
56+
);
5457
}
5558

5659
// ---- internal utility types ----

packages/core/src/core/schema/definition/scalar.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ export function convertScalar(
4242
case "null":
4343
return value === "null" ? null : undefined;
4444
case "boolean":
45-
return value === "false" ? false : Boolean(value);
45+
return value === "false"
46+
? false
47+
: value === "true"
48+
? true
49+
: typeof value === "boolean" || typeof value === "string"
50+
? value
51+
: Boolean(value);
4652
case "number":
4753
if (value && value instanceof Number) {
4854
return value;
@@ -52,7 +58,7 @@ export function convertScalar(
5258
return createNumber(value["source"]);
5359
}
5460

55-
if (typeof value === 'string' && !isValidNumberToken(value)) {
61+
if (typeof value === "string" && !isValidNumberToken(value)) {
5662
return value;
5763
}
5864

@@ -68,6 +74,10 @@ export function convertScalar(
6874
return value;
6975
}
7076

77+
if (typeof value === "string" && !isValidNumberToken(value)) {
78+
return value;
79+
}
80+
7181
return value !== undefined
7282
? unboxed
7383
? BigInt(String(value))

packages/core/src/entry/main/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ${YAML.stringify({
142142

143143
if (options.timing) {
144144
const context = await rendering.context;
145-
console.warn('-- timing\n' + KV.stringify(context.durations, "\n", 2));
145+
console.warn("-- timing\n" + KV.stringify(context.durations, "\n", 2));
146146
}
147147
} else {
148148
const {
@@ -170,7 +170,7 @@ ${YAML.stringify({
170170

171171
if (options.timing) {
172172
const context = await rendering.context;
173-
console.warn('-- timing\n' + KV.stringify(context.durations, "\n", 2));
173+
console.warn("-- timing\n" + KV.stringify(context.durations, "\n", 2));
174174
}
175175
}
176176

packages/core/src/entry/main/cli/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ export function opts() {
100100
},
101101
timing: {
102102
short: "T",
103-
type: "boolean"
104-
}
103+
type: "boolean",
104+
},
105105
},
106106
});
107107
}

packages/core/src/entry/testing/cli/runner.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export type TestPlanning = {
6161
cases: TestSetup[];
6262
patterns?: RegExp[];
6363
antipatterns?: RegExp[];
64-
}
64+
};
6565

6666
const inflight = new AsyncLocalStorage<{
6767
scheduled: Promise<unknown>[];
@@ -667,7 +667,11 @@ export async function loadTests(
667667
const trialRegistry = await flushTrialRegistry(configuration);
668668

669669
return {
670-
async testplanner(testenv: Record<string, unknown>, smokeConfig?: SmokeConfig, ...filter: string[]) {
670+
async testplanner(
671+
testenv: Record<string, unknown>,
672+
smokeConfig?: SmokeConfig,
673+
...filter: string[]
674+
) {
671675
const alltestcases = describeCases(
672676
configuration.closing || (() => {}),
673677
trialRegistry.flatMap(({ descriptions }) => {
@@ -732,7 +736,11 @@ export async function loadTests(
732736
};
733737
}
734738

735-
export function filterTestPlanning({ cases, patterns, antipatterns }: TestPlanning): TestSetup[] {
739+
export function filterTestPlanning({
740+
cases,
741+
patterns,
742+
antipatterns,
743+
}: TestPlanning): TestSetup[] {
736744
return cases.filter(
737745
({ testcase }) =>
738746
!patterns?.length ||

0 commit comments

Comments
 (0)