Skip to content

Commit 82d4b5e

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

22 files changed

+171
-123
lines changed

.vscode/settings.json

+4
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

+14-11
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

+35-35
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

+2-2
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

+9-5
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

+4-1
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

+12-2
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

+2-2
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

+2-2
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

+11-3
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 ||

packages/core/src/modules/running.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
99
OF ANY KIND, either express or implied. See the License for the specific language
1010
governing permissions and limitations under the License.
1111
*/
12-
export { loadTests, executeTest, filterTestPlanning } from "../entry/testing/cli/runner.js";
12+
export {
13+
loadTests,
14+
executeTest,
15+
filterTestPlanning,
16+
} from "../entry/testing/cli/runner.js";
1317
export { initTrackingEnvironment } from "../runtime/environment.js";
1418
export { sequenceRegistry } from "../entry/testing/sequence.js";
1519

packages/docs/astro.config.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import solid from "@astrojs/solid-js";
2020
// https://astro.build/config
2121
export default defineConfig({
2222
site: process.env.SITE_ORIGIN,
23-
base: process.env.SITE_ROOT ?? '/',
23+
base: process.env.SITE_ROOT ?? "/",
2424
output: "static",
2525
integrations: [
2626
starlight({
@@ -100,7 +100,7 @@ export default defineConfig({
100100
],
101101
components: {
102102
PageFrame: "@components/starlight/PageFrame.astro",
103-
Footer: "@components/starlight/Footer.astro"
103+
Footer: "@components/starlight/Footer.astro",
104104
},
105105
}),
106106
solid(),

packages/docs/eslint.config.mjs

+17-14
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default [
5151
destructuring: "all",
5252
},
5353
],
54-
}
54+
},
5555
},
5656
{
5757
files: ["**/*.cjs"],
@@ -69,14 +69,14 @@ export default [
6969
)
7070
.map((config) => ({
7171
...config,
72-
files: ["**/*.ts"]
72+
files: ["**/*.ts"],
7373
})),
7474
{
7575
files: ["**/*.ts"],
7676

7777
plugins: {
7878
"@typescript-eslint": typescriptEslint,
79-
"headers": headersEslint
79+
headers: headersEslint,
8080
},
8181

8282
languageOptions: {
@@ -90,23 +90,26 @@ export default [
9090
"error",
9191
{
9292
ignoreRestSiblings: true,
93-
"argsIgnorePattern": "^_",
93+
argsIgnorePattern: "^_",
9494
},
9595
],
9696

9797
"headers/header-format": [
9898
"error",
9999
{
100-
"source": "string",
101-
"linePrefix": "",
102-
"blockPrefix": "\n",
103-
"blockSuffix": "\n",
104-
"content": readFileSync(path.join(__dirname, "../../.license-header"), 'utf-8').trim(),
105-
"variables": {
106-
"year": `${new Date().getFullYear()}`,
107-
}
108-
}
109-
]
100+
source: "string",
101+
linePrefix: "",
102+
blockPrefix: "\n",
103+
blockSuffix: "\n",
104+
content: readFileSync(
105+
path.join(__dirname, "../../.license-header"),
106+
"utf-8",
107+
).trim(),
108+
variables: {
109+
year: `${new Date().getFullYear()}`,
110+
},
111+
},
112+
],
110113
},
111114
},
112115
];

packages/docs/src/components/CollectionLinkCard.astro

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ if (typeof href === "string" && /^[/]/.test(href)) {
3636
const entry = await getEntry(resolvedCollection, href.slice(1));
3737
3838
data = entry?.data;
39-
href = (import.meta.env.BASE_URL) + href.slice(import.meta.env.BASE_URL.endsWith('/') ? 1 : 0);
39+
href =
40+
import.meta.env.BASE_URL +
41+
href.slice(import.meta.env.BASE_URL.endsWith("/") ? 1 : 0);
4042
}
4143
---
4244

0 commit comments

Comments
 (0)