Skip to content

Commit ca6e9b5

Browse files
chore: validate promise handling (#11842)
* chore: don't swallow rejected promise errors * ignore rules rather than adding catch blocks. add async to functions returning promises * remove redundant asyncs * remove extremely pointless rule * remove another daft rule * this is what typescript is for * again, typescript already has this covered, we don't need it * simplify * this rule is harmless --------- Co-authored-by: Rich Harris <[email protected]>
1 parent ae21d03 commit ca6e9b5

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

eslint.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ import lube from 'eslint-plugin-lube';
55
export default [
66
...svelte_config,
77
{
8+
languageOptions: {
9+
parserOptions: {
10+
project: true
11+
}
12+
},
813
plugins: {
914
lube
1015
},
1116
rules: {
17+
'@typescript-eslint/await-thenable': 'error',
18+
'@typescript-eslint/prefer-promise-reject-errors': 'error',
19+
'@typescript-eslint/require-await': 'error',
1220
'no-console': 'error',
1321
'lube/svelte-naming-convention': ['error', { fixSameNames: true }],
1422
// 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
@@ -43,7 +51,6 @@ export default [
4351
'documentation',
4452
// contains a fork of the REPL which doesn't adhere to eslint rules
4553
'sites/svelte-5-preview/**',
46-
'playgrounds/demo/src/**',
4754
'tmp/**',
4855
// wasn't checked previously, reenable at some point
4956
'sites/svelte.dev/**'

playgrounds/demo/.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

playgrounds/demo/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"ssr": "node ./server.js",
1010
"build": "vite build --outDir dist/client && vite build --outDir dist/server --ssr src/entry-server.ts",
1111
"prod": "npm run build && node dist",
12-
"preview": "vite preview",
13-
"format": "prettier --check --write .",
14-
"lint": "prettier --check . && eslint"
12+
"preview": "vite preview"
1513
},
1614
"devDependencies": {
1715
"@sveltejs/vite-plugin-svelte": "^3.1.0",

playgrounds/sandbox/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function mkdirp(dir) {
2929
const svelte_modules = glob('**/*.svelte', { cwd: `${cwd}/input` });
3030
const js_modules = glob('**/*.js', { cwd: `${cwd}/input` });
3131

32-
for (const generate of ['client', 'server']) {
32+
for (const generate of /** @type {const} */ (['client', 'server'])) {
3333
console.error(`\n--- generating ${generate} ---\n`);
3434
for (const file of svelte_modules) {
3535
const input = `${cwd}/input/${file}`;

playgrounds/sandbox/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"allowJs": true,
1414
"checkJs": true
1515
},
16-
"include": ["./input"]
16+
"include": ["./run.js", "./input"]
1717
}

0 commit comments

Comments
 (0)