Skip to content

Commit

Permalink
chore: upgrade to prettier 3.1.1 (#11304)
Browse files Browse the repository at this point in the history
* chore: upgrade to prettier 3.1.1

* regenerate types
  • Loading branch information
benmccann authored Dec 14, 2023
1 parent 9ae5943 commit a3c4ddb
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-rats-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-svelte": patch
---

chore: upgrade to prettier 3.1.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-plugin-svelte": "^2.31.0",
"eslint-plugin-unicorn": "^49.0.0",
"playwright": "1.30.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"rollup": "^3.29.4",
"svelte": "^4.2.7",
"typescript": "^4.9.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function (options) {
has_param_routes
? '(routes with parameters are not part of entry points by default)'
: ''
} — see https://kit.svelte.dev/docs/configuration#prerender for more info.`
} — see https://kit.svelte.dev/docs/configuration#prerender for more info.`
: '';

builder.log.error(
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@playwright/test": "1.30.0",
"@types/gitignore-parser": "^0.0.2",
"gitignore-parser": "^0.0.2",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.0.0",
"sucrase": "^3.29.0",
"svelte": "^4.2.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"eslint-config-prettier": "^9.0.0"
"eslint-config-prettier": "^9.1.0"
},
"scripts": {
"lint": "prettier --check . && eslint .",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-svelte/shared/+prettier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^3.0.0"
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2"
}
}
2 changes: 1 addition & 1 deletion packages/kit/src/core/adapt/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async function compress_file(file, format = 'gz') {
[zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: statSync(file).size
}
})
})
: zlib.createGzip({ level: zlib.constants.Z_BEST_COMPRESSION });

const source = createReadStream(file);
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/core/sync/write_tsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ function validate_user_config(kit, cwd, out, config) {
typeof extend === 'string'
? path.resolve(cwd, extend) === out
: Array.isArray(extend)
? extend.some((e) => path.resolve(cwd, e) === out)
: false;
? extend.some((e) => path.resolve(cwd, e) === out)
: false;

const options = config.options.compilerOptions || {};

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/hooks/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function sequence(...handlers) {
transformPageChunk,
filterSerializedResponseHeaders,
preload
})
})
: resolve(event, { transformPageChunk, filterSerializedResponseHeaders, preload });
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export async function setResponse(res, response) {
? set_cookie_parser.splitCookiesString(
// This is absurd but necessary, TODO: investigate why
/** @type {string}*/ (response.headers.get(key))
)
)
: value
);
} catch (error) {
Expand Down
14 changes: 7 additions & 7 deletions packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export interface Adapter {
type AwaitedPropertiesUnion<input extends Record<string, any> | void> = input extends void
? undefined // needs to be undefined, because void will break intellisense
: input extends Record<string, any>
? {
? {
[key in keyof input]: Awaited<input[key]>;
}
: {} extends input // handles the any case
? input
: unknown;
}
: {} extends input // handles the any case
? input
: unknown;

export type AwaitedProperties<input extends Record<string, any> | void> =
AwaitedPropertiesUnion<input> extends Record<string, any>
Expand All @@ -70,8 +70,8 @@ type OptionalUnion<
type UnpackValidationError<T> = T extends ActionFailure<infer X>
? X
: T extends void
? undefined // needs to be undefined, because void will corrupt union type
: T;
? undefined // needs to be undefined, because void will corrupt union type
: T;

/**
* This object is passed to the `adapt` function of adapters.
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export async function dev(vite, vite_config, svelte_config) {
? async () => {
const url = path.resolve(cwd, endpoint.file);
return await loud_ssr_load_module(url);
}
}
: null,
endpoint_id: endpoint?.file
};
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/vite/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const mutable = (dir) =>
? sirv(dir, {
etag: true,
maxAge: 0
})
})
: (_req, _res, next) => next();

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,10 @@ export function create_client(app, target) {
typeof data !== 'object'
? `a ${typeof data}`
: data instanceof Response
? 'a Response object'
: Array.isArray(data)
? 'an array'
: 'a non-plain object'
? 'a Response object'
: Array.isArray(data)
? 'an array'
: 'a non-plain object'
}, but must return a plain object at the top level (i.e. \`return {...}\`)`
);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/kit/src/runtime/server/page/load_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ function validate_load_response(data, id) {
typeof data !== 'object'
? `a ${typeof data}`
: data instanceof Response
? 'a Response object'
: Array.isArray(data)
? 'an array'
: 'a non-plain object'
? 'a Response object'
: Array.isArray(data)
? 'an array'
: 'a non-plain object'
}, but must return a plain object at the top level (i.e. \`return {...}\`)`
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export async function render_response({
? text(transformed, {
status,
headers
})
})
: new Response(
new ReadableStream({
async start(controller) {
Expand All @@ -485,7 +485,7 @@ export async function render_response({
'content-type': 'text/html'
}
}
);
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ export async function respond(request, options, manifest, state) {
const response = is_data_request
? redirect_json_response(e)
: route?.page && is_action_json_request(event)
? action_json_redirect(e)
: redirect_response(e.status, e.location);
? action_json_redirect(e)
: redirect_response(e.status, e.location);
add_cookies_to_headers(response.headers, Object.values(cookies_to_add));
return response;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/utils/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function parse_route_id(id) {
return '/' + result;
})
.join('')}/?$`
);
);

return { pattern, params };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export const config = {
? [
['dot'],
[path.resolve(fileURLToPath(import.meta.url), '../github-flaky-warning-reporter.js')]
]
]
: 'list',
testDir: 'test',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
Expand Down
14 changes: 7 additions & 7 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ declare module '@sveltejs/kit' {
type AwaitedPropertiesUnion<input extends Record<string, any> | void> = input extends void
? undefined // needs to be undefined, because void will break intellisense
: input extends Record<string, any>
? {
? {
[key in keyof input]: Awaited<input[key]>;
}
: {} extends input // handles the any case
? input
: unknown;
}
: {} extends input // handles the any case
? input
: unknown;

export type AwaitedProperties<input extends Record<string, any> | void> =
AwaitedPropertiesUnion<input> extends Record<string, any>
Expand All @@ -50,8 +50,8 @@ declare module '@sveltejs/kit' {
type UnpackValidationError<T> = T extends ActionFailure<infer X>
? X
: T extends void
? undefined // needs to be undefined, because void will corrupt union type
: T;
? undefined // needs to be undefined, because void will corrupt union type
: T;

/**
* This object is passed to the `adapt` function of adapters.
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/node": "^16.18.6",
"@types/prompts": "^2.4.1",
"@types/semver": "^7.5.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"vitest": "^0.34.5"
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions packages/package/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ export function analyze(file, extensions) {
const dest = svelte_extension
? name.slice(0, -svelte_extension.length) + '.svelte'
: name.endsWith('.d.ts')
? name
: name.endsWith('.ts')
? name.slice(0, -3) + '.js'
: name;
? name
: name.endsWith('.ts')
? name.slice(0, -3) + '.js'
: name;

return {
name,
Expand Down
Loading

0 comments on commit a3c4ddb

Please sign in to comment.