@tempoxyz/ds 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/docs/AGENTS.md +8 -5
- package/dist/docs/index.md +143 -135
- package/dist/docs/marketing/introduction/getting-started.md +241 -0
- package/dist/docs/{components → product/components}/accordion.md +8 -8
- package/dist/docs/{components → product/components}/address-card.md +5 -5
- package/dist/docs/{components → product/components}/agent-logo.md +5 -5
- package/dist/docs/{components → product/components}/alert-dialog.md +11 -11
- package/dist/docs/{components → product/components}/alert.md +11 -11
- package/dist/docs/{components → product/components}/amount-input.md +13 -13
- package/dist/docs/{components → product/components}/amount.md +8 -8
- package/dist/docs/{components → product/components}/app-shell.md +13 -13
- package/dist/docs/{components → product/components}/asset-chip.md +11 -11
- package/dist/docs/{components → product/components}/autocomplete.md +10 -9
- package/dist/docs/{components → product/components}/avatar.md +8 -8
- package/dist/docs/{components → product/components}/badge.md +9 -9
- package/dist/docs/{components → product/components}/badged-logo.md +6 -6
- package/dist/docs/{components → product/components}/banner.md +8 -8
- package/dist/docs/{components → product/components}/bar-chart.md +7 -7
- package/dist/docs/{components → product/components}/breadcrumbs.md +8 -8
- package/dist/docs/{components → product/components}/button-group.md +8 -8
- package/dist/docs/{components → product/components}/button.md +17 -17
- package/dist/docs/{components → product/components}/calendar.md +8 -8
- package/dist/docs/{components → product/components}/callout.md +5 -5
- package/dist/docs/{components → product/components}/checkbox-group.md +13 -13
- package/dist/docs/{components → product/components}/checkbox.md +12 -12
- package/dist/docs/{components → product/components}/choice-group.md +14 -14
- package/dist/docs/{components → product/components}/choicebox.md +9 -9
- package/dist/docs/{components → product/components}/code.md +5 -5
- package/dist/docs/{components → product/components}/combobox.md +9 -9
- package/dist/docs/{components → product/components}/container.md +7 -7
- package/dist/docs/{components → product/components}/copy-button.md +13 -13
- package/dist/docs/{components → product/components}/date-picker.md +11 -11
- package/dist/docs/{components → product/components}/dialog.md +17 -17
- package/dist/docs/{components → product/components}/drawer.md +11 -11
- package/dist/docs/{components → product/components}/empty.md +9 -9
- package/dist/docs/{components → product/components}/field.md +14 -14
- package/dist/docs/{components → product/components}/fieldset.md +6 -6
- package/dist/docs/{components → product/components}/frame.md +9 -9
- package/dist/docs/{components → product/components}/gauge.md +7 -7
- package/dist/docs/{components → product/components}/get-started-visual.md +4 -4
- package/dist/docs/{components → product/components}/grid.md +7 -7
- package/dist/docs/{components → product/components}/hero-visual.md +4 -4
- package/dist/docs/{components → product/components}/hex.md +9 -9
- package/dist/docs/{components → product/components}/icon-tile.md +8 -8
- package/dist/docs/{components → product/components}/identicon.md +7 -7
- package/dist/docs/{components → product/components}/inline.md +7 -7
- package/dist/docs/{components → product/components}/inset.md +8 -8
- package/dist/docs/{components → product/components}/kbd.md +8 -8
- package/dist/docs/{components → product/components}/list-group.md +24 -24
- package/dist/docs/{components → product/components}/loading-dots.md +8 -8
- package/dist/docs/{components → product/components}/menu.md +14 -14
- package/dist/docs/{components → product/components}/native-select.md +7 -7
- package/dist/docs/{components → product/components}/network-logo.md +7 -7
- package/dist/docs/{components → product/components}/number-field.md +8 -8
- package/dist/docs/{components → product/components}/otp-field.md +9 -9
- package/dist/docs/{components → product/components}/pagination.md +8 -8
- package/dist/docs/{components → product/components}/popover.md +11 -11
- package/dist/docs/{components → product/components}/progress.md +10 -10
- package/dist/docs/{components → product/components}/qr.md +8 -8
- package/dist/docs/{components → product/components}/radio-group.md +10 -10
- package/dist/docs/{components → product/components}/secret-value.md +8 -8
- package/dist/docs/{components → product/components}/select.md +13 -13
- package/dist/docs/{components → product/components}/separator.md +7 -7
- package/dist/docs/{components → product/components}/sidebar-menu.md +11 -11
- package/dist/docs/{components → product/components}/skeleton.md +9 -9
- package/dist/docs/{components → product/components}/slider.md +8 -8
- package/dist/docs/{components → product/components}/snippet.md +10 -10
- package/dist/docs/{components → product/components}/spinner.md +12 -12
- package/dist/docs/{components → product/components}/split-bar.md +5 -5
- package/dist/docs/{components → product/components}/split-button.md +11 -11
- package/dist/docs/{components → product/components}/stack.md +8 -8
- package/dist/docs/{components → product/components}/status-chip.md +7 -7
- package/dist/docs/{components → product/components}/status-indicator.md +6 -6
- package/dist/docs/{components → product/components}/status-row.md +7 -7
- package/dist/docs/{components → product/components}/stepper.md +9 -9
- package/dist/docs/{components → product/components}/success-hero.md +5 -5
- package/dist/docs/{components → product/components}/surface.md +11 -11
- package/dist/docs/{components → product/components}/switch.md +11 -11
- package/dist/docs/{components → product/components}/table.md +16 -16
- package/dist/docs/{components → product/components}/tabs.md +11 -11
- package/dist/docs/{components → product/components}/tempo-logo.md +4 -4
- package/dist/docs/{components → product/components}/text-input.md +14 -14
- package/dist/docs/{components → product/components}/textarea.md +7 -7
- package/dist/docs/{components → product/components}/toast.md +11 -11
- package/dist/docs/{components → product/components}/token-logo.md +16 -16
- package/dist/docs/{components → product/components}/token.md +10 -10
- package/dist/docs/{components → product/components}/tooltip.md +11 -11
- package/dist/docs/{components → product/components}/verification-code.md +4 -4
- package/dist/docs/{components → product/components}/visual.md +5 -5
- package/dist/docs/product/components.md +203 -0
- package/dist/docs/{foundations → product/foundations}/accessibility.md +16 -16
- package/dist/docs/{foundations → product/foundations}/agents.md +17 -17
- package/dist/docs/{foundations → product/foundations}/color.md +7 -7
- package/dist/docs/{foundations → product/foundations}/content/tone.md +7 -7
- package/dist/docs/{foundations → product/foundations}/content/voice.md +2 -2
- package/dist/docs/{foundations → product/foundations}/content/writing-style.md +8 -8
- package/dist/docs/{foundations → product/foundations}/iconography.md +11 -11
- package/dist/docs/{foundations → product/foundations}/intent.md +28 -28
- package/dist/docs/{foundations → product/foundations}/layout.md +22 -22
- package/dist/docs/product/foundations/linter.md +496 -0
- package/dist/docs/{foundations → product/foundations}/motion.md +7 -7
- package/dist/docs/{foundations → product/foundations}/radius-and-padding.md +3 -3
- package/dist/docs/{foundations → product/foundations}/typography.md +4 -4
- package/dist/docs/{introduction → product/introduction}/faq.md +22 -21
- package/dist/docs/{introduction → product/introduction}/getting-started.md +4 -4
- package/dist/docs/{patterns → product/patterns}/blockchain-values.md +20 -20
- package/dist/docs/{patterns → product/patterns}/dashboards.md +28 -28
- package/dist/docs/{patterns → product/patterns}/destructive-actions.md +16 -16
- package/dist/docs/{patterns → product/patterns}/empty-states.md +14 -14
- package/dist/docs/{patterns → product/patterns}/errors-and-validation.md +23 -23
- package/dist/docs/{patterns → product/patterns}/feedback-and-status.md +31 -31
- package/dist/docs/{patterns → product/patterns}/forms.md +24 -24
- package/dist/docs/{patterns → product/patterns}/loading.md +19 -19
- package/dist/docs/{patterns → product/patterns}/navigation.md +23 -23
- package/dist/docs/{patterns → product/patterns}/payments.md +20 -20
- package/dist/docs/{patterns → product/patterns}/responsive-layout.md +23 -23
- package/dist/docs/{patterns → product/patterns}/tables-and-lists.md +19 -19
- package/dist/docs/{products → product/products}/tempo-console.md +12 -12
- package/dist/docs/{products → product/products}/tempo-performance.md +11 -11
- package/dist/docs/{products → product/products}/tempo-wallet.md +12 -12
- package/dist/marketing/index.d.ts +4 -0
- package/dist/marketing/index.d.ts.map +1 -0
- package/dist/marketing/index.js +4 -0
- package/dist/marketing/index.js.map +1 -0
- package/dist/marketing/index.js.zyzz.json +1 -0
- package/dist/marketing/vars.d.ts +907 -0
- package/dist/marketing/vars.d.ts.map +1 -0
- package/dist/marketing/vars.js +15 -0
- package/dist/marketing/vars.js.map +1 -0
- package/dist/marketing/vars.js.zyzz.json +1 -0
- package/dist/marketing/zyzz.config.d.ts +4512 -0
- package/dist/marketing/zyzz.config.d.ts.map +1 -0
- package/dist/marketing/zyzz.config.js +63 -0
- package/dist/marketing/zyzz.config.js.map +1 -0
- package/dist/marketing/zyzz.config.js.zyzz.json +1 -0
- package/dist/oxlint/index.d.ts +12 -1
- package/dist/oxlint/index.d.ts.map +1 -1
- package/dist/oxlint/index.js +39 -1
- package/dist/oxlint/index.js.map +1 -1
- package/dist/oxlint/internal/Docs.d.ts +9 -0
- package/dist/oxlint/internal/Docs.d.ts.map +1 -0
- package/dist/oxlint/internal/Docs.js +15 -0
- package/dist/oxlint/internal/Docs.js.map +1 -0
- package/dist/oxlint/internal/Imports.d.ts +1 -1
- package/dist/oxlint/internal/Imports.d.ts.map +1 -1
- package/dist/oxlint/internal/Imports.js +2 -0
- package/dist/oxlint/internal/Imports.js.map +1 -1
- package/dist/oxlint/internal/Styles.d.ts +40 -0
- package/dist/oxlint/internal/Styles.d.ts.map +1 -0
- package/dist/oxlint/internal/Styles.js +194 -0
- package/dist/oxlint/internal/Styles.js.map +1 -0
- package/dist/oxlint/internal/Tokens.d.ts +16 -0
- package/dist/oxlint/internal/Tokens.d.ts.map +1 -0
- package/dist/oxlint/internal/Tokens.js +39 -0
- package/dist/oxlint/internal/Tokens.js.map +1 -0
- package/dist/oxlint/rules/NoCrossSurface.d.ts +2 -2
- package/dist/oxlint/rules/NoCrossSurface.js +3 -3
- package/dist/oxlint/rules/NoCrossSurface.js.map +1 -1
- package/dist/oxlint/rules/NoCustomValues.d.ts +11 -0
- package/dist/oxlint/rules/NoCustomValues.d.ts.map +1 -0
- package/dist/oxlint/rules/NoCustomValues.js +150 -0
- package/dist/oxlint/rules/NoCustomValues.js.map +1 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.d.ts +11 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.d.ts.map +1 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.js +158 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.js.map +1 -0
- package/dist/oxlint/rules/PreferComponent.d.ts +3 -2
- package/dist/oxlint/rules/PreferComponent.d.ts.map +1 -1
- package/dist/oxlint/rules/PreferComponent.js +11 -4
- package/dist/oxlint/rules/PreferComponent.js.map +1 -1
- package/dist/oxlint/rules/PreferLayout.d.ts +9 -0
- package/dist/oxlint/rules/PreferLayout.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferLayout.js +90 -0
- package/dist/oxlint/rules/PreferLayout.js.map +1 -0
- package/dist/oxlint/rules/PreferProgress.d.ts +9 -0
- package/dist/oxlint/rules/PreferProgress.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferProgress.js +43 -0
- package/dist/oxlint/rules/PreferProgress.js.map +1 -0
- package/dist/oxlint/rules/PreferSurface.d.ts +9 -0
- package/dist/oxlint/rules/PreferSurface.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferSurface.js +55 -0
- package/dist/oxlint/rules/PreferSurface.js.map +1 -0
- package/dist/oxlint/rules/RequireAccessibleName.d.ts.map +1 -1
- package/dist/oxlint/rules/RequireAccessibleName.js +3 -1
- package/dist/oxlint/rules/RequireAccessibleName.js.map +1 -1
- package/dist/oxlint/rules/RequireScrollRegion.d.ts +11 -0
- package/dist/oxlint/rules/RequireScrollRegion.d.ts.map +1 -0
- package/dist/oxlint/rules/RequireScrollRegion.js +71 -0
- package/dist/oxlint/rules/RequireScrollRegion.js.map +1 -0
- package/dist/web/icons/index.js.zyzz.json +1 -0
- package/package.json +6 -1
- package/src/marketing/README.md +21 -0
- package/src/marketing/index.ts +3 -0
- package/src/marketing/vars.ts +751 -0
- package/src/marketing/zyzz.config.ts +376 -0
- package/src/oxlint/index.ts +40 -1
- package/src/oxlint/internal/Docs.ts +18 -0
- package/src/oxlint/internal/Imports.ts +2 -1
- package/src/oxlint/internal/Styles.ts +240 -0
- package/src/oxlint/internal/Tokens.ts +43 -0
- package/src/oxlint/rules/NoCrossSurface.ts +3 -3
- package/src/oxlint/rules/NoCustomValues.ts +170 -0
- package/src/oxlint/rules/NoSingleKeyShortcuts.ts +190 -0
- package/src/oxlint/rules/PreferComponent.ts +11 -4
- package/src/oxlint/rules/PreferLayout.ts +96 -0
- package/src/oxlint/rules/PreferProgress.ts +49 -0
- package/src/oxlint/rules/PreferSurface.ts +70 -0
- package/src/oxlint/rules/RequireAccessibleName.ts +3 -1
- package/src/oxlint/rules/RequireScrollRegion.ts +92 -0
- package/dist/docs/components.md +0 -203
- package/dist/docs/foundations/linter.md +0 -296
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
# Linter
|
|
2
|
-
|
|
3
|
-
Oxlint rules that check how your app uses Tempo Design System.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The library ships an Oxlint plugin that reports the mistakes types cannot catch, such as an unnamed icon-only [Button](/docs/components/button), an import from an internal path, or a native control that a component replaces.
|
|
8
|
-
|
|
9
|
-
## Set Up the Linter
|
|
10
|
-
|
|
11
|
-
Spread the configuration for your surface, web or mobile, into the lint options of Vite Plus, then run the linter.
|
|
12
|
-
|
|
13
|
-
```ts title="vite.config.ts"
|
|
14
|
-
import { web } from '@tempoxyz/ds/oxlint'
|
|
15
|
-
import { defineConfig } from 'vite-plus'
|
|
16
|
-
|
|
17
|
-
export default defineConfig({ lint: web })
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
vp lint
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
To change a severity, spread the rules and override one.
|
|
25
|
-
|
|
26
|
-
```ts title="vite.config.ts"
|
|
27
|
-
import { web } from '@tempoxyz/ds/oxlint'
|
|
28
|
-
import { defineConfig } from 'vite-plus'
|
|
29
|
-
|
|
30
|
-
export default defineConfig({
|
|
31
|
-
lint: { ...web, rules: { ...web.rules, 'tds/no-raw-values': 'error' } },
|
|
32
|
-
})
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Without Vite Plus, register both plugins and enable the rules in an Oxlint configuration file.
|
|
36
|
-
|
|
37
|
-
```json title=".oxlintrc.json"
|
|
38
|
-
{
|
|
39
|
-
"jsPlugins": [
|
|
40
|
-
{ "name": "tds", "specifier": "@tempoxyz/ds/oxlint" },
|
|
41
|
-
{ "name": "zyzz", "specifier": "zyzz/oxlint" }
|
|
42
|
-
],
|
|
43
|
-
"rules": {
|
|
44
|
-
"tds/no-cross-surface": ["error", { "surface": "web" }],
|
|
45
|
-
"tds/no-internal-imports": "error",
|
|
46
|
-
"tds/no-raw-values": "warn",
|
|
47
|
-
"tds/prefer-component": "warn",
|
|
48
|
-
"tds/require-accessible-name": "error"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Rules
|
|
54
|
-
|
|
55
|
-
### Import From Public Entrypoints
|
|
56
|
-
|
|
57
|
-
Reports a library import from a path that the package does not publish. The root, icons, mobile, and oxlint entrypoints pass, and so do icon SVG and font files.
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{ "rules": { "tds/no-internal-imports": "error" } }
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Do:** Import components from `@tempoxyz/ds` and icons from `@tempoxyz/ds/icons`.
|
|
64
|
-
|
|
65
|
-
````tsx
|
|
66
|
-
```tsx
|
|
67
|
-
import { Spinner } from '@tempoxyz/ds'
|
|
68
|
-
import { Copy } from '@tempoxyz/ds/icons'
|
|
69
|
-
```
|
|
70
|
-
````
|
|
71
|
-
|
|
72
|
-
**Don't:** Import from `src` or `dist`. Internal paths change without a release note.
|
|
73
|
-
|
|
74
|
-
````tsx
|
|
75
|
-
```tsx
|
|
76
|
-
import { Spinner } from '@tempoxyz/ds/src/web'
|
|
77
|
-
// @lint: tds/no-internal-imports: '@tempoxyz/ds/src/web' is not a published entrypoint. Import from '@tempoxyz/ds', '@tempoxyz/ds/mobile', or their `icons` subpaths.
|
|
78
|
-
import { Copy } from '@tempoxyz/ds/dist/icons'
|
|
79
|
-
// @lint: tds/no-internal-imports: '@tempoxyz/ds/dist/icons' is not a published entrypoint. Import from '@tempoxyz/ds', '@tempoxyz/ds/mobile', or their `icons` subpaths.
|
|
80
|
-
```
|
|
81
|
-
````
|
|
82
|
-
|
|
83
|
-
### Stay on One Surface
|
|
84
|
-
|
|
85
|
-
Reports an import from the surface that your app does not render. Without a surface option, it reports a file that imports from both surfaces.
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{ "rules": { "tds/no-cross-surface": ["error", { "surface": "web" }] } }
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Do:** Import every component and icon of a React Native app from the Mobile entrypoints.
|
|
92
|
-
|
|
93
|
-
````tsx
|
|
94
|
-
```tsx
|
|
95
|
-
import { Toggle } from '@tempoxyz/ds/mobile'
|
|
96
|
-
import { Copy } from '@tempoxyz/ds/mobile/icons'
|
|
97
|
-
```
|
|
98
|
-
````
|
|
99
|
-
|
|
100
|
-
**Don't:** Mix surfaces in one app. Each surface owns its variables, and a Web component does not render in React Native.
|
|
101
|
-
|
|
102
|
-
````tsx
|
|
103
|
-
```tsx
|
|
104
|
-
import { Toggle } from '@tempoxyz/ds/mobile'
|
|
105
|
-
import { Switch } from '@tempoxyz/ds'
|
|
106
|
-
// @lint: tds/no-cross-surface: '@tempoxyz/ds' belongs to the web surface, but this app uses the mobile surface.
|
|
107
|
-
```
|
|
108
|
-
````
|
|
109
|
-
|
|
110
|
-
### Name Controls Without Text
|
|
111
|
-
|
|
112
|
-
Reports a library component that renders no text and has no accessible name, such as an icon-only [Button](/docs/components/button) or a [Gauge](/docs/components/gauge).
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{ "rules": { "tds/require-accessible-name": "error" } }
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Do:** Name the action in `aria-label`, on the button or on the trigger that renders it.
|
|
119
|
-
|
|
120
|
-
````tsx
|
|
121
|
-
```tsx
|
|
122
|
-
<Button aria-label="Copy address" shape="icon">
|
|
123
|
-
<Copy />
|
|
124
|
-
</Button>
|
|
125
|
-
```
|
|
126
|
-
````
|
|
127
|
-
|
|
128
|
-
**Don't:** Leave an icon-only button or a [Gauge](/docs/components/gauge) unnamed. Screen readers announce only its role.
|
|
129
|
-
|
|
130
|
-
````tsx
|
|
131
|
-
```tsx
|
|
132
|
-
<Button shape="icon">
|
|
133
|
-
<Copy />
|
|
134
|
-
</Button>
|
|
135
|
-
// @lint: tds/require-accessible-name: 'Button' renders no text. Name it with `aria-label` or `aria-labelledby`.
|
|
136
|
-
```
|
|
137
|
-
````
|
|
138
|
-
|
|
139
|
-
### Prefer Library Components
|
|
140
|
-
|
|
141
|
-
Warns on a native element that a library component replaces, such as a button, a checkbox, a dialog, or a table. Elements in a render prop pass, and an allow list skips the elements you name.
|
|
142
|
-
|
|
143
|
-
```json
|
|
144
|
-
{ "rules": { "tds/prefer-component": ["warn", { "allow": ["table"] }] } }
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
**Do:** Use [Checkbox](/docs/components/checkbox) and [Button](/docs/components/button), which bring Tempo states, focus rings, and motion.
|
|
148
|
-
|
|
149
|
-
````tsx
|
|
150
|
-
```tsx
|
|
151
|
-
<Checkbox defaultChecked />
|
|
152
|
-
<Button variant="secondary">Cancel</Button>
|
|
153
|
-
```
|
|
154
|
-
````
|
|
155
|
-
|
|
156
|
-
**Don't:** Restyle a native control that the library already ships.
|
|
157
|
-
|
|
158
|
-
````tsx
|
|
159
|
-
```tsx
|
|
160
|
-
<input defaultChecked type="checkbox" />
|
|
161
|
-
// @lint: tds/prefer-component: Use 'Checkbox' from '@tempoxyz/ds' instead of <input>.
|
|
162
|
-
<button type="button">Cancel</button>
|
|
163
|
-
// @lint: tds/prefer-component: Use 'Button' from '@tempoxyz/ds' instead of <button>.
|
|
164
|
-
```
|
|
165
|
-
````
|
|
166
|
-
|
|
167
|
-
### Style With Tokens
|
|
168
|
-
|
|
169
|
-
Warns on a raw color, length, or font family in an inline style. A value that reads a custom property passes.
|
|
170
|
-
|
|
171
|
-
```json
|
|
172
|
-
{ "rules": { "tds/no-raw-values": "warn" } }
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**Do:** Set colors and spacing with tokens in a `style` definition.
|
|
176
|
-
|
|
177
|
-
````tsx
|
|
178
|
-
```tsx
|
|
179
|
-
namespace styles {
|
|
180
|
-
export const card = style({ padding: '16' })
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
;<div {...styles.card()} />
|
|
184
|
-
```
|
|
185
|
-
````
|
|
186
|
-
|
|
187
|
-
**Don't:** Hardcode colors and lengths in inline styles. They do not follow the scheme or the token scale.
|
|
188
|
-
|
|
189
|
-
````tsx
|
|
190
|
-
```tsx
|
|
191
|
-
<div style={{ color: '#000', padding: 16 }} />
|
|
192
|
-
// @lint: tds/no-raw-values: 'color' sets the raw value '#000'. Use a token through a Zyzz style instead.
|
|
193
|
-
// @lint: tds/no-raw-values: 'padding' sets the raw value 16. Use a token through a Zyzz style instead.
|
|
194
|
-
```
|
|
195
|
-
````
|
|
196
|
-
|
|
197
|
-
## Zyzz Rules
|
|
198
|
-
|
|
199
|
-
Both configurations also turn on the rules of the Zyzz plugin, which check style definitions and their use.
|
|
200
|
-
|
|
201
|
-
### Merge Styling Props Into the Style
|
|
202
|
-
|
|
203
|
-
Reports a className or style prop that would overwrite a style spread.
|
|
204
|
-
|
|
205
|
-
```json
|
|
206
|
-
{ "rules": { "zyzz/no-conflicting-props": "error" } }
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
**Do:** Pass the caller's class into the style call, which merges it.
|
|
210
|
-
|
|
211
|
-
````tsx
|
|
212
|
-
```tsx
|
|
213
|
-
<div {...styles.card({ className: props.className })} />
|
|
214
|
-
```
|
|
215
|
-
````
|
|
216
|
-
|
|
217
|
-
**Don't:** Set a class beside a style spread. One overwrites the other.
|
|
218
|
-
|
|
219
|
-
````tsx
|
|
220
|
-
```tsx
|
|
221
|
-
<div className="card" {...styles.card()} />
|
|
222
|
-
// @lint: zyzz/no-conflicting-props: Pass 'className' into the Zyzz style call to merge styling props.
|
|
223
|
-
```
|
|
224
|
-
````
|
|
225
|
-
|
|
226
|
-
### Remove Unused Styles
|
|
227
|
-
|
|
228
|
-
Warns on a style in a styles namespace that nothing applies.
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
{ "rules": { "zyzz/no-unused": "warn" } }
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
**Do:** Keep only the styles that the module applies.
|
|
235
|
-
|
|
236
|
-
````tsx
|
|
237
|
-
```tsx
|
|
238
|
-
namespace styles {
|
|
239
|
-
export const card = style({ padding: '16' })
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
;<div {...styles.card()} />
|
|
243
|
-
```
|
|
244
|
-
````
|
|
245
|
-
|
|
246
|
-
**Don't:** Leave a style that nothing applies. It still ships in the stylesheet.
|
|
247
|
-
|
|
248
|
-
````tsx
|
|
249
|
-
```tsx
|
|
250
|
-
namespace styles {
|
|
251
|
-
export const card = style({ padding: '16' })
|
|
252
|
-
|
|
253
|
-
export const legacy = style({ padding: '8' })
|
|
254
|
-
// @lint: zyzz/no-unused: Style 'styles.legacy' is never used.
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
````
|
|
258
|
-
|
|
259
|
-
### Write Scalar Declarations
|
|
260
|
-
|
|
261
|
-
Reports a declaration whose value is not a string, a number, or a fallback array.
|
|
262
|
-
|
|
263
|
-
```json
|
|
264
|
-
{ "rules": { "zyzz/valid-styles": "error" } }
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
**Do:** Set each side with its own property.
|
|
268
|
-
|
|
269
|
-
````tsx
|
|
270
|
-
```tsx
|
|
271
|
-
style({ paddingTop: '8' })
|
|
272
|
-
```
|
|
273
|
-
````
|
|
274
|
-
|
|
275
|
-
**Don't:** Nest an object inside a declaration.
|
|
276
|
-
|
|
277
|
-
````tsx
|
|
278
|
-
```tsx
|
|
279
|
-
style({ padding: { top: '8' } })
|
|
280
|
-
// @lint: zyzz/valid-styles: CSS declarations require scalar values or fallback arrays.
|
|
281
|
-
```
|
|
282
|
-
````
|
|
283
|
-
|
|
284
|
-
## Related
|
|
285
|
-
|
|
286
|
-
[Agents](/docs/foundations/agents)
|
|
287
|
-
|
|
288
|
-
Covers the rules that coding agents follow and the checks they run.
|
|
289
|
-
|
|
290
|
-
[Accessibility](/docs/foundations/accessibility)
|
|
291
|
-
|
|
292
|
-
Covers the accessible names that the linter checks.
|
|
293
|
-
|
|
294
|
-
[Getting Started](/docs/introduction/getting-started)
|
|
295
|
-
|
|
296
|
-
Covers the install and the Zyzz setup that the linter builds on.
|