@typestyles/eslint-plugin 0.0.0-unstable.9ce64160b32e → 0.0.0-unstable.9ddc7a7c75fd
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 +14 -14
- package/dist/index.cjs +833 -699
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -133
- package/dist/index.d.ts +135 -133
- package/dist/index.js +805 -690
- package/dist/index.js.map +1 -1
- package/package.json +14 -15
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @typestyles/eslint-plugin
|
|
2
2
|
|
|
3
|
-
ESLint rules for [typestyles](https://github.com/
|
|
3
|
+
ESLint rules for [typestyles](https://github.com/phthalo-dev/typestyles) style objects — catch authoring mistakes at edit time that would otherwise produce invalid or silently wrong CSS.
|
|
4
4
|
|
|
5
5
|
StyleX and similar tools reject conflicting declarations at compile time. TypeStyles is runtime-first, so these rules fill the gap: shorthand/longhand conflicts, invalid unitless values, and duplicate namespaces across files.
|
|
6
6
|
|
|
@@ -34,16 +34,16 @@ Disallows mixing CSS shorthand and longhand in the same style object.
|
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
36
|
// ❌ paddingTop is ignored unpredictably
|
|
37
|
-
|
|
37
|
+
style('card', {
|
|
38
38
|
padding: '8px',
|
|
39
39
|
paddingTop: '16px',
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
// ✅ pick one
|
|
43
|
-
|
|
43
|
+
style('card', { padding: '8px 8px 8px 16px' });
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Applies to `
|
|
46
|
+
Applies to `recipe`, `style`, variant objects, and nested selectors inside those calls. Also applies to legacy `styles.component` / `styles.class` on `createStyles()` instances.
|
|
47
47
|
|
|
48
48
|
### `@typestyles/no-invalid-unitless-value`
|
|
49
49
|
|
|
@@ -51,11 +51,11 @@ Catches bare number **strings** on properties that need units. TypeStyles auto-a
|
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
53
|
// ❌ emits invalid `line-height: 24px` is fine, but `"24"` as string does not get px
|
|
54
|
-
|
|
54
|
+
style('text', { lineHeight: '24' });
|
|
55
55
|
|
|
56
56
|
// ✅
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
style('text', { lineHeight: 24 }); // → 24px where applicable
|
|
58
|
+
style('text', { lineHeight: '1.5' }); // unitless ratio as string
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Optional rule option `checkSuspiciousUnitlessNumbers` warns when a numeric literal is used on truly unitless properties (e.g. `lineHeight: 24` vs `lineHeight: 1.5`).
|
|
@@ -66,15 +66,15 @@ Disallows reusing the same logical namespace across the project:
|
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
68
|
// file-a.ts
|
|
69
|
-
|
|
69
|
+
recipe({ name: 'button', styles: { base: { … } } });
|
|
70
70
|
|
|
71
71
|
// file-b.ts — ❌ collision
|
|
72
|
-
|
|
72
|
+
recipe({ name: 'button', styles: { base: { … } } });
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Tracks `
|
|
75
|
+
Tracks `recipe`, `style`, `hash`, `tokens.create`, `tokens.createTheme`, `keyframes.create`, and `global.rule` / `global.fontFace` (and legacy `styles.component`, `styles.class`, `global.style` where used). Reports duplicates within a file and across files in the same ESLint run.
|
|
76
76
|
|
|
77
|
-
> Bundler plugins (`@typestyles/vite`, etc.) also fail the build on duplicate `
|
|
77
|
+
> Bundler plugins (`@typestyles/vite`, etc.) also fail the build on duplicate `recipe` / `style` namespaces. ESLint catches the issue earlier in the editor.
|
|
78
78
|
|
|
79
79
|
### `@typestyles/no-removed-public-classname` (opt-in)
|
|
80
80
|
|
|
@@ -89,13 +89,13 @@ Guards **publishable** design systems against semver-breaking semantic class ren
|
|
|
89
89
|
|
|
90
90
|
Adding new class names never fails — only removals or renames do.
|
|
91
91
|
|
|
92
|
-
**Diagnostics** are reported once per ESLint run (on `Program:exit`), not at the specific `
|
|
92
|
+
**Diagnostics** are reported once per ESLint run (on `Program:exit`), not at the specific `recipe()` call site. Treat them as project-level semver checks, similar to `no-duplicate-namespace`.
|
|
93
93
|
|
|
94
94
|
**Static analysis limits** (best-effort, not exhaustive):
|
|
95
95
|
|
|
96
96
|
- Namespace must be a **string literal** — variables and template literals are skipped
|
|
97
|
-
-
|
|
98
|
-
- Projects with multiple `createStyles({ scopeId })` configs only infer a default binding when all configs agree
|
|
97
|
+
- Direct `recipe()` / `style()` calls and legacy `styles.component()` / `binding.component()` on `createStyles` bindings are found
|
|
98
|
+
- Projects with multiple `createTypeStyles({ scopeId })` / `createStyles({ scopeId })` configs only infer a default binding when all configs agree
|
|
99
99
|
|
|
100
100
|
## Enable individual rules
|
|
101
101
|
|