From 9a86e3b5e68dbd2e81671755a632b75c0ac707c5 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 30 May 2024 06:37:17 -0700 Subject: [PATCH] chore: linting and formatting on a per-package basis (#11834) --- .prettierignore | 43 ----------------------------- package.json | 4 +-- packages/svelte/.prettierignore | 22 +++++++++++++++ packages/svelte/package.json | 2 ++ playgrounds/demo/.prettierignore | 1 + playgrounds/demo/package.json | 4 ++- playgrounds/sandbox/.prettierignore | 2 ++ playgrounds/sandbox/package.json | 4 +++ sites/svelte-5-preview/package.json | 4 ++- sites/svelte.dev/.prettierignore | 7 +++++ sites/svelte.dev/package.json | 5 ++-- 11 files changed, 49 insertions(+), 49 deletions(-) create mode 100644 packages/svelte/.prettierignore create mode 100644 playgrounds/demo/.prettierignore create mode 100644 playgrounds/sandbox/.prettierignore create mode 100644 sites/svelte.dev/.prettierignore diff --git a/.prettierignore b/.prettierignore index 0567f05cd8..63fb88fde7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,46 +1,3 @@ -packages/**/dist/*.js -packages/**/build/*.js -packages/**/npm/**/* -packages/**/config/*.js -packages/svelte/messages/**/*.md -packages/svelte/src/compiler/errors.js -packages/svelte/src/compiler/warnings.js -packages/svelte/src/internal/client/errors.js -packages/svelte/src/internal/client/warnings.js -packages/svelte/src/internal/shared/errors.js -packages/svelte/src/internal/shared/warnings.js -packages/svelte/src/internal/server/errors.js -packages/svelte/tests/**/*.svelte -packages/svelte/tests/**/_expected* -packages/svelte/tests/**/_actual* -packages/svelte/tests/**/expected* -packages/svelte/tests/**/_output -packages/svelte/tests/**/shards/*.test.js -packages/svelte/tests/hydration/samples/*/_expected.html -packages/svelte/tests/hydration/samples/*/_override.html -packages/svelte/types -packages/svelte/compiler/index.js -playgrounds/demo/src -playgrounds/sandbox/input/**.svelte -playgrounds/sandbox/output - -sites/svelte.dev/static/svelte-app.json -sites/svelte.dev/scripts/svelte-app/ -sites/svelte.dev/src/routes/_components/Supporters/contributors.jpg -sites/svelte.dev/src/routes/_components/Supporters/contributors.js -sites/svelte.dev/src/routes/_components/Supporters/donors.jpg -sites/svelte.dev/src/routes/_components/Supporters/donors.js -sites/svelte.dev/src/lib/generated - -**/node_modules -**/.svelte-kit -**/.vercel -.github/CODEOWNERS -.prettierignore -.changeset -pnpm-lock.yaml -pnpm-workspace.yaml - # Temporarily ignore this file to avoid merge conflicts. # see: https://github.com/sveltejs/svelte/pull/9609 documentation/docs/05-misc/03-typescript.md diff --git a/package.json b/package.json index 0159474d3b..40e1f1f47f 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "build:sites": "pnpm -r --filter=./sites/* build", "preview-site": "npm run build --prefix sites/svelte-5-preview", "check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check", - "format": "prettier --write .", - "lint": "prettier --check . && eslint", + "lint": "pnpm -r lint && prettier --check documentation", + "format": "pnpm -r format && prettier --check --write documentation", "test": "vitest run", "test-output": "vitest run --coverage --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json", "changeset:version": "changeset version && pnpm -r generate:version && git add --all", diff --git a/packages/svelte/.prettierignore b/packages/svelte/.prettierignore new file mode 100644 index 0000000000..c9c002f671 --- /dev/null +++ b/packages/svelte/.prettierignore @@ -0,0 +1,22 @@ +dist/*.js +build/*.js +npm/**/* +config/*.js +messages/**/*.md +src/compiler/errors.js +src/compiler/warnings.js +src/internal/client/errors.js +src/internal/client/warnings.js +src/internal/shared/errors.js +src/internal/shared/warnings.js +src/internal/server/errors.js +tests/**/*.svelte +tests/**/_expected* +tests/**/_actual* +tests/**/expected* +tests/**/_output +tests/**/shards/*.test.js +tests/hydration/samples/*/_expected.html +tests/hydration/samples/*/_override.html +types +compiler/index.js diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 5b13ffcb5c..4445a731ae 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -106,6 +106,8 @@ "generate:version": "node ./scripts/generate-version.js", "generate:types": "node ./scripts/generate-types.js && tsc -p tsconfig.generated.json", "prepublishOnly": "pnpm build", + "format": "prettier --check --write .", + "lint": "prettier --check . && eslint", "knip": "knip" }, "devDependencies": { diff --git a/playgrounds/demo/.prettierignore b/playgrounds/demo/.prettierignore new file mode 100644 index 0000000000..85de9cf933 --- /dev/null +++ b/playgrounds/demo/.prettierignore @@ -0,0 +1 @@ +src diff --git a/playgrounds/demo/package.json b/playgrounds/demo/package.json index e96e8011ba..cc2739cb68 100644 --- a/playgrounds/demo/package.json +++ b/playgrounds/demo/package.json @@ -9,7 +9,9 @@ "ssr": "node ./server.js", "build": "vite build --outDir dist/client && vite build --outDir dist/server --ssr src/entry-server.ts", "prod": "npm run build && node dist", - "preview": "vite preview" + "preview": "vite preview", + "format": "prettier --check --write .", + "lint": "prettier --check . && eslint" }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^3.1.0", diff --git a/playgrounds/sandbox/.prettierignore b/playgrounds/sandbox/.prettierignore new file mode 100644 index 0000000000..d26c5ef7f9 --- /dev/null +++ b/playgrounds/sandbox/.prettierignore @@ -0,0 +1,2 @@ +input/**.svelte +output diff --git a/playgrounds/sandbox/package.json b/playgrounds/sandbox/package.json index 13cd2eb011..235024958f 100644 --- a/playgrounds/sandbox/package.json +++ b/playgrounds/sandbox/package.json @@ -4,6 +4,10 @@ "type": "module", "license": "MIT", "version": "0.0.1", + "scripts": { + "format": "prettier --check --write .", + "lint": "prettier --check . && eslint" + }, "dependencies": { "@types/minimist": "^1.2.5", "minimist": "^1.2.8", diff --git a/sites/svelte-5-preview/package.json b/sites/svelte-5-preview/package.json index 21cff1eb07..9b5121ea65 100644 --- a/sites/svelte-5-preview/package.json +++ b/sites/svelte-5-preview/package.json @@ -9,7 +9,9 @@ "build": "vite build", "preview": "vite preview", "check-disable-tmp": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch" + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", + "format": "prettier --check --write .", + "lint": "prettier --check ." }, "devDependencies": { "@fontsource/fira-mono": "^5.0.8", diff --git a/sites/svelte.dev/.prettierignore b/sites/svelte.dev/.prettierignore new file mode 100644 index 0000000000..fe1ae74216 --- /dev/null +++ b/sites/svelte.dev/.prettierignore @@ -0,0 +1,7 @@ +static/svelte-app.json +scripts/svelte-app/ +src/routes/_components/Supporters/contributors.jpg +src/routes/_components/Supporters/contributors.js +src/routes/_components/Supporters/donors.jpg +src/routes/_components/Supporters/donors.js +src/lib/generated diff --git a/sites/svelte.dev/package.json b/sites/svelte.dev/package.json index 62e0202006..74e2c15fb0 100644 --- a/sites/svelte.dev/package.json +++ b/sites/svelte.dev/package.json @@ -13,8 +13,9 @@ "start": "node build", "check": "node scripts/update.js && pnpm generate && svelte-kit sync && svelte-check", "check:watch": "svelte-kit sync && svelte-check --watch", - "format": "prettier --check . --write", - "check:format": "prettier --check ." + "check:format": "prettier --check .", + "format": "prettier --check --write .", + "lint": "prettier --check ." }, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15",