Skip to content

Commit c4b7215

Browse files
authored
chore: repo cleanup (#13029)
* chore: cleanup repo configs - remove prettier from packages, everything runs through the root now (also better aligns with how you work with it in VS Code: no more config duplication needed) - remove eslint from packages, run it once through the root now (revealed some inconsistencies and missing stuff, config tightened up as a result) (bump eslint while we're at it) * update vite and related packages (since rollup includes an addition to one estree node we need to adjust code a bit) * bump more packages * bump jsdom * lint
1 parent eebe427 commit c4b7215

File tree

32 files changed

+1081
-1171
lines changed

32 files changed

+1081
-1171
lines changed

.prettierignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# see: https://github.com/sveltejs/svelte/pull/9609
33
documentation/docs/05-misc/03-typescript.md
44

5-
# The following are all duplicated with prettierignore configs in the packages,
6-
# which is necessary because of https://github.com/prettier/prettier-vscode/issues/3424
75
packages/**/dist/*.js
86
packages/**/build/*.js
97
packages/**/npm/**/*
108
packages/**/config/*.js
9+
10+
# packages/svelte
1111
packages/svelte/messages/**/*.md
1212
packages/svelte/src/compiler/errors.js
1313
packages/svelte/src/compiler/warnings.js
@@ -17,6 +17,7 @@ packages/svelte/src/internal/shared/errors.js
1717
packages/svelte/src/internal/shared/warnings.js
1818
packages/svelte/src/internal/server/errors.js
1919
packages/svelte/tests/migrate/samples/*/output.svelte
20+
packages/svelte/tests/**/*.svelte
2021
packages/svelte/tests/**/_expected*
2122
packages/svelte/tests/**/_actual*
2223
packages/svelte/tests/**/expected*
@@ -29,6 +30,7 @@ packages/svelte/compiler/index.js
2930
playgrounds/sandbox/input/**.svelte
3031
playgrounds/sandbox/output
3132

33+
# sites/svelte.dev
3234
sites/svelte.dev/static/svelte-app.json
3335
sites/svelte.dev/scripts/svelte-app/
3436
sites/svelte.dev/src/routes/_components/Supporters/contributors.jpg

benchmarking/benchmarks/kairo/util.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
export function busy() {
3-
let a = 0;
4-
for (let i = 0; i < 1_00; i++) {
5-
a++;
6-
}
2+
let a = 0;
3+
for (let i = 0; i < 1_00; i++) {
4+
a++;
5+
}
76
}

eslint.config.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export default [
3939
{
4040
languageOptions: {
4141
parserOptions: {
42-
project: true
42+
projectService: true,
43+
tsconfigRootDir: import.meta.dirname
4344
}
4445
},
4546
plugins: {
@@ -64,10 +65,14 @@ export default [
6465
}
6566
},
6667
{
67-
files: ['playgrounds/**/*'],
68+
// If you get an error along the lines of "@typescript-eslint/await-thenable needs a project service configured", then that likely means
69+
// that eslint rules that need to be type-aware run through a Svelte file which seems unsupported at the moment. In that case, ensure that
70+
// these are excluded to run on Svelte files.
71+
files: ['**/*.svelte'],
6872
rules: {
69-
'lube/svelte-naming-convention': 'off',
70-
'no-console': 'off'
73+
'@typescript-eslint/await-thenable': 'off',
74+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
75+
'@typescript-eslint/require-await': 'off'
7176
}
7277
},
7378
{
@@ -87,6 +92,12 @@ export default [
8792
'packages/svelte/src/internal/client/warnings.js',
8893
'packages/svelte/src/internal/shared/warnings.js',
8994
'packages/svelte/compiler/index.js',
95+
// stuff we don't want to lint
96+
'benchmarking/**',
97+
'coverage/**',
98+
'playgrounds/sandbox/**',
99+
// exclude top level config files
100+
'*.config.js',
90101
// documentation can contain invalid examples
91102
'documentation',
92103
// contains a fork of the REPL which doesn't adhere to eslint rules

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"build:sites": "pnpm -r --filter=./sites/* build",
1919
"preview-site": "npm run build --prefix sites/svelte-5-preview",
2020
"check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check",
21-
"lint": "pnpm -r lint && prettier --check documentation",
22-
"format": "pnpm -r format && prettier --check --write documentation",
21+
"lint": "eslint && prettier --check .",
22+
"format": "prettier --write .",
2323
"test": "vitest run",
2424
"test-output": "vitest run --coverage --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json",
2525
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
@@ -33,18 +33,18 @@
3333
"@sveltejs/eslint-config": "^8.0.1",
3434
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
3535
"@types/node": "^20.11.5",
36-
"@vitest/coverage-v8": "^1.2.1",
37-
"eslint": "^9.6.0",
36+
"@vitest/coverage-v8": "^2.0.5",
37+
"eslint": "^9.9.1",
3838
"eslint-plugin-lube": "^0.4.3",
39-
"jsdom": "22.0.0",
40-
"playwright": "^1.41.1",
39+
"jsdom": "25.0.0",
40+
"playwright": "^1.46.1",
4141
"prettier": "^3.2.4",
4242
"prettier-plugin-svelte": "^3.1.2",
4343
"svelte": "workspace:^",
44-
"typescript": "^5.5.2",
45-
"typescript-eslint": "^8.0.0-alpha.34",
44+
"typescript": "^5.5.4",
45+
"typescript-eslint": "^8.2.0",
4646
"v8-natives": "^1.2.5",
47-
"vitest": "^1.2.1"
47+
"vitest": "^2.0.5"
4848
},
4949
"pnpm": {
5050
"overrides": {

packages/svelte/.prettierignore

-22
This file was deleted.

packages/svelte/package.json

+11-15
Original file line numberDiff line numberDiff line change
@@ -112,42 +112,38 @@
112112
"generate:version": "node ./scripts/generate-version.js",
113113
"generate:types": "node ./scripts/generate-types.js && tsc -p tsconfig.generated.json",
114114
"prepublishOnly": "pnpm build",
115-
"format": "prettier --check --write .",
116-
"lint": "prettier --check . && eslint",
117115
"knip": "pnpm dlx knip"
118116
},
119117
"devDependencies": {
120-
"@jridgewell/trace-mapping": "^0.3.22",
121-
"@playwright/test": "^1.35.1",
118+
"@jridgewell/trace-mapping": "^0.3.25",
119+
"@playwright/test": "^1.46.1",
122120
"@rollup/plugin-commonjs": "^25.0.7",
123121
"@rollup/plugin-node-resolve": "^15.2.3",
124122
"@rollup/plugin-terser": "^0.4.4",
125123
"@rollup/plugin-virtual": "^3.0.2",
126124
"@types/aria-query": "^5.0.4",
127125
"@types/node": "^20.11.5",
128126
"dts-buddy": "^0.5.1",
129-
"esbuild": "^0.19.11",
130-
"eslint": "^9.6.0",
131-
"prettier": "^3.2.4",
132-
"rollup": "^4.9.5",
127+
"esbuild": "^0.21.5",
128+
"rollup": "^4.21.0",
133129
"source-map": "^0.7.4",
134130
"tiny-glob": "^0.2.9",
135-
"typescript": "^5.5.2",
136-
"vitest": "^1.2.1"
131+
"typescript": "^5.5.4",
132+
"vitest": "^2.0.5"
137133
},
138134
"dependencies": {
139-
"@ampproject/remapping": "^2.2.1",
140-
"@jridgewell/sourcemap-codec": "^1.4.15",
135+
"@ampproject/remapping": "^2.3.0",
136+
"@jridgewell/sourcemap-codec": "^1.5.0",
141137
"@types/estree": "^1.0.5",
142-
"acorn": "^8.11.3",
138+
"acorn": "^8.12.1",
143139
"acorn-typescript": "^1.4.13",
144140
"aria-query": "^5.3.0",
145-
"axobject-query": "^4.0.0",
141+
"axobject-query": "^4.1.0",
146142
"esm-env": "^1.0.0",
147143
"esrap": "^1.2.2",
148144
"is-reference": "^3.0.2",
149145
"locate-character": "^3.0.0",
150-
"magic-string": "^0.30.5",
146+
"magic-string": "^0.30.11",
151147
"zimmerframe": "^1.1.2"
152148
}
153149
}

packages/svelte/src/compiler/utils/builders.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export function prop(kind, key, value, computed = false) {
352352
* @returns {ESTree.PropertyDefinition}
353353
*/
354354
export function prop_def(key, value, computed = false, is_static = false) {
355-
return { type: 'PropertyDefinition', key, value, computed, static: is_static };
355+
return { type: 'PropertyDefinition', key, value, computed, static: is_static, decorators: [] };
356356
}
357357

358358
/**
@@ -541,7 +541,8 @@ export function method(kind, key, params, body, computed = false, is_static = fa
541541
kind,
542542
value: function_builder(null, params, block(body)),
543543
computed,
544-
static: is_static
544+
static: is_static,
545+
decorators: []
545546
};
546547
}
547548

packages/svelte/src/compiler/utils/mapped_code.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_map_inp
328328
}
329329
}
330330
});
331-
return /** @type {SourceMap} */ (result_map);
331+
return /** @type {any} */ (result_map);
332332
}
333333
const regex_data_uri = /data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(\S*)/;
334334
// parse attached sourcemap in processed.code

packages/svelte/tests/preprocess/test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const { test, run } = suite<PreprocessTest>(async (config, cwd) => {
3030
expect(result.dependencies).toEqual(config.dependencies || []);
3131

3232
if (fs.existsSync(`${cwd}/expected_map.json`)) {
33+
delete (result.map as any).ignoreList;
3334
const expected_map = JSON.parse(fs.readFileSync(`${cwd}/expected_map.json`, 'utf-8'));
3435
// You can use https://sokra.github.io/source-map-visualization/#custom to visualize the source map
3536
expect(JSON.parse(JSON.stringify(result.map))).toEqual(expected_map);

packages/svelte/tests/runtime-legacy/samples/css-comments/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export default test({
66
const p = target.querySelector('p');
77
ok(p);
88

9-
assert.equal(window.getComputedStyle(p).color, 'red');
9+
assert.equal(window.getComputedStyle(p).color, 'rgb(255, 0, 0)');
1010
}
1111
});

packages/svelte/tests/runtime-legacy/samples/css-space-in-attribute/_config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export default test({
55
const [control, test] = target.querySelectorAll('p');
66

77
assert.equal(window.getComputedStyle(control).color, '');
8-
assert.equal(window.getComputedStyle(control).backgroundColor, '');
8+
assert.equal(window.getComputedStyle(control).backgroundColor, 'rgba(0, 0, 0, 0)');
99

10-
assert.equal(window.getComputedStyle(test).color, 'red');
11-
assert.equal(window.getComputedStyle(test).backgroundColor, 'black');
10+
assert.equal(window.getComputedStyle(test).color, 'rgb(255, 0, 0)');
11+
assert.equal(window.getComputedStyle(test).backgroundColor, 'rgb(0, 0, 0)');
1212
}
1313
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-and-style-attr-merged/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default test({
99
const p = target.querySelector('p');
1010
ok(p);
1111
const styles = window.getComputedStyle(p);
12-
assert.equal(styles.color, 'red');
12+
assert.equal(styles.color, 'rgb(255, 0, 0)');
1313
assert.equal(styles.height, '40px');
1414
}
1515
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-and-style-attr/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
const styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'red');
13+
assert.equal(styles.color, 'rgb(255, 0, 0)');
1414
assert.equal(styles.height, '40px');
1515
}
1616
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-multiple/_config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
let styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'red');
13+
assert.equal(styles.color, 'rgb(255, 0, 0)');
1414

1515
component.myColor = 'pink';
1616
component.width = '100vh';
@@ -22,7 +22,7 @@ export default test({
2222
target.innerHTML,
2323
'<p style="color: pink; width: 100vh; font-weight: 100; position: absolute;"></p>'
2424
);
25-
assert.equal(styles.color, 'pink');
25+
assert.equal(styles.color, 'rgb(255, 192, 203)');
2626
assert.equal(styles.width, '100vh');
2727
assert.equal(styles.fontWeight, '100');
2828
assert.equal(styles.position, 'absolute');

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-shorthand-declaration-only/_config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default test({
1111
test({ assert, target, window }) {
1212
const [p1, p2] = target.querySelectorAll('p');
1313

14-
assert.equal(window.getComputedStyle(p1).color, 'red');
15-
assert.equal(window.getComputedStyle(p2).color, 'red');
14+
assert.equal(window.getComputedStyle(p1).color, 'rgb(255, 0, 0)');
15+
assert.equal(window.getComputedStyle(p2).color, 'rgb(255, 0, 0)');
1616

1717
const btn = target.querySelector('button');
1818
btn?.click();
@@ -27,7 +27,7 @@ export default test({
2727
`
2828
);
2929

30-
assert.equal(window.getComputedStyle(p1).color, 'green');
31-
assert.equal(window.getComputedStyle(p2).color, 'green');
30+
assert.equal(window.getComputedStyle(p1).color, 'rgb(0, 128, 0)');
31+
assert.equal(window.getComputedStyle(p2).color, 'rgb(0, 128, 0)');
3232
}
3333
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-shorthand/_config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export default test({
99
test({ assert, component, target, window }) {
1010
const [p1, p2] = target.querySelectorAll('p');
1111

12-
assert.equal(window.getComputedStyle(p1).color, 'red');
13-
assert.equal(window.getComputedStyle(p2).color, 'red');
12+
assert.equal(window.getComputedStyle(p1).color, 'rgb(255, 0, 0)');
13+
assert.equal(window.getComputedStyle(p2).color, 'rgb(255, 0, 0)');
1414

1515
component.color = 'blue';
1616
assert.htmlEqual(
@@ -21,7 +21,7 @@ export default test({
2121
`
2222
);
2323

24-
assert.equal(window.getComputedStyle(p1).color, 'blue');
25-
assert.equal(window.getComputedStyle(p2).color, 'blue');
24+
assert.equal(window.getComputedStyle(p1).color, 'rgb(0, 0, 255)');
25+
assert.equal(window.getComputedStyle(p2).color, 'rgb(0, 0, 255)');
2626
}
2727
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-spread-and-attr/_config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
let styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'green');
13+
assert.equal(styles.color, 'rgb(0, 128, 0)');
1414

1515
component.color = null;
1616
assert.htmlEqual(target.innerHTML, '<p style=""></p>');
@@ -29,12 +29,12 @@ export default test({
2929
assert.htmlEqual(target.innerHTML, '<p style="background-color: green;"></p>');
3030
styles = window.getComputedStyle(p);
3131
assert.equal(styles.color, '');
32-
assert.equal(styles.backgroundColor, 'green');
32+
assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');
3333

3434
component.color = 'purple';
3535
assert.htmlEqual(target.innerHTML, '<p style="background-color: green; color: purple;"></p>');
3636
styles = window.getComputedStyle(p);
37-
assert.equal(styles.color, 'purple');
38-
assert.equal(styles.backgroundColor, 'green');
37+
assert.equal(styles.color, 'rgb(128, 0, 128)');
38+
assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');
3939
}
4040
});

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-spread-dynamic/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
const styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'blue');
13+
assert.equal(styles.color, 'rgb(0, 0, 255)');
1414
assert.equal(styles.width, '65px');
1515
assert.equal(p.id, 'my-id');
1616

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-spread/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
const styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'blue');
13+
assert.equal(styles.color, 'rgb(0, 0, 255)');
1414
assert.equal(styles.width, '65px');
1515
assert.equal(p.id, 'my-id');
1616
}

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-string-variable/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default test({
1010
ok(p);
1111

1212
const styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'green');
13+
assert.equal(styles.color, 'rgb(0, 128, 0)');
1414
assert.equal(styles.transform, 'translateX(45px)');
1515
assert.equal(styles.border, '100px solid pink');
1616

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-string/_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default test({
1010
ok(p);
1111

1212
const styles = window.getComputedStyle(p);
13-
assert.equal(styles.color, 'red');
13+
assert.equal(styles.color, 'rgb(255, 0, 0)');
1414
}
1515
});

0 commit comments

Comments
 (0)