Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .eslint/kit-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import noRuntimeToExportsImports from './no-runtime-to-exports-imports.js';

/** @type {import('eslint').ESLint.Plugin} */
export default {
meta: {
name: 'kit-custom'
},
rules: {
'no-runtime-to-exports-imports': noRuntimeToExportsImports
}
};
11 changes: 11 additions & 0 deletions .eslint/kit-node-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import requirePathToFileURL from './require-path-to-file-url.js';

/** @type {import('eslint').ESLint.Plugin} */
export default {
meta: {
name: 'kit-node-custom'
},
rules: {
'require-path-to-file-url': requirePathToFileURL
}
};
7 changes: 7 additions & 0 deletions .eslint/require-path-to-file-url.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'node:path';

/**
* @type {import('eslint').Rule.RuleModule}
*/
Expand All @@ -15,6 +17,11 @@ export default {
},

create(context) {
// the client runtime's dynamic imports are resolved by Vite, not Node
if (context.filename.includes(path.join('packages', 'kit', 'src', 'runtime'))) {
return {};
}

/**
* Returns true if the expression is safe to pass to `import()`:
* a static specifier, a relative computed specifier, or a value
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
id: logs
attributes:
label: Logs
description: "Please include browser console and server logs around the time this bug occurred. Please try not to insert an image but copy paste the log text."
description: 'Please include browser console and server logs around the time this bug occurred. Please try not to insert an image but copy paste the log text.'
render: Shell
- type: textarea
id: system-info
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Feature Request"
name: 'Feature Request'
description: Suggest an idea for this project
body:
- type: markdown
Expand Down
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ closes #<!-- Add the related issue number here. Repeat this line for each additi
---

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [ ] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests

- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets

- [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.

### Edits
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: audit

on:
schedule:
- cron: "0 5 * * *" # daily 5AM
- cron: '0 5 * * *' # daily 5AM

env:
# not needed for audit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/autofix-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# the sha the comment was made on, so a branch updated after the comment isn't run
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || steps.pr.outputs.sha }}
- uses: ./.github/actions/node-setup
- name: Run prettier
- name: Run oxfmt
run: pnpm format
- name: Generate types
run: pnpm -F @sveltejs/kit generate:types
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: setup overrides for matrix.vite
if: matrix.vite != 'current'
run:
| # copies catalogs.vite-xxx to overrides in pnpm-workspace.yaml so the subsequent `pnpm install` enforces them
run: | # copies catalogs.vite-xxx to overrides in pnpm-workspace.yaml so the subsequent `pnpm install` enforces them
yq -i '.overrides =.catalogs."vite-${{ matrix.vite }}"' pnpm-workspace.yaml
pnpm install --no-frozen-lockfile
git checkout pnpm-lock.yaml pnpm-workspace.yaml # revert changes to pnpm files to avoid cache key changes
Expand Down
43 changes: 43 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"sortPackageJson": false,
"svelte": {},
"overrides": [
{
"files": ["packages/*/README.md"],
"options": {
"useTabs": false,
"tabWidth": 2
}
}
],
"ignorePatterns": [
"documentation/**/*.md",
"packages/*/test/**/build/**",
"packages/adapter-cloudflare/test/apps/workers/dist/**",
"packages/enhanced-img/test/Output.svelte",
"packages/kit/src/core/postbuild/fixtures/**",
"packages/kit/src/runtime/components/svelte-5/layout.svelte",
"packages/kit/test/apps/basics/test/errors.json",
"packages/kit/test/build-errors/**",
"packages/kit/types",
"packages/package/test/fixtures/**",
"packages/package/test/watch/**",
"**/CHANGELOG.md",
"**/vite.config.js.timestamp-*",
"**/node_modules",
"**/.custom-out-dir",
"**/.netlify",
"**/.svelte-kit",
"**/.vercel",
"**/.wrangler",
"**/test-results",
".changeset",
"pnpm-lock.yaml",
"pnpm-workspace.yaml"
]
}
228 changes: 228 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn"],
"jsPlugins": ["eslint-plugin-n"],
"categories": {
"correctness": "off"
},
"options": {
"typeAware": true
},
"env": {
"builtin": true,
"browser": true,
"node": true
},
"ignorePatterns": [
"**/.svelte-kit",
"**/.netlify",
"**/.vercel",
"**/.wrangler",
"**/test-results",
"**/dist",
"**/.custom-out-dir",
"packages/adapter-node/files",
"packages/kit/src/core/config/fixtures/multiple",
"packages/kit/src/core/sync/create_manifest_data/test/samples/**/*",
"packages/kit/src/core/sync/write_types/test/*/**/*",
"packages/kit/types/index.d.ts",
"packages/*/test/apps/**/*",
"packages/*/test/**/build/**",
"packages/kit/test/build-errors/**/*",
"packages/kit/test/prerendering/**/*",
"packages/kit/test/types/**/*",
"packages/test-redirect-importer/index.js",
"packages/package/test/errors/**/*",
"packages/package/test/fixtures/**/*",
"packages/package/test/watch/**/*",
"packages/adapter-node/smoke.spec_disabled.js"
],
"rules": {
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-array-constructor": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-properties": [
"error",
{
"object": "test",
"property": "only",
"message": "Do not check in test.only tests."
}
],
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-this-before-super": "error",
"no-unassigned-vars": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-var": "error",
"no-with": "error",
"object-shorthand": ["error", "always"],
"prefer-arrow-callback": "error",
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"n/prefer-global/process": ["error", "never"],
"n/prefer-node-protocol": "error",
"typescript/array-type": [
"error",
{
"default": "array-simple"
}
],
"typescript/await-thenable": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-floating-promises": "error",
"typescript/no-misused-new": "error",
"typescript/no-misused-promises": [
"error",
{
"checksVoidReturn": {
"arguments": false,
"properties": false
}
}
],
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/require-await": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-with": "off",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
},
{
"files": ["packages/kit/src/runtime/**/*.js"],
"jsPlugins": [
{
"name": "kit-custom",
"specifier": "./.eslint/kit-custom.js"
}
],
"rules": {
"kit-custom/no-runtime-to-exports-imports": "error"
}
},
{
"files": [
"packages/kit/src/**/*.js",
"packages/adapter-*/*.js",
"packages/adapter-*/src/**/*.js",
"packages/package/src/**/*.js"
],
"jsPlugins": [
{
"name": "kit-node-custom",
"specifier": "./.eslint/kit-node-custom.js"
}
],
"rules": {
"kit-node-custom/require-path-to-file-url": "error"
}
}
]
}
Loading
Loading