diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e2a11d03ea..c3e825cfc1 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -16,6 +16,7 @@ module.exports = { plugins: ['@typescript-eslint', 'prettier', 'no-only-tests'], rules: { // These off/configured-differently-by-default rules fit well for us + '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/array-type': ['error', { default: 'array-simple' }], '@typescript-eslint/no-unused-vars': [ 'warn', diff --git a/packages/astro/src/assets/services/squoosh.ts b/packages/astro/src/assets/services/squoosh.ts index c9586af10d..098b3a669e 100644 --- a/packages/astro/src/assets/services/squoosh.ts +++ b/packages/astro/src/assets/services/squoosh.ts @@ -48,6 +48,8 @@ async function getRotationForEXIF( case 7: case 8: return { type: 'rotate', numRotations: 3 }; + default: + return undefined; } } diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index dcc4859f81..b8cb1949cd 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -211,6 +211,8 @@ export async function add(names: string[], { flags }: AddOptions) { case UpdateResult.failure: { throw createPrettyError(new Error(`Unable to install dependencies`)); } + case UpdateResult.none: + break; } const rawConfigPath = await resolveConfigPath({ diff --git a/packages/astro/src/core/app/types.ts b/packages/astro/src/core/app/types.ts index b4da7dc682..a5b93fb500 100644 --- a/packages/astro/src/core/app/types.ts +++ b/packages/astro/src/core/app/types.ts @@ -60,7 +60,7 @@ export type SSRManifest = { export type SSRManifestI18n = { fallback?: Record; - routing?: RoutingStrategies; + routing: RoutingStrategies; locales: Locales; defaultLocale: string; }; diff --git a/packages/astro/src/preferences/index.ts b/packages/astro/src/preferences/index.ts index d758c405b3..8a19c5d48d 100644 --- a/packages/astro/src/preferences/index.ts +++ b/packages/astro/src/preferences/index.ts @@ -66,7 +66,10 @@ export function coerce(key: string, value: unknown) { case 'boolean': { if (value === 'true' || value === 1) return true; if (value === 'false' || value === 0) return false; + break; } + default: + throw new Error(`Incorrect value for ${key}`); } return value as any; } diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts index d6a2cbde83..7fa1993090 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts @@ -161,7 +161,10 @@ export default { astroToggle.input.addEventListener('change', setting.changeEvent); astroToggle.input.checked = settings.config[setting.settingKey]; label.append(astroToggle); + break; } + default: + break; } return label; diff --git a/packages/astro/src/runtime/server/scripts.ts b/packages/astro/src/runtime/server/scripts.ts index 47cd122f1c..2ab3686258 100644 --- a/packages/astro/src/runtime/server/scripts.ts +++ b/packages/astro/src/runtime/server/scripts.ts @@ -42,6 +42,8 @@ export function getPrescripts(result: SSRResult, type: PrescriptType, directive: )};${islandScript}`; case 'directive': return ``; + case null: + break; } return ''; } diff --git a/packages/astro/src/vite-plugin-astro/types.ts b/packages/astro/src/vite-plugin-astro/types.ts index 589a0b0b03..40979293dc 100644 --- a/packages/astro/src/vite-plugin-astro/types.ts +++ b/packages/astro/src/vite-plugin-astro/types.ts @@ -1,6 +1,5 @@ import type { HoistedScript, TransformResult } from '@astrojs/compiler'; import type { PropagationHint } from '../@types/astro.js'; -import type { CompileAstroResult } from './compile.js'; export interface PageOptions { prerender?: boolean; diff --git a/packages/integrations/node/test/encoded.test.js b/packages/integrations/node/test/encoded.test.js index 2739fcfb7f..15b5654b1f 100644 --- a/packages/integrations/node/test/encoded.test.js +++ b/packages/integrations/node/test/encoded.test.js @@ -1,5 +1,5 @@ import * as assert from 'node:assert/strict'; -import { describe, it, before, after } from 'node:test'; +import { describe, it, before } from 'node:test'; import nodejs from '../dist/index.js'; import { loadFixture, createRequestAndResponse } from './test-utils.js'; diff --git a/packages/integrations/node/test/headers.test.js b/packages/integrations/node/test/headers.test.js index 6a08dca22d..b74af99524 100644 --- a/packages/integrations/node/test/headers.test.js +++ b/packages/integrations/node/test/headers.test.js @@ -1,5 +1,5 @@ import * as assert from 'node:assert/strict'; -import { describe, it, before, after } from 'node:test'; +import { describe, it, before } from 'node:test'; import nodejs from '../dist/index.js'; import { loadFixture, createRequestAndResponse } from './test-utils.js'; diff --git a/packages/integrations/node/test/locals.test.js b/packages/integrations/node/test/locals.test.js index e2a531cce0..a310c729d8 100644 --- a/packages/integrations/node/test/locals.test.js +++ b/packages/integrations/node/test/locals.test.js @@ -1,5 +1,5 @@ import * as assert from 'node:assert/strict'; -import { describe, it, before, after } from 'node:test'; +import { describe, it, before } from 'node:test'; import nodejs from '../dist/index.js'; import { loadFixture, createRequestAndResponse } from './test-utils.js';