@webjsdev/ui 0.3.13 → 0.3.15
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 +1 -0
- package/package.json +3 -2
- package/packages/registry/components/alert-dialog.ts +19 -7
- package/packages/registry/components/dialog.ts +18 -7
- package/packages/registry/components/sonner.ts +51 -17
- package/src/commands/lint.js +93 -0
- package/src/index.js +3 -1
- package/src/lint/grammar.js +839 -0
- package/src/lint/index.js +205 -0
- package/src/lint/rules/index.js +12 -0
- package/src/lint/rules/no-arbitrary-values.js +33 -0
- package/src/lint/rules/no-raw-colors.js +86 -0
- package/src/lint/rules/no-restyle.js +66 -0
- package/src/lint/scan.js +446 -0
- package/src/lint/theme-tokens.js +75 -0
- package/src/registry/extract.js +166 -0
- package/src/registry/schema.js +38 -0
package/src/registry/schema.js
CHANGED
|
@@ -82,6 +82,43 @@ export const registryItemCommonSchema = z.object({
|
|
|
82
82
|
categories: z.array(z.string()).optional(),
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
+
/** A rule's severity. Absent from `lint.rules` means `off`. */
|
|
86
|
+
export const lintSeveritySchema = z.enum(['off', 'warn', 'error']);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* One rule's configuration: a bare severity, or an object adding `allow`
|
|
90
|
+
* (category names such as `layout` / `spacing`, or class-group names such
|
|
91
|
+
* as `rounded`). Kept `.strict()` so a typo is a config error, not a silent
|
|
92
|
+
* no-op.
|
|
93
|
+
*/
|
|
94
|
+
export const lintRuleSchema = z.union([
|
|
95
|
+
lintSeveritySchema,
|
|
96
|
+
z
|
|
97
|
+
.object({
|
|
98
|
+
severity: lintSeveritySchema.default('warn'),
|
|
99
|
+
allow: z.array(z.string()).optional(),
|
|
100
|
+
})
|
|
101
|
+
.strict(),
|
|
102
|
+
]);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The opt-in `lint` block of `components.json`, read by `webjsui lint`. No
|
|
106
|
+
* block means every rule is off and the command reports nothing.
|
|
107
|
+
*/
|
|
108
|
+
export const lintConfigSchema = z
|
|
109
|
+
.object({
|
|
110
|
+
ignore: z.array(z.string()).default([]),
|
|
111
|
+
rules: z
|
|
112
|
+
.object({
|
|
113
|
+
'no-raw-colors': lintRuleSchema.optional(),
|
|
114
|
+
'no-arbitrary-values': lintRuleSchema.optional(),
|
|
115
|
+
'no-restyle': lintRuleSchema.optional(),
|
|
116
|
+
})
|
|
117
|
+
.strict()
|
|
118
|
+
.default({}),
|
|
119
|
+
})
|
|
120
|
+
.strict();
|
|
121
|
+
|
|
85
122
|
export const rawConfigSchema = z
|
|
86
123
|
.object({
|
|
87
124
|
$schema: z.string().optional(),
|
|
@@ -94,6 +131,7 @@ export const rawConfigSchema = z
|
|
|
94
131
|
prefix: z.string().default('').optional(),
|
|
95
132
|
}),
|
|
96
133
|
iconLibrary: z.string().optional().default('lucide'),
|
|
134
|
+
lint: lintConfigSchema.optional(),
|
|
97
135
|
aliases: z.object({
|
|
98
136
|
components: z.string().default('components'),
|
|
99
137
|
utils: z.string().default('lib/utils'),
|