Skip to content

Commit 5dce0a2

Browse files
committed
Fixed typescript and svelte check step
1 parent 2a9f6c3 commit 5dce0a2

File tree

15 files changed

+63
-42
lines changed

15 files changed

+63
-42
lines changed

.github/workflows/blade-validate.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,16 @@ jobs:
3434
- name: Build Blade Svelte
3535
run: yarn build
3636
working-directory: packages/blade-svelte
37-
- name: Lint Blade
38-
run: yarn lint:blade
39-
- name: Lint Blade Core
40-
run: yarn lint:blade-core
41-
- name: Lint Blade Svelte
42-
run: yarn lint:blade-svelte
43-
- name: Lint ESLint Plugin
44-
run: yarn lint:eslint-plugin
45-
- name: Lint Stylelint
46-
run: yarn lint:stylelint
37+
- name: Lint Source Code
38+
run: yarn lint
4739
- name: Run TypeScript Checks (Blade)
4840
run: yarn typecheck
4941
working-directory: packages/blade
5042
- name: Run TypeScript Checks (Blade Core)
5143
run: yarn typecheck
5244
working-directory: packages/blade-core
5345
- name: Run Svelte Checks (Blade Svelte)
54-
run: yarn check
46+
run: yarn svelte-check
5547
working-directory: packages/blade-svelte
5648

5749
test:

packages/blade-core/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"include": ["src", "src/@types"],
4+
"exclude": ["**/*.native.ts", "**/*.native.tsx", "src/tokens/theme/__tests__"],
45
"compilerOptions": {
56
"baseUrl": ".",
67
"paths": {

packages/blade-svelte/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"build:clean": "rm -rf dist",
4242
"build:generate-types": "tsc -p ./tsconfig-generate-types.json",
4343
"build:lib": "rollup -c",
44-
"check": "svelte-check --tsconfig ./tsconfig.json",
45-
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
44+
"svelte-check": "svelte-check --tsconfig ./tsconfig.json",
45+
"svelte-check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
4646
"storybook": "storybook dev -p 6006",
4747
"build-storybook": "storybook build -o storybook-static"
4848
},

packages/blade-svelte/src/App.svelte

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
let isLoading = $state(false);
1111
let isLoading2 = $state(false);
1212
13-
function handleClick(): void {
14-
alert('Button clicked!')
15-
}
16-
1713
function handleLinkClick(event: MouseEvent): void {
1814
console.log('Link clicked!', event)
1915
}

packages/blade-svelte/src/components/Amount/Amount.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<BaseAmount
2323
{value}
2424
{suffix}
25-
{type}
26-
{size}
25+
type={type as 'body'}
26+
size={size as 'medium'}
2727
{weight}
2828
{isAffixSubtle}
2929
{isStrikethrough}

packages/blade-svelte/src/components/Button/BaseButton/BaseButton.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script lang="ts">
2-
import { makeAccessible, makeAnalyticsAttribute, metaAttribute, MetaConstants } from '@razorpay/blade-core/utils';
2+
import { makeAccessible, makeAnalyticsAttribute, metaAttribute, MetaConstants, type AriaRoles } from '@razorpay/blade-core/utils';
33
import { useInteraction } from '../../../utils/useInteraction';
44
import BaseText from '../../Typography/BaseText/BaseText.svelte';
55
import BaseSpinner from '../../Spinner/BaseSpinner/BaseSpinner.svelte';
66
import type { BaseButtonProps } from './types';
7+
import type { TextColors } from '../../Typography/BaseText/types';
78
import { getStyledPropsClasses } from '@razorpay/blade-core/utils';
89
import {
910
getButtonClasses,
@@ -112,19 +113,19 @@
112113
const textSizes = getButtonTextSizes();
113114
114115
// Compute text color token reactively
115-
const textColorToken = $derived.by(() => {
116+
const textColorToken = $derived.by((): TextColors => {
116117
return getButtonTextColorToken({
117118
variant,
118119
color,
119120
state: currentInteraction,
120121
property: 'text',
121-
});
122+
}) as TextColors;
122123
});
123124
124125
// Compute icon color token reactively
125126
// Note: Currently unused but will be needed when Icon component is implemented
126-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
127-
const iconColorToken = $derived(
127+
// @ts-ignore - intentionally unused until Icon component is implemented
128+
const _iconColorToken = $derived(
128129
getButtonTextColorToken({
129130
variant,
130131
color,
@@ -216,7 +217,7 @@
216217
// Accessibility attributes
217218
const accessibilityAttrs = $derived(
218219
makeAccessible({
219-
role: accessibilityProps?.role ?? buttonRole,
220+
role: (accessibilityProps?.role ?? buttonRole) as AriaRoles,
220221
disabled: isButtonDisabled,
221222
label: accessibilityProps?.label,
222223
describedBy: accessibilityProps?.describedBy,

packages/blade-svelte/src/components/Button/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@ export type ButtonProps = BaseButtonProps & {
5757
* Function called when the button is clicked
5858
*/
5959
onClick?: (event: MouseEvent) => void;
60+
/**
61+
* Accessibility role for the button
62+
*/
63+
role?: string;
64+
/**
65+
* aria-describedby attribute
66+
*/
67+
'aria-describedby'?: string;
68+
/**
69+
* aria-expanded attribute
70+
*/
71+
'aria-expanded'?: boolean;
72+
/**
73+
* aria-haspopup attribute
74+
*/
75+
'aria-haspopup'?: 'menu' | boolean;
6076
} & StyledPropsBlade;

packages/blade-svelte/src/components/Link/BaseLink/BaseLink.svelte

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts">
22
import type { Snippet } from 'svelte';
3-
import { makeAccessible, makeAnalyticsAttribute, metaAttribute, MetaConstants } from '@razorpay/blade-core/utils';
3+
import { makeAccessible, makeAnalyticsAttribute, metaAttribute, MetaConstants, type AriaRoles } from '@razorpay/blade-core/utils';
44
import { useInteraction } from '../../../utils/useInteraction';
55
import BaseText from '../../Typography/BaseText/BaseText.svelte';
6+
import type { TextColors } from '../../Typography/BaseText/types';
67
import type { StyledPropsBlade } from '@razorpay/blade-core/utils';
78
import { getStyledPropsClasses } from '@razorpay/blade-core/utils';
89
import { getBaseLinkClasses, getBaseLinkTemplateClasses, getLinkColorToken, getLinkTextSizes, type ActionStatesType } from '@razorpay/blade-core/styles';
@@ -136,7 +137,7 @@
136137
element: 'text',
137138
currentInteraction: currentInteraction as ActionStatesType,
138139
isDisabled,
139-
}),
140+
}) as TextColors,
140141
fontSize: textSizes.fontSize[size],
141142
lineHeight: textSizes.lineHeight[size],
142143
@@ -184,7 +185,7 @@
184185
// Accessibility attributes
185186
const accessibilityAttrs = $derived(
186187
makeAccessible({
187-
role: elementRole,
188+
role: elementRole as AriaRoles,
188189
disabled: isElementDisabled,
189190
...accessibilityProps,
190191
}),
@@ -297,7 +298,7 @@
297298
lineHeight={lineHeight}
298299
fontFamily="text"
299300
fontWeight="medium"
300-
textDecorationLine={textDecorationLine}
301+
textDecorationLine={textDecorationLine as 'none' | 'line-through' | 'underline'}
301302
componentName={MetaConstants.Link}
302303
>
303304
{#if typeof children === 'string'}

packages/blade-svelte/src/components/Typography/BaseText/BaseText.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
fontSize,
4040
lineHeight,
4141
fontWeight,
42-
fontFamily,
42+
fontFamily: fontFamily as 'text' | 'heading' | undefined,
4343
fontStyle,
4444
textDecorationLine,
4545
textAlign,

packages/blade-svelte/src/components/Typography/BaseText/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ export type BaseTextProps = {
6666
* React Native only - not applicable for Svelte but kept for API consistency
6767
*/
6868
numberOfLines?: number;
69-
componentName?: 'base-text' | 'text' | 'title' | 'heading' | 'code' | 'display';
69+
componentName?:
70+
| 'base-text'
71+
| 'text'
72+
| 'title'
73+
| 'heading'
74+
| 'code'
75+
| 'display'
76+
| 'button'
77+
| 'spinner'
78+
| 'link';
7079
testID?: string;
7180
// Analytics attributes
7281
[key: `data-analytics-${string}`]: string;

0 commit comments

Comments
 (0)