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 <rich.harris@vercel.com>
pull/11913/head
Ben McCann 3 weeks ago committed by GitHub
parent ae21d03a52
commit ca6e9b5745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,10 +5,18 @@ import lube from 'eslint-plugin-lube';
export default [
...svelte_config,
{
languageOptions: {
parserOptions: {
project: true
}
},
plugins: {
lube
},
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/prefer-promise-reject-errors': 'error',
'@typescript-eslint/require-await': 'error',
'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
@ -43,7 +51,6 @@ export default [
'documentation',
// contains a fork of the REPL which doesn't adhere to eslint rules
'sites/svelte-5-preview/**',
'playgrounds/demo/src/**',
'tmp/**',
// wasn't checked previously, reenable at some point
'sites/svelte.dev/**'

@ -9,9 +9,7 @@
"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",
"format": "prettier --check --write .",
"lint": "prettier --check . && eslint"
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.1.0",

@ -29,7 +29,7 @@ function mkdirp(dir) {
const svelte_modules = glob('**/*.svelte', { cwd: `${cwd}/input` });
const js_modules = glob('**/*.js', { cwd: `${cwd}/input` });
for (const generate of ['client', 'server']) {
for (const generate of /** @type {const} */ (['client', 'server'])) {
console.error(`\n--- generating ${generate} ---\n`);
for (const file of svelte_modules) {
const input = `${cwd}/input/${file}`;

@ -13,5 +13,5 @@
"allowJs": true,
"checkJs": true
},
"include": ["./input"]
"include": ["./run.js", "./input"]
}

Loading…
Cancel
Save