diff --git a/lib/panda/remove-unused-css.ts b/lib/panda/remove-unused-css.ts index b3a1f9a..dab1b27 100644 --- a/lib/panda/remove-unused-css.ts +++ b/lib/panda/remove-unused-css.ts @@ -58,7 +58,7 @@ export default function removeUnusedCSS(css: string): string { if (!decl.value.includes('var(')) return for (const match of decl.value.matchAll(varRegex)) { - const variable = match.groups?.name.trim() + const variable = match.groups?.['name']?.trim() if (variable == null || variable === '') continue if (isVar) { @@ -77,7 +77,11 @@ export default function removeUnusedCSS(css: string): string { const decl = node const animationName = decl.prop === 'animation' ? decl.value.split(' ')[0] : decl.value - if ((decl.prop === 'animation' || decl.prop === 'animation-name') && keyframes.has(animationName)) { + if ( + (decl.prop === 'animation' || decl.prop === 'animation-name') && + animationName != null && + keyframes.has(animationName) + ) { // Mark the keyframe as used keyframes.set(animationName, true) } diff --git a/package.json b/package.json index 0692d4f..726ced2 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "@testing-library/jest-dom": "^6.5.0", "@testing-library/user-event": "^14.5.2", "@tsconfig/node20": "^20.1.4", + "@tsconfig/recommended": "^1.0.7", + "@tsconfig/strictest": "^2.0.5", "@types/chrome": "^0.0.277", "@types/node": "^20.16.11", "@vitest/coverage-v8": "^2.1.2", diff --git a/panda.config.ts b/panda.config.ts index 46bf3bc..6da5990 100644 --- a/panda.config.ts +++ b/panda.config.ts @@ -50,6 +50,7 @@ export default defineConfig({ hooks: { 'cssgen:done': ({ artifact, content }) => { if (artifact === 'styles.css') return removeUnusedCSS(content) + return content }, }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb43c51..1c78cd1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,6 +62,12 @@ importers: '@tsconfig/node20': specifier: ^20.1.4 version: 20.1.4 + '@tsconfig/recommended': + specifier: ^1.0.7 + version: 1.0.7 + '@tsconfig/strictest': + specifier: ^2.0.5 + version: 2.0.5 '@types/chrome': specifier: ^0.0.277 version: 0.0.277 @@ -911,6 +917,12 @@ packages: '@tsconfig/node20@20.1.4': resolution: {integrity: sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==} + '@tsconfig/recommended@1.0.7': + resolution: {integrity: sha512-xiNMgCuoy4mCL4JTywk9XFs5xpRUcKxtWEcMR6FNMtsgewYTIgIR+nvlP4A4iRCAzRsHMnPhvTRrzp4AGcRTEA==} + + '@tsconfig/strictest@2.0.5': + resolution: {integrity: sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==} + '@types/aria-query@5.0.4': resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} @@ -4071,6 +4083,10 @@ snapshots: '@tsconfig/node20@20.1.4': {} + '@tsconfig/recommended@1.0.7': {} + + '@tsconfig/strictest@2.0.5': {} + '@types/aria-query@5.0.4': {} '@types/babel__core@7.20.5': diff --git a/postcss.config.mjs b/postcss.config.mjs index a4fd7c0..7466fc7 100644 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -1,6 +1,5 @@ /** * @see https://github.com/postcss/postcss - * @type {import('postcss-load-config').Config} */ export default { plugins: { diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index d1aca0e..4c13158 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -13,7 +13,7 @@ interface ModalProps { icon?: JSX.Element title: JSX.Element children?: JSX.Element - onClose?: () => void + onClose?: (() => void) | undefined } export default function Modal(props: ModalProps): JSX.Element { diff --git a/src/components/SettingsDialog/index.tsx b/src/components/SettingsDialog/index.tsx index 4175fa4..d5895bd 100644 --- a/src/components/SettingsDialog/index.tsx +++ b/src/components/SettingsDialog/index.tsx @@ -12,9 +12,10 @@ export interface SettingsDialogProps { export default function SettingsDialog(props: SettingsDialogProps): JSX.Element { const handleSubmit = async (values: Settings): Promise => await props.onSave?.(values) + const handleClose = (): void => props.onClose?.() return ( - } title="Settings" onClose={props.onClose}> + } title="Settings" onClose={handleClose}> ) diff --git a/src/components/TimeMilestones/index.tsx b/src/components/TimeMilestones/index.tsx index b057028..44f1151 100644 --- a/src/components/TimeMilestones/index.tsx +++ b/src/components/TimeMilestones/index.tsx @@ -10,7 +10,7 @@ import createTimeMilestones from './hooks/createTimeMilestones' import * as s from './styles' export interface TimeMilestonesProps { - birthDate?: ISODate + birthDate?: ISODate | undefined progressStyle: MilestoneProgressStyle } diff --git a/src/hooks/createSubscription.ts b/src/hooks/createSubscription.ts index 8e84909..5cb67a9 100644 --- a/src/hooks/createSubscription.ts +++ b/src/hooks/createSubscription.ts @@ -7,7 +7,7 @@ type Identity = (previous: T, next: T) => boolean interface Subscription { subscribe: (fn: () => void) => Unsubscribe getCurrentValue: () => T - identity?: Identity + identity?: Identity | undefined } const DefaultIdentity = (a: T, b: T): boolean => Object.is(a, b) diff --git a/src/utils/as-getters.ts b/src/utils/as-getters.ts index c5db631..5ade385 100644 --- a/src/utils/as-getters.ts +++ b/src/utils/as-getters.ts @@ -6,10 +6,8 @@ type Getters = { [key in keyof T]: ReturnType } export default function asGetters(map: T): Getters { const getters = Object.create(null) as Partial> - for (const name in map) { - Object.defineProperty(getters, name, { - get: map[name], - }) + for (const [name, get] of Object.entries(map)) { + Object.defineProperty(getters, name, { get }) } return getters as Getters diff --git a/tsconfig.app.json b/tsconfig.app.json index 2609d90..0b2f4a9 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -1,23 +1,24 @@ { + "extends": ["@tsconfig/recommended", "@tsconfig/strictest"], "compilerOptions": { + "checkJs": false, "allowJs": true, "baseUrl": ".", "composite": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "isolatedModules": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", "lib": ["esnext", "dom", "dom.iterable"], "module": "esnext", + "target": "esnext", + + /* Bundler mode */ "moduleResolution": "bundler", - "noEmit": true, + "allowImportingTsExtensions": true, "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, - "noUncheckedIndexedAccess": true, - "target": "esnext", + "isolatedModules": true, + "jsx": "preserve", + "jsxImportSource": "solid-js", + "noEmit": true, "verbatimModuleSyntax": true, + "paths": { "@/*": ["src/*"], "styled-system": ["styled-system"], diff --git a/tsconfig.node.json b/tsconfig.node.json index f7f6c44..e95744b 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,17 +1,11 @@ { - "extends": "@tsconfig/node20", + "extends": ["@tsconfig/recommended", "@tsconfig/strictest", "@tsconfig/node20"], "compilerOptions": { + "checkJs": true, "allowJs": true, "baseUrl": ".", "composite": true, - "isolatedModules": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "resolveJsonModule": true, - "skipLibCheck": true, "noEmit": true, - "strict": true, - "target": "ES2022", "tsBuildInfoFile": ".tmp/node.tsbuildinfo" }, "include": [