diff --git a/.changeset/config.json b/.changeset/config.json index 78f066bcad..35736f64d3 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -5,7 +5,7 @@ "fixed": [], "linked": [], "access": "public", - "baseBranch": "svelte-4", + "baseBranch": "svelte-5", "bumpVersionsWithWorkspaceProtocolOnly": true, "ignore": ["!(@sveltejs/*|svelte)"] } diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..fbab8fbc0d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,23 @@ +# NOTE: In general this should be kept in sync with .eslintignore + +**/dist/** +**/config/** +**/build/** +**/playgrounds/sandbox/** +**/npm/** +**/*.js.flow +**/*.d.ts +**/playwright*/** +**/vite.config.js +**/vite.prod.config.js +**/node_modules + +**/tests/** + +# documentation can contain invalid examples +documentation/** + +# contains a fork of the REPL which doesn't adhere to eslint rules +sites/svelte-5-preview/** +# Wasn't checked previously, reenable at some point +sites/svelte.dev/** diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000000..e161e50ef1 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,54 @@ +module.exports = { + extends: ['@sveltejs'], + + // TODO: add runes to eslint-plugin-svelte + globals: { + $state: true, + $derived: true, + $effect: true, + $props: true + }, + + overrides: [ + { + // scripts and playground should be console logging so don't lint against them + files: ['playgrounds/**/*', 'scripts/**/*'], + rules: { + 'no-console': 'off' + } + }, + { + // the playgrounds can use public naming conventions since they're examples + files: ['playgrounds/**/*'], + rules: { + 'lube/svelte-naming-convention': 'off' + } + }, + { + files: ['packages/svelte/src/compiler/**/*'], + rules: { + 'no-var': 'error' + } + } + ], + + plugins: ['lube'], + + rules: { + 'no-console': 'error', + 'lube/svelte-naming-convention': ['error', { fixSameNames: true }], + // eslint isn't that well-versed with JSDoc to know that `foo: /** @type{..} */ (foo)` isn't a violation of this rule, so turn it off + 'object-shorthand': 'off', + 'no-var': 'off', + + // TODO: enable these rules and run `pnpm lint:fix` + // skipping that for now so as to avoid impacting real work + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'prefer-const': 'off', + 'svelte/valid-compile': 'off', + quotes: 'off' + } +}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2eb842967a..3a6f994de1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI on: push: - branches: [svelte-4] + branches: [svelte-5] pull_request: permissions: contents: read # to fetch code (actions/checkout) diff --git a/.github/workflows/ecosystem-ci-trigger.yml b/.github/workflows/ecosystem-ci-trigger.yml index 952f83a861..ce7bf04136 100644 --- a/.github/workflows/ecosystem-ci-trigger.yml +++ b/.github/workflows/ecosystem-ci-trigger.yml @@ -61,11 +61,11 @@ jobs: repo: pr.head.repo.full_name } - id: generate-token - uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 #keep pinned for security reasons, currently 1.8.0 + uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 #keep pinned for security reasons, currently 1.8.0 with: app_id: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_ID }} private_key: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_PRIVATE_KEY }} - repository: "${{ github.repository_owner }}/svelte-ecosystem-ci" + repository: '${{ github.repository_owner }}/svelte-ecosystem-ci' - uses: actions/github-script@v6 id: trigger env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 999f04d80c..f6b82c64df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: branches: - - svelte-4 + - svelte-5 permissions: {} jobs: diff --git a/.gitignore b/.gitignore index cc2e05ea5f..7026f39607 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,27 @@ +# Dependency directories +node_modules/ + +# IDE related .idea -.DS_Store .vscode/* !.vscode/launch.json -node_modules + +# Test coverage +coverage +*.lcov + +# Optional eslint cache .eslintcache + +# dotenv environment variables file +.env +.env.test + +# build output +dist +.vercel + +# OS-specific +.DS_Store + +tmp diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..e7914ff487 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,30 @@ +# NOTE: In general this should be kept in sync with .eslintignore + +packages/**/dist/*.js +packages/**/build/*.js +packages/**/npm/**/* +packages/**/config/*.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/*/_before.html +packages/svelte/tests/hydration/samples/*/_before_head.html +packages/svelte/tests/hydration/samples/*/_after.html +packages/svelte/tests/hydration/samples/*/_after_head.html +packages/svelte/types +packages/svelte/compiler.cjs +playgrounds/demo/src +playgrounds/sandbox/input/**.svelte +playgrounds/sandbox/output +**/*.md +**/node_modules +**/.svelte-kit +flow-typed +.github/CODEOWNERS +.prettierignore +.eslintignore +pnpm-lock.yaml +pnpm-workspace.yaml diff --git a/.prettierrc b/.prettierrc index 0ea7a0b1e9..c2d09a4289 100644 --- a/.prettierrc +++ b/.prettierrc @@ -18,6 +18,5 @@ "tabWidth": 2 } } - ], - "pluginSearchDirs": ["."] + ] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 2e22a5ab9b..095d9c57a2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,7 +14,7 @@ "name": "Playground: Server", "outputCapture": "std", "program": "start.js", - "cwd": "${workspaceFolder}/packages/playground", + "cwd": "${workspaceFolder}/playgrounds/demo", "cascadeTerminateToConfigurations": ["Playground: Browser"] } ], diff --git a/documentation/examples/06-lifecycle/02-update/App.svelte b/documentation/examples/06-lifecycle/02-update/App.svelte index ac23335899..afc1b29ea8 100644 --- a/documentation/examples/06-lifecycle/02-update/App.svelte +++ b/documentation/examples/06-lifecycle/02-update/App.svelte @@ -31,22 +31,28 @@ const reply = eliza.transform(text); - setTimeout(() => { - comments = comments.concat({ - author: 'eliza', - text: '...', - placeholder: true - }); - - setTimeout(() => { - comments = comments - .filter((comment) => !comment.placeholder) - .concat({ - author: 'eliza', - text: reply - }); - }, 500 + Math.random() * 500); - }, 200 + Math.random() * 200); + setTimeout( + () => { + comments = comments.concat({ + author: 'eliza', + text: '...', + placeholder: true + }); + + setTimeout( + () => { + comments = comments + .filter((comment) => !comment.placeholder) + .concat({ + author: 'eliza', + text: reply + }); + }, + 500 + Math.random() * 500 + ); + }, + 200 + Math.random() * 200 + ); } } diff --git a/documentation/examples/17-special-elements/00-svelte-self/Folder.svelte b/documentation/examples/17-special-elements/00-svelte-self/Folder.svelte index 543a7140d3..356263a91c 100644 --- a/documentation/examples/17-special-elements/00-svelte-self/Folder.svelte +++ b/documentation/examples/17-special-elements/00-svelte-self/Folder.svelte @@ -34,8 +34,8 @@ background-size: 1em 1em; font-weight: bold; cursor: pointer; - border:none; - font-size:14px; + border: none; + font-size: 14px; } .expanded { diff --git a/documentation/examples/21-miscellaneous/02-immutable-data/App.svelte b/documentation/examples/21-miscellaneous/02-immutable-data/App.svelte index 05d0820f9e..f43f3bb767 100644 --- a/documentation/examples/21-miscellaneous/02-immutable-data/App.svelte +++ b/documentation/examples/21-miscellaneous/02-immutable-data/App.svelte @@ -27,10 +27,10 @@