-
Notifications
You must be signed in to change notification settings - Fork 1
chore: cherry-pick codebase cleanup
#35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ What + why. | |
|
|
||
| ## Changes | ||
|
|
||
| * Bullets. | ||
| - Bullets. | ||
|
|
||
| ## Test | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| import React from 'react'; | ||
|
|
||
| function Skeleton({ | ||
| className, | ||
| ...props | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,28 +5,24 @@ import type { ToastActionElement, ToastProps } from '@/components/ui/toast'; | |
| const TOAST_LIMIT = 1; | ||
| const TOAST_REMOVE_DELAY = 1000000; | ||
|
|
||
| let count = 0; | ||
| const genId = () => (++count).toString(); | ||
|
|
||
| type ToasterToast = ToastProps & { | ||
| id: string; | ||
| title?: React.ReactNode; | ||
| description?: React.ReactNode; | ||
| action?: ToastActionElement; | ||
| }; | ||
|
|
||
| const actionTypes = { | ||
| ADD_TOAST: 'ADD_TOAST', | ||
| UPDATE_TOAST: 'UPDATE_TOAST', | ||
| DISMISS_TOAST: 'DISMISS_TOAST', | ||
| REMOVE_TOAST: 'REMOVE_TOAST', | ||
| } as const; | ||
|
Comment on lines
12
to
-20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| let count = 0; | ||
|
|
||
| function genId() { | ||
| count = (count + 1) % Number.MAX_SAFE_INTEGER; | ||
| return count.toString(); | ||
| } | ||
| type ActionTypes = { | ||
| ADD_TOAST: 'ADD_TOAST'; | ||
| UPDATE_TOAST: 'UPDATE_TOAST'; | ||
| DISMISS_TOAST: 'DISMISS_TOAST'; | ||
| REMOVE_TOAST: 'REMOVE_TOAST'; | ||
| }; | ||
|
|
||
| type ActionType = typeof actionTypes; | ||
| type ActionType = ActionTypes; | ||
|
|
||
| type Action = | ||
| | { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import js from '@eslint/js'; | ||
| import tseslint from '@typescript-eslint/eslint-plugin'; | ||
| import tsparser from '@typescript-eslint/parser'; | ||
| import globals from 'globals'; | ||
|
|
||
| export default [ | ||
| js.configs.recommended, | ||
| { | ||
| files: ['apps/client/**/*.ts', 'apps/client/**/*.tsx'], | ||
| languageOptions: { | ||
| parser: tsparser, | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module', | ||
| }, | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tseslint, | ||
| }, | ||
| rules: { | ||
| ...tseslint.configs.recommended.rules, | ||
| '@typescript-eslint/no-unused-vars': 'error', | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| }, | ||
| }, | ||
| { | ||
| files: [ | ||
| 'apps/server/**/*.ts', | ||
| 'apps/cli/**/*.ts', | ||
| 'packages/**/*.ts', | ||
| '*.ts', | ||
| ], | ||
| languageOptions: { | ||
| parser: tsparser, | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module', | ||
| }, | ||
| globals: globals.node, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tseslint, | ||
| }, | ||
| rules: { | ||
| ...tseslint.configs.recommended.rules, | ||
| '@typescript-eslint/no-unused-vars': 'error', | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['tests/**/*.ts'], | ||
| languageOptions: { | ||
| parser: tsparser, | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module', | ||
| }, | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tseslint, | ||
| }, | ||
| rules: { | ||
| ...tseslint.configs.recommended.rules, | ||
| '@typescript-eslint/no-unused-vars': 'error', | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| }, | ||
| }, | ||
| { | ||
| ignores: [ | ||
| 'node_modules/**', | ||
| 'dist/**', | ||
| 'api/**', | ||
| 'apps/cli/dist/**', | ||
| '**/*.cjs', | ||
| ], | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type cast
as unknown as numberis used here to align the return type ofsetTimeoutwith thetimeoutRef. While this works, it's a bit of a code smell and can be avoided. Usingwindow.setTimeoutexplicitly tells TypeScript to use the browser's implementation, which correctly returns anumber, removing the need for a cast and making the code cleaner and more type-safe.