stillwind 0.1.0 → 0.3.0
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 +19 -19
- package/css/builtin-utilities/tw-layout.css +2 -2
- package/css/logical/divide.css +67 -0
- package/css/logical/overflow.css +57 -0
- package/css/logical/overscroll.css +40 -0
- package/css/logical/resize.css +19 -0
- package/css/logical/snap.css +20 -0
- package/docs/at-rules/custom-variant.md +1 -1
- package/docs/at-rules/plugin.md +2 -3
- package/docs/at-rules/stillwind-undef-utility.md +7 -0
- package/docs/at-rules/utility.md +2 -1
- package/docs/cli.md +244 -0
- package/docs/concepts/stylesheets.md +89 -0
- package/docs/configuration.md +43 -5
- package/docs/editors.md +110 -0
- package/docs/errors/SW10002.md +1 -1
- package/docs/formatters.md +87 -0
- package/docs/guides/lint-adoption.md +3 -12
- package/docs/guides/migrating-from-css.md +2 -0
- package/docs/guides/style.md +4 -4
- package/docs/guides/tailwind-compatibility.md +3 -0
- package/docs/index.md +6 -4
- package/docs/integrations.md +3 -0
- package/docs/lints/{prefer-explicit-nesting-selector.md → implicit-nesting-selector.md} +3 -3
- package/docs/lints/index.md +43 -43
- package/docs/lints/prefer-canonical-utilities.md +14 -0
- package/docs/lints/prefer-logical-properties.md +18 -0
- package/docs/lints/unknown-utility.md +1 -1
- package/docs/lints/unknown-variant.md +1 -1
- package/docs/plugins/iconify.md +270 -0
- package/docs/plugins/index.md +26 -0
- package/docs/why.md +1 -1
- package/package.json +11 -6
- package/skills/stillwind/SKILL.md +4 -1
package/docs/configuration.md
CHANGED
|
@@ -23,7 +23,39 @@ export default defineConfig({
|
|
|
23
23
|
|
|
24
24
|
Each entry in `projects` selects a stylesheet and the files that belong to it.
|
|
25
25
|
Most applications need one project. A monorepo can list one project for each
|
|
26
|
-
application
|
|
26
|
+
application, or keep a configuration file in each package and reference those
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
## Reference other configuration files
|
|
30
|
+
|
|
31
|
+
A string in `projects` references other configuration files, relative to the
|
|
32
|
+
file that declares it. Strings and project objects can appear in the same list.
|
|
33
|
+
|
|
34
|
+
```ts title="stillwind.config.ts"
|
|
35
|
+
import { defineConfig } from "stillwind/config";
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
projects: ["apps/*", "!apps/legacy", "packages/ui", "tools/site.stillwind.ts"],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Entry | Selects |
|
|
43
|
+
| ------------------------- | ------------------------------------------------------------------------ |
|
|
44
|
+
| `tools/site.stillwind.ts` | That configuration file, with any name |
|
|
45
|
+
| `packages/ui` | The `stillwind.config.*` file in that directory |
|
|
46
|
+
| `apps/*` | `stillwind.config.*` files that the glob matches or finds in directories |
|
|
47
|
+
| `!apps/legacy` | Removes a path or a glob from the matches of glob entries |
|
|
48
|
+
|
|
49
|
+
A path or a directory that is missing causes an error. A glob skips directories
|
|
50
|
+
that have no configuration file, and it does not search `node_modules` or `.git`.
|
|
51
|
+
Stillwind reports an error only when no project remains in the list.
|
|
52
|
+
|
|
53
|
+
A relative `root` in a referenced file uses the directory of that file, so
|
|
54
|
+
packages keep working on their own. Referenced files must list project objects
|
|
55
|
+
because references do not nest. Project names must be unique across all files.
|
|
56
|
+
|
|
57
|
+
Build tools watch the referenced files, but they do not notice a new file that a
|
|
58
|
+
glob would match. Restart the build after you add a package.
|
|
27
59
|
|
|
28
60
|
## Where Stillwind finds the file
|
|
29
61
|
|
|
@@ -31,6 +63,11 @@ The build integration searches from the application root upward. The CLI and
|
|
|
31
63
|
the editor search from the working directory or the workspace upward. The file
|
|
32
64
|
in the nearest directory wins.
|
|
33
65
|
|
|
66
|
+
The editor also searches from each file that you open. A monorepo therefore
|
|
67
|
+
works without a configuration file at its root: when no open project includes
|
|
68
|
+
the file, the editor uses the nearest configuration file inside the workspace.
|
|
69
|
+
Setting an explicit configuration file turns this search off.
|
|
70
|
+
|
|
34
71
|
Stillwind accepts `stillwind.config.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`,
|
|
35
72
|
and `.json`. In one directory, it uses the first of these that exists.
|
|
36
73
|
|
|
@@ -90,9 +127,9 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
90
127
|
|
|
91
128
|
### Editor
|
|
92
129
|
|
|
93
|
-
| Field | Value
|
|
94
|
-
| --------- |
|
|
95
|
-
| `preview` | Which comments CSS previews show: `themeValues`, `pixelEquivalents`, and `colorEquivalents` |
|
|
130
|
+
| Field | Value |
|
|
131
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
132
|
+
| `preview` | Which comments [CSS previews](editors.md#settings) show: `themeValues`, `pixelEquivalents`, and `colorEquivalents` |
|
|
96
133
|
|
|
97
134
|
The [shared configuration API](https://github.com/SegaraRai/stillwind/blob/main/packages/config/src/compiler.ts)
|
|
98
135
|
describes the remaining fields for custom integrations, such as `sources`,
|
|
@@ -255,7 +292,8 @@ comment that suppresses nothing.
|
|
|
255
292
|
|
|
256
293
|
## Sorting
|
|
257
294
|
|
|
258
|
-
The `sort` field controls where `stillwind fmt
|
|
295
|
+
The `sort` field controls where `stillwind fmt`, the editor, and the
|
|
296
|
+
[Prettier plugin](formatters.md#prettier) sort utilities:
|
|
259
297
|
|
|
260
298
|
| Option | Sorts | Default |
|
|
261
299
|
| ----------------- | -------------------------------------------------- | ------- |
|
package/docs/editors.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Editors"
|
|
3
|
+
description: "Install the Stillwind extension, sort and fix on save, and connect other editors to the language server."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Editors
|
|
7
|
+
|
|
8
|
+
The Stillwind language server shows diagnostics, generated CSS, and completion
|
|
9
|
+
from the active design system while you edit. It reads the same
|
|
10
|
+
`stillwind.config.ts` as the CLI and the build, and it checks unsaved files too.
|
|
11
|
+
Create that file with [Getting started](index.md) first.
|
|
12
|
+
|
|
13
|
+
## VS Code
|
|
14
|
+
|
|
15
|
+
Install **Stillwind** from the
|
|
16
|
+
[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=stillwind.stillwind)
|
|
17
|
+
or [Open VSX](https://open-vsx.org/extension/stillwind/stillwind). An editor that
|
|
18
|
+
installs extensions from Open VSX uses the same package.
|
|
19
|
+
|
|
20
|
+
The extension needs a trusted workspace, because it runs your project
|
|
21
|
+
configuration as JavaScript.
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- Hover over utilities, `style()` calls, or bound variables to see the generated CSS.
|
|
26
|
+
- Complete utilities, variants, and theme values.
|
|
27
|
+
- Complete quoted `@plugin` paths, and follow links to their modules.
|
|
28
|
+
- See colors, and open color pickers in utilities and theme references.
|
|
29
|
+
- Apply compiler Quick Fixes.
|
|
30
|
+
- Run **Stillwind: Sort Utilities**.
|
|
31
|
+
|
|
32
|
+
Stylesheets have completion for Stillwind at-rules, and VS Code's CSS service does
|
|
33
|
+
not report these at-rules as unknown.
|
|
34
|
+
|
|
35
|
+
### Language server version
|
|
36
|
+
|
|
37
|
+
Desktop VS Code runs the `@stillwind/cli` version that the workspace installs, so
|
|
38
|
+
editor diagnostics match the compiler of that version. Install
|
|
39
|
+
[the CLI](cli.md) in the project to get this match.
|
|
40
|
+
|
|
41
|
+
The extension uses its bundled language server when the workspace has no CLI, or
|
|
42
|
+
when the CLI fails to start. The **Stillwind** output channel shows which server
|
|
43
|
+
is running.
|
|
44
|
+
|
|
45
|
+
### Settings
|
|
46
|
+
|
|
47
|
+
| Setting | Value |
|
|
48
|
+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `stillwind.configFile` | A configuration path relative to the workspace root; empty searches for `stillwind.config.*` |
|
|
50
|
+
| `stillwind.completion.registryDirectives` | `true` suggests [registry directives](at-rules/registry-directives.md) in utility libraries |
|
|
51
|
+
|
|
52
|
+
Run **Stillwind: Restart Language Server** to reload configuration and dependencies.
|
|
53
|
+
|
|
54
|
+
The `preview` field of each project in `stillwind.config.ts` controls the comments
|
|
55
|
+
after values in CSS previews:
|
|
56
|
+
|
|
57
|
+
| Option | Comment |
|
|
58
|
+
| ------------------ | ------------------------------------------------------------ |
|
|
59
|
+
| `themeValues` | Resolved theme values and evaluated `calc()` results |
|
|
60
|
+
| `pixelEquivalents` | Pixel values for `rem` |
|
|
61
|
+
| `colorEquivalents` | Hexadecimal sRGB colors; `"exact"` omits colors outside sRGB |
|
|
62
|
+
|
|
63
|
+
All three are enabled by default. With the default `colorEquivalents` value,
|
|
64
|
+
`"approximate"`, a `≈` marks colors that the preview maps into sRGB. `false` turns
|
|
65
|
+
off an option.
|
|
66
|
+
|
|
67
|
+
### Sort and fix on save
|
|
68
|
+
|
|
69
|
+
Use a [document formatter](formatters.md) for layout and whitespace, and add
|
|
70
|
+
Stillwind's Code Actions:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"editor.formatOnSave": true,
|
|
75
|
+
"editor.codeActionsOnSave": {
|
|
76
|
+
"source.fixAll.stillwind": "explicit",
|
|
77
|
+
"source.sort.stillwind": "explicit"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`source.fixAll.stillwind` applies the enabled lint fixes and respects suppression
|
|
83
|
+
comments. `source.sort.stillwind` sorts whatever the lint severity is.
|
|
84
|
+
|
|
85
|
+
`lint: false` in the project disables lint rules and fixes. `sort: false` also
|
|
86
|
+
disables explicit sorting commands. The
|
|
87
|
+
[`sort` field](configuration.md#sorting) selects what the editor sorts.
|
|
88
|
+
|
|
89
|
+
### Web VS Code
|
|
90
|
+
|
|
91
|
+
The Web extension always uses the bundled language server, and it needs a host with
|
|
92
|
+
cross-origin isolation. These limits apply:
|
|
93
|
+
|
|
94
|
+
- Project configuration can import browser-compatible modules. Node built-ins are
|
|
95
|
+
not available.
|
|
96
|
+
- The workspace filesystem must be able to read the dependencies.
|
|
97
|
+
- The default browser provider supports JS, JSX, TS, and TSX. Vue, Svelte, and
|
|
98
|
+
Astro files need a custom source or projection provider.
|
|
99
|
+
|
|
100
|
+
## Other editors
|
|
101
|
+
|
|
102
|
+
An editor with a Language Server Protocol client can start the language server from
|
|
103
|
+
the CLI. Install [the CLI](cli.md) in the project, and run this command in the
|
|
104
|
+
workspace:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
stillwind lsp --stdio
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The server discovers the configuration from each workspace folder.
|
package/docs/errors/SW10002.md
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Formatters"
|
|
3
|
+
description: "Sort utilities together with Prettier, Oxfmt, or another document formatter."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Formatters
|
|
7
|
+
|
|
8
|
+
Stillwind sorts utilities, and a document formatter controls layout and whitespace.
|
|
9
|
+
How you combine them depends on the formatter:
|
|
10
|
+
|
|
11
|
+
| Formatter | Setup |
|
|
12
|
+
| ------------------ | ---------------------------------------------------------------------- |
|
|
13
|
+
| Prettier | [The Prettier plugin](#prettier) sorts during formatting |
|
|
14
|
+
| Oxfmt or another | [Run `stillwind fmt` first](#other-formatters), then run the formatter |
|
|
15
|
+
| Any, in the editor | [Code Actions](editors.md#sort-and-fix-on-save) sort on save |
|
|
16
|
+
|
|
17
|
+
All of them read the [`sort` field](configuration.md#sorting) of
|
|
18
|
+
`stillwind.config.ts` and use the same order. Sorting runs whatever the severity of
|
|
19
|
+
[prefer-sorted-utilities](lints/prefer-sorted-utilities.md) is. To stop all
|
|
20
|
+
sorting, set `sort: false`.
|
|
21
|
+
|
|
22
|
+
Create `stillwind.config.ts` with [Getting started](index.md) first.
|
|
23
|
+
|
|
24
|
+
## Prettier
|
|
25
|
+
|
|
26
|
+
`prettier-plugin-stillwind` sorts Stillwind inputs before Prettier formats a
|
|
27
|
+
document. Install it with Prettier 3.7 or a newer 3.x version:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
vp i -D prettier prettier-plugin-stillwind
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js title="prettier.config.mjs"
|
|
34
|
+
export default {
|
|
35
|
+
plugins: ["prettier-plugin-stillwind"],
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
JavaScript, JSX, TypeScript, TSX, CSS, and Vue work without other plugins. For
|
|
40
|
+
Svelte and Astro, install their Prettier plugins, and load them before the
|
|
41
|
+
Stillwind plugin:
|
|
42
|
+
|
|
43
|
+
```js title="prettier.config.mjs"
|
|
44
|
+
export default {
|
|
45
|
+
plugins: ["prettier-plugin-svelte", "prettier-plugin-astro", "prettier-plugin-stillwind"],
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Configuration
|
|
50
|
+
|
|
51
|
+
The plugin uses the nearest `stillwind.config.*` above each file. The
|
|
52
|
+
`stillwindConfig` Prettier option selects another configuration, with a path
|
|
53
|
+
relative to the working directory. The plugin reloads the configuration for each
|
|
54
|
+
formatting request.
|
|
55
|
+
|
|
56
|
+
A file with no configuration, or outside the `files` of its project, keeps ordinary
|
|
57
|
+
Prettier formatting. An invalid explicit configuration fails the formatting
|
|
58
|
+
request, and so does incomplete or conflicting analysis.
|
|
59
|
+
|
|
60
|
+
### What the plugin changes
|
|
61
|
+
|
|
62
|
+
The plugin only sorts. To replace utilities with their canonical spellings, run
|
|
63
|
+
`stillwind lint --fix`.
|
|
64
|
+
|
|
65
|
+
- `prettier-ignore` protects the following syntax node from sorting.
|
|
66
|
+
- Range formatting protects the source outside the range.
|
|
67
|
+
- Suppression comments control lint findings and fixes, and they do not stop sorting.
|
|
68
|
+
- Sorting keeps the spelling of each token.
|
|
69
|
+
|
|
70
|
+
## Other formatters
|
|
71
|
+
|
|
72
|
+
Run `stillwind fmt` first. It sorts utilities and keeps the source layout, and the
|
|
73
|
+
formatter then controls whitespace:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
vp exec stillwind fmt
|
|
77
|
+
vp exec oxfmt
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
In CI, check both without saving files:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
vp exec stillwind fmt --check
|
|
84
|
+
vp exec oxfmt --check
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See [the CLI reference](cli.md#stillwind-fmt) for the options of `fmt`.
|
|
@@ -99,18 +99,9 @@ agent or a script reads the results.
|
|
|
99
99
|
|
|
100
100
|
## Check while you edit
|
|
101
101
|
|
|
102
|
-
The
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"editor.codeActionsOnSave": {
|
|
109
|
-
"source.fixAll.stillwind": "explicit",
|
|
110
|
-
"source.sort.stillwind": "explicit"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
102
|
+
The VS Code extension shows findings as you type, including in unsaved files. It also offers the
|
|
103
|
+
automatic fixes as Quick Fixes, and it can fix and sort on save. See [Editors](../editors.md) for
|
|
104
|
+
the setup.
|
|
114
105
|
|
|
115
106
|
## Allow an exception
|
|
116
107
|
|
|
@@ -29,6 +29,8 @@ the reset until the old styles are gone:
|
|
|
29
29
|
@import "stillwind/templates.css";
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
[Stylesheets](../concepts/stylesheets.md) describes each of these files.
|
|
33
|
+
|
|
32
34
|
Stillwind's CSS is in cascade layers. A declaration outside a layer wins over a
|
|
33
35
|
declaration in a layer, whatever their specificity. While an old rule matches an
|
|
34
36
|
element, it overrides the utilities on that element. Remove the old rule when
|
package/docs/guides/style.md
CHANGED
|
@@ -175,7 +175,7 @@ such as state updates or I/O, before you call `style()`.
|
|
|
175
175
|
|
|
176
176
|
## Next steps
|
|
177
177
|
|
|
178
|
-
- [Reusable styles](reusable-styles.md)
|
|
179
|
-
- [Responsive styles](responsive-styles.md)
|
|
180
|
-
- [Checks in the editor and CI](lint-adoption.md)
|
|
181
|
-
- [The style() reference](../macros/style.md)
|
|
178
|
+
- [Reusable styles](reusable-styles.md): how to share styles and define component options
|
|
179
|
+
- [Responsive styles](responsive-styles.md): how to name breakpoints and use them in JavaScript
|
|
180
|
+
- [Checks in the editor and CI](lint-adoption.md): how to find misspelled utilities and other mistakes
|
|
181
|
+
- [The style() reference](../macros/style.md): every accepted input
|
|
@@ -59,6 +59,9 @@ Load these packages with `@plugin`:
|
|
|
59
59
|
| `@headlessui/tailwindcss` | `ui-open:` |
|
|
60
60
|
| `@iconify/tailwind4` | `icon-[lucide--home]` |
|
|
61
61
|
|
|
62
|
+
For Iconify icons, Stillwind also provides the
|
|
63
|
+
[`@stillwind/plugin-iconify`](../plugins/iconify.md) plugin.
|
|
64
|
+
|
|
62
65
|
Load these packages with `@import`:
|
|
63
66
|
|
|
64
67
|
| Package | Example |
|
package/docs/index.md
CHANGED
|
@@ -124,10 +124,12 @@ Run the CLI in CI to catch such mistakes before you merge them.
|
|
|
124
124
|
|
|
125
125
|
## Next steps
|
|
126
126
|
|
|
127
|
-
- [Why Stillwind](why.md)
|
|
128
|
-
- [The basics of style()](guides/style.md)
|
|
129
|
-
- [Design systems](guides/design-systems.md)
|
|
130
|
-
- [Checks in the editor and CI](guides/lint-adoption.md)
|
|
127
|
+
- [Why Stillwind](why.md): what Stillwind checks and why
|
|
128
|
+
- [The basics of style()](guides/style.md): variants, conditions, and reusable styles
|
|
129
|
+
- [Design systems](guides/design-systems.md): how to restrict colors, spacing, and breakpoints to your theme
|
|
130
|
+
- [Checks in the editor and CI](guides/lint-adoption.md): how to run the checks in CI and the editor
|
|
131
|
+
- [Editors](editors.md): how to install the extension
|
|
132
|
+
- [Formatters](formatters.md): how to sort utilities with your formatter
|
|
131
133
|
|
|
132
134
|
## Set up with an AI agent
|
|
133
135
|
|
package/docs/integrations.md
CHANGED
|
@@ -58,6 +58,9 @@ For Fresh, use Deno 2.9 or newer and register `fresh()` before `stillwind()` fro
|
|
|
58
58
|
`@stillwind/integration/fresh` in the Vite configuration. The adapter keeps server
|
|
59
59
|
and island classes consistent. Fresh's legacy Builder is unsupported.
|
|
60
60
|
|
|
61
|
+
On Linux, and possibly macOS, Fresh development and builds fail with `Bad file descriptor (os error 9)`
|
|
62
|
+
when Stillwind starts the TypeScript checker under Deno.
|
|
63
|
+
|
|
61
64
|
## Vanilla JavaScript
|
|
62
65
|
|
|
63
66
|
Import the DOM helpers with the macro:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "implicit-nesting-selector"
|
|
3
3
|
description: "Reports a custom variant selector without &, which matches descendants."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# implicit-nesting-selector
|
|
7
7
|
|
|
8
8
|
This rule reports a `@custom-variant` selector without `&`. Without `&`, the
|
|
9
9
|
selector matches descendants of the element, not the element itself. In the
|
|
@@ -15,7 +15,7 @@ example, `hocus:` would match hovered elements inside the element.
|
|
|
15
15
|
@custom-variant hocus (:hover);
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
>
|
|
18
|
+
> implicit-nesting-selector: variant selector `:hover` is relative to `&` and means `& :hover`; write the `&`, or add `scope(document)` to the definition to select a document-level element
|
|
19
19
|
>
|
|
20
20
|
> Example:1:24
|
|
21
21
|
|
package/docs/lints/index.md
CHANGED
|
@@ -20,11 +20,11 @@ A utility or variant that these rules report produces no CSS.
|
|
|
20
20
|
|
|
21
21
|
| Rule | Reports | Default |
|
|
22
22
|
| ---------------------------------------------------- | ------------------------------------------------------------- | ------- |
|
|
23
|
-
| [
|
|
23
|
+
| [invalid-marker-use](invalid-marker-use.md) | A marker class such as `group` with a variant or `!` | warn |
|
|
24
24
|
| [invalid-utility](invalid-utility.md) | A known utility written in a form that it does not accept | deny |
|
|
25
|
-
| [unknown-variant](unknown-variant.md) | A variant that your stylesheet does not define | warn |
|
|
26
25
|
| [invalid-variant](invalid-variant.md) | A known variant with an invalid value, such as `min-[foo]:` | deny |
|
|
27
|
-
| [
|
|
26
|
+
| [unknown-utility](unknown-utility.md) | A utility or theme value that your stylesheet does not define | deny |
|
|
27
|
+
| [unknown-variant](unknown-variant.md) | A variant that your stylesheet does not define | deny |
|
|
28
28
|
|
|
29
29
|
## Invalid arguments to Stillwind APIs
|
|
30
30
|
|
|
@@ -33,41 +33,41 @@ report never matches.
|
|
|
33
33
|
|
|
34
34
|
| Rule | Reports | Default |
|
|
35
35
|
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- | ------- |
|
|
36
|
-
| [invalid-
|
|
37
|
-
| [invalid-rule-group-input](invalid-rule-group-input.md) | A `class` field or ref inside a variant key of `style()` | deny |
|
|
38
|
-
| [invalid-style-composition](invalid-style-composition.md) | Inline styles or custom properties in a base style, which do not carry over | deny |
|
|
36
|
+
| [invalid-animation-option](invalid-animation-option.md) | A utility that is not an animation option, such as `p-4` | deny |
|
|
39
37
|
| [invalid-css-input](invalid-css-input.md) | A `style.css()` argument that is not a static utility | deny |
|
|
40
|
-
| [missing-document-target](missing-document-target.md) | A `style.css()` utility without a selector | deny |
|
|
41
|
-
| [invalid-ref-input](invalid-ref-input.md) | A `style.ref()` label or ref method argument that is not a literal | deny |
|
|
42
38
|
| [invalid-cva-config](invalid-cva-config.md) | An unknown or malformed field in a `style.cva()` configuration | deny |
|
|
43
39
|
| [invalid-cva-input](invalid-cva-input.md) | `&&` or a ternary inside a `style.cva()` value | deny |
|
|
44
40
|
| [invalid-keyframes-definition](invalid-keyframes-definition.md) | A frame key that is not a keyframe position, such as `middle` | deny |
|
|
45
|
-
| [invalid-keyframes-variant](invalid-keyframes-variant.md) | A selector or container variant around a keyframes definition | deny |
|
|
46
41
|
| [invalid-keyframes-use](invalid-keyframes-use.md) | An animation applied with an argument that is not an options string | deny |
|
|
47
|
-
| [invalid-
|
|
48
|
-
| [invalid-view-transition-definition](invalid-view-transition-definition.md) | An unknown field in a `style.viewTransition()` definition | deny |
|
|
49
|
-
| [invalid-view-transition-variant](invalid-view-transition-variant.md) | A state or container variant in a view transition definition | deny |
|
|
50
|
-
| [invalid-view-transition-use](invalid-view-transition-use.md) | Extra or invalid arguments to `.for()` | deny |
|
|
42
|
+
| [invalid-keyframes-variant](invalid-keyframes-variant.md) | A selector or container variant around a keyframes definition | deny |
|
|
51
43
|
| [invalid-media-query](invalid-media-query.md) | A condition in `style.media()` that is not a media query, such as `hover` | deny |
|
|
44
|
+
| [invalid-ref-input](invalid-ref-input.md) | A `style.ref()` label or ref method argument that is not a literal | deny |
|
|
45
|
+
| [invalid-rule-group-input](invalid-rule-group-input.md) | A `class` field or ref inside a variant key of `style()` | deny |
|
|
52
46
|
| [invalid-runtime-condition](invalid-runtime-condition.md) | A runtime CSS condition that Stillwind cannot compile | deny |
|
|
47
|
+
| [invalid-style-composition](invalid-style-composition.md) | Inline styles or custom properties in a base style, which do not carry over | deny |
|
|
48
|
+
| [invalid-style-input](invalid-style-input.md) | A `style()` argument that it cannot compile, such as a number | deny |
|
|
49
|
+
| [invalid-view-transition-definition](invalid-view-transition-definition.md) | An unknown field in a `style.viewTransition()` definition | deny |
|
|
50
|
+
| [invalid-view-transition-use](invalid-view-transition-use.md) | Extra or invalid arguments to `.for()` | deny |
|
|
51
|
+
| [invalid-view-transition-variant](invalid-view-transition-variant.md) | A state or container variant in a view transition definition | deny |
|
|
52
|
+
| [missing-document-target](missing-document-target.md) | A `style.css()` utility without a selector | deny |
|
|
53
53
|
| [runtime-condition-requires-css-if](runtime-condition-requires-css-if.md) | A runtime CSS condition that needs `useCssIf` | deny |
|
|
54
54
|
|
|
55
55
|
## Arguments and imports
|
|
56
56
|
|
|
57
57
|
| Rule | Reports | Default |
|
|
58
58
|
| ---------------------------------------------------------------------- | ----------------------------------------------------------- | ------- |
|
|
59
|
+
| [mismatched-framework-import](mismatched-framework-import.md) | An import from the entrypoint of another framework | warn |
|
|
59
60
|
| [mutating-macro-argument](mutating-macro-argument.md) | A state update inside a `style()` argument | deny |
|
|
60
61
|
| [suspending-macro-argument](suspending-macro-argument.md) | `await`, `yield`, or `import()` inside a `style()` argument | deny |
|
|
61
|
-
| [mismatched-framework-import](mismatched-framework-import.md) | An import from the entrypoint of another framework | warn |
|
|
62
62
|
|
|
63
63
|
## Conflicting or duplicated styles
|
|
64
64
|
|
|
65
65
|
| Rule | Reports | Default |
|
|
66
66
|
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------- |
|
|
67
|
+
| [ambiguous-style-base-order](ambiguous-style-base-order.md) | Two base styles in one call that set the same property | warn |
|
|
68
|
+
| [conflicting-provider-properties](conflicting-provider-properties.md) | A container or anchor property that a ref method and a utility both set | warn |
|
|
67
69
|
| [conflicting-utilities](conflicting-utilities.md) | Utilities that set the same property, such as `p-2 p-4` | warn |
|
|
68
70
|
| [duplicate-utility](duplicate-utility.md) | The same utility twice under the same conditions | warn |
|
|
69
|
-
| [conflicting-provider-properties](conflicting-provider-properties.md) | A container or anchor property that a ref method and a utility both set | warn |
|
|
70
|
-
| [ambiguous-style-base-order](ambiguous-style-base-order.md) | Two base styles in one call that set the same property | warn |
|
|
71
71
|
| [interfering-imported-style-base](interfering-imported-style-base.md) | An imported base style that sets the same property as another style | warn |
|
|
72
72
|
| [unverified-style-base](unverified-style-base.md) | A base style whose origin the CLI cannot determine from its type | warn |
|
|
73
73
|
|
|
@@ -75,29 +75,30 @@ report never matches.
|
|
|
75
75
|
|
|
76
76
|
| Rule | Reports | Default |
|
|
77
77
|
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------- |
|
|
78
|
-
| [
|
|
78
|
+
| [clamped-value](clamped-value.md) | A value outside the range that the browser uses, such as opacity above 1 | warn |
|
|
79
|
+
| [document-scoped-selector](document-scoped-selector.md) | A selector that styles the whole document instead of the element | deny |
|
|
80
|
+
| [duplicate-view-transition-name](duplicate-view-transition-name.md) | Two `.for()` calls in one `style()` call | warn |
|
|
81
|
+
| [incompatible-property-value](incompatible-property-value.md) | A value that the browser rejects for the property | deny |
|
|
79
82
|
| [ineffective-anchor-scope](ineffective-anchor-scope.md) | An empty or repeated ref list in an anchor scope | warn |
|
|
83
|
+
| [missing-ref-attachment](missing-ref-attachment.md) | `asContainer()` or `asAnchor()` in a call that does not attach the ref | warn |
|
|
80
84
|
| [missing-view-transition-name](missing-view-transition-name.md) | A view transition applied without `.for()` | warn |
|
|
81
|
-
| [duplicate-view-transition-name](duplicate-view-transition-name.md) | Two `.for()` calls in one `style()` call | warn |
|
|
82
|
-
| [split-view-transition-class](split-view-transition-class.md) | View transitions split across separate `style()` calls | warn |
|
|
83
|
-
| [document-scoped-selector](document-scoped-selector.md) | A selector that styles the whole document instead of the element | deny |
|
|
84
85
|
| [repeated-nesting-selector](repeated-nesting-selector.md) | A selector that repeats `&` to relate two elements | warn |
|
|
85
|
-
| [
|
|
86
|
-
| [clamped-value](clamped-value.md) | A value outside the range that the browser uses, such as opacity above 1 | warn |
|
|
86
|
+
| [split-view-transition-class](split-view-transition-class.md) | View transitions split across separate `style()` calls | warn |
|
|
87
87
|
| [unsatisfiable-variants](unsatisfiable-variants.md) | Variants that can never match together, such as `portrait:landscape:` | warn |
|
|
88
88
|
|
|
89
89
|
## Stylesheet definitions
|
|
90
90
|
|
|
91
91
|
| Rule | Reports | Default |
|
|
92
92
|
| ------------------------------------------------------------------------ | ---------------------------------------------------------------- | ------- |
|
|
93
|
-
| [invalid-css-import](invalid-css-import.md) | A stylesheet import that cannot be resolved | deny |
|
|
94
|
-
| [invalid-css-directive](invalid-css-directive.md) | A malformed or unsupported Stillwind directive | deny |
|
|
95
|
-
| [invalid-theme-reference](invalid-theme-reference.md) | A reference to a theme token that is not defined | deny |
|
|
96
|
-
| [incompatible-theme-value](incompatible-theme-value.md) | A theme value of the wrong type, such as a length for a color | deny |
|
|
97
|
-
| [duplicate-definition](duplicate-definition.md) | A utility or variant definition that replaces an earlier one | warn |
|
|
98
93
|
| [bypassed-undefinition](bypassed-undefinition.md) | A definition that bypasses an undefinition in another context | warn |
|
|
94
|
+
| [duplicate-definition](duplicate-definition.md) | A utility or variant definition that replaces an earlier one | warn |
|
|
99
95
|
| [ignored-definition-condition](ignored-definition-condition.md) | A media rule around a definition, which the compiler ignores | deny |
|
|
100
96
|
| [ignored-tailwind-feature](ignored-tailwind-feature.md) | Tailwind-only directives such as `@config`, which have no effect | warn |
|
|
97
|
+
| [implicit-nesting-selector](implicit-nesting-selector.md) | A custom variant selector without `&`, which selects descendants | warn |
|
|
98
|
+
| [incompatible-theme-value](incompatible-theme-value.md) | A theme value of the wrong type, such as a length for a color | deny |
|
|
99
|
+
| [invalid-css-directive](invalid-css-directive.md) | A malformed or unsupported Stillwind directive | deny |
|
|
100
|
+
| [invalid-css-import](invalid-css-import.md) | A stylesheet import that cannot be resolved | deny |
|
|
101
|
+
| [invalid-theme-reference](invalid-theme-reference.md) | A reference to a theme token that is not defined | deny |
|
|
101
102
|
|
|
102
103
|
## Project policies
|
|
103
104
|
|
|
@@ -105,32 +106,31 @@ These rules enforce choices of your project. No preset enables them.
|
|
|
105
106
|
|
|
106
107
|
| Rule | Reports | Default |
|
|
107
108
|
| -------------------------------------------------------------------- | ------------------------------------------------------------- | ------- |
|
|
109
|
+
| [no-arbitrary-breakpoints](no-arbitrary-breakpoints.md) | Viewport widths written as values, such as `min-[713px]:` | off |
|
|
108
110
|
| [no-arbitrary-colors](no-arbitrary-colors.md) | Colors written as values, such as `bg-[#123456]` | off |
|
|
109
111
|
| [no-arbitrary-spacing](no-arbitrary-spacing.md) | Spacing written as values, such as `p-[13px]` | off |
|
|
110
|
-
| [no-
|
|
111
|
-
| [no-
|
|
112
|
-
| [no-restricted-utilities](no-restricted-utilities.md) | The utilities that you list | off |
|
|
112
|
+
| [no-class-property](no-class-property.md) | The `class` field, which adds classes without generated CSS | off |
|
|
113
|
+
| [no-important](no-important.md) | The `!` modifier | off |
|
|
113
114
|
| [no-restricted-declarations](no-restricted-declarations.md) | Utilities that produce the CSS declarations that you list | off |
|
|
114
115
|
| [no-restricted-length-units](no-restricted-length-units.md) | Length units that you forbid for the properties that you list | off |
|
|
115
|
-
| [no-
|
|
116
|
-
| [no-
|
|
116
|
+
| [no-restricted-theme-tokens](no-restricted-theme-tokens.md) | Utilities that use the theme tokens that you list | off |
|
|
117
|
+
| [no-restricted-utilities](no-restricted-utilities.md) | The utilities that you list | off |
|
|
117
118
|
|
|
118
119
|
## Preferred spelling
|
|
119
120
|
|
|
120
121
|
These rules report code that works but has a clearer form. The `stylistic`
|
|
121
122
|
preset enables the rules that are off by default.
|
|
122
123
|
|
|
123
|
-
| Rule
|
|
124
|
-
|
|
|
125
|
-
| [prefer-canonical-utilities](prefer-canonical-utilities.md)
|
|
126
|
-
| [
|
|
127
|
-
| [prefer-
|
|
128
|
-
| [prefer-sorted-utilities](prefer-sorted-utilities.md)
|
|
129
|
-
| [prefer-typed-relationships](prefer-typed-relationships.md)
|
|
130
|
-
| [prefer-
|
|
131
|
-
| [prefer-
|
|
132
|
-
| [
|
|
133
|
-
| [prefer-variant-directive](prefer-variant-directive.md) | A media rule in your CSS that a named variant can replace | off |
|
|
124
|
+
| Rule | Reports | Default |
|
|
125
|
+
| -------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------- |
|
|
126
|
+
| [prefer-canonical-utilities](prefer-canonical-utilities.md) | A utility with a shorter equivalent, such as `px-[16px]` for `px-4` | warn |
|
|
127
|
+
| [prefer-direct-styling](prefer-direct-styling.md) | A selector that styles another element, such as `[&_button]:` | off |
|
|
128
|
+
| [prefer-logical-properties](prefer-logical-properties.md) | A physical property with a logical form, such as `ml-4` | off |
|
|
129
|
+
| [prefer-sorted-utilities](prefer-sorted-utilities.md) | Utilities that are not in sorted order | off |
|
|
130
|
+
| [prefer-typed-relationships](prefer-typed-relationships.md) | `group-*` and `peer-*` variants that a ref can replace | off |
|
|
131
|
+
| [prefer-typed-variables](prefer-typed-variables.md) | A custom property without a type in a utility that accepts several types | off |
|
|
132
|
+
| [prefer-variant-directive](prefer-variant-directive.md) | A media rule in your CSS that a named variant can replace | off |
|
|
133
|
+
| [redundant-variant](redundant-variant.md) | A variant that adds no condition, such as `hover:hover:` | warn |
|
|
134
134
|
|
|
135
135
|
## Suppression comments
|
|
136
136
|
|
|
@@ -13,6 +13,20 @@ definitions.
|
|
|
13
13
|
Within one string or one CSS `@apply` statement, it can combine utilities such as
|
|
14
14
|
`w-4 h-4` into `size-4`. Utilities must have the same variants and importance.
|
|
15
15
|
|
|
16
|
+
## Theme tokens
|
|
17
|
+
|
|
18
|
+
A replacement keeps every theme token that the original utility references. For
|
|
19
|
+
example, `w-96` stays as written even when `--container-sm` has the same value, because
|
|
20
|
+
the two tokens can differ after a theme change.
|
|
21
|
+
|
|
22
|
+
A fixed value becomes a token only when the choice is clear:
|
|
23
|
+
|
|
24
|
+
- A spacing multiple comes first, so `w-[448px]` becomes `w-112`, not `w-md`.
|
|
25
|
+
- A named token is used when no spacing multiple fits and it is the only match, so
|
|
26
|
+
`rounded-[8px]` becomes `rounded-lg`.
|
|
27
|
+
- The value stays as written when unrelated named tokens match it. An alias of a token
|
|
28
|
+
does not count as an unrelated token.
|
|
29
|
+
|
|
16
30
|
## Reported
|
|
17
31
|
|
|
18
32
|
```tsx
|
|
@@ -33,6 +33,24 @@ style("ms-4");
|
|
|
33
33
|
- If the side must stay on the left in every language, such as for an icon that
|
|
34
34
|
points left, keep the physical form and add a
|
|
35
35
|
[suppression comment](../configuration.md#suppression-comments).
|
|
36
|
+
- For `overflow-x-*`, `overflow-y-*`, `overscroll-x-*`, `overscroll-y-*`, and
|
|
37
|
+
`divide-y-*`, import
|
|
38
|
+
the matching [logical stylesheet](../concepts/stylesheets.md#logical-axis-utilities).
|
|
39
|
+
These utilities then keep their names and write logical properties.
|
|
40
|
+
|
|
41
|
+
## Shorthands
|
|
42
|
+
|
|
43
|
+
A shorthand that gives every side the same value does not depend on the writing
|
|
44
|
+
direction, so this rule does not report `p-4` or `overflow-hidden`.
|
|
45
|
+
|
|
46
|
+
The rule reports a shorthand with different values for its sides, such as
|
|
47
|
+
`[padding:1rem_2rem]`. It also reports a shorthand that sets only some sides, such
|
|
48
|
+
as `[border-top:var(--border)]`, for every value.
|
|
49
|
+
|
|
50
|
+
The rule does not report a single variable in a shorthand for all sides, such as
|
|
51
|
+
`[padding:var(--gap)]`, because the compiler cannot determine which values the
|
|
52
|
+
variable holds. With a second value, as in `[padding:var(--gap)_1rem]`, the two
|
|
53
|
+
values differ, so the rule reports the shorthand.
|
|
36
54
|
|
|
37
55
|
## Rule settings
|
|
38
56
|
|