uilint 0.2.3 → 0.2.4
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/dist/index.js +467 -322
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/skills/ui-consistency-enforcer/SKILL.md +40 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uilint",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "CLI for UILint - AI-powered UI consistency checking",
|
|
5
5
|
"author": "Peter Suggate",
|
|
6
6
|
"repository": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"magicast": "^0.3.5",
|
|
44
44
|
"picocolors": "^1.1.1",
|
|
45
45
|
"ws": "^8.18.0",
|
|
46
|
-
"uilint-core": "0.2.
|
|
47
|
-
"uilint-eslint": "0.2.
|
|
46
|
+
"uilint-core": "0.2.4",
|
|
47
|
+
"uilint-eslint": "0.2.4"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
50
|
"@langfuse/client": "^4.5.1",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"typecheck": "tsc --noEmit",
|
|
78
78
|
"lint": "eslint src/",
|
|
79
79
|
"test": "vitest",
|
|
80
|
+
"test:watch": "vitest --watch",
|
|
80
81
|
"test:unit": "vitest run test/unit",
|
|
81
82
|
"test:integration": "vitest run test/integration"
|
|
82
83
|
}
|
|
@@ -13,7 +13,7 @@ metadata:
|
|
|
13
13
|
version: "1.0.0"
|
|
14
14
|
category: react-eslint
|
|
15
15
|
compatibility: |
|
|
16
|
-
Requires
|
|
16
|
+
Requires TypeScript project with @typescript-eslint,
|
|
17
17
|
and uilint-eslint package installed.
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -56,21 +56,22 @@ Ask clarifying questions if needed before proceeding.
|
|
|
56
56
|
|
|
57
57
|
### Step 2: Analyze Existing Rules
|
|
58
58
|
|
|
59
|
-
Look at
|
|
59
|
+
Look at existing rules installed in the project for patterns:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
ls
|
|
62
|
+
ls .uilint/rules/
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
65
|
+
If no rules exist yet, you can reference examples from the uilint-eslint package or look at similar patterns. Common rule patterns include:
|
|
66
|
+
|
|
67
|
+
- Component analysis and hook counting
|
|
68
|
+
- Cross-file analysis and import tracking
|
|
69
|
+
- className/Tailwind pattern matching
|
|
70
|
+
- Attribute analysis in JSX
|
|
70
71
|
|
|
71
72
|
### Step 3: Write the Rule
|
|
72
73
|
|
|
73
|
-
Create the rule file at
|
|
74
|
+
Create the rule file at `.uilint/rules/{rule-name}.ts` in the target project.
|
|
74
75
|
|
|
75
76
|
Follow this structure exactly:
|
|
76
77
|
|
|
@@ -81,7 +82,7 @@ Follow this structure exactly:
|
|
|
81
82
|
* {Description of what this rule does and why}
|
|
82
83
|
*/
|
|
83
84
|
|
|
84
|
-
import { createRule } from "
|
|
85
|
+
import { createRule } from "uilint-eslint";
|
|
85
86
|
import type { TSESTree } from "@typescript-eslint/utils";
|
|
86
87
|
|
|
87
88
|
type MessageIds = "{messageId1}" | "{messageId2}";
|
|
@@ -143,7 +144,7 @@ export default createRule<Options, MessageIds>({
|
|
|
143
144
|
|
|
144
145
|
### Step 4: Write Comprehensive Tests
|
|
145
146
|
|
|
146
|
-
Create the test file at
|
|
147
|
+
Create the test file at `.uilint/rules/{rule-name}.test.ts` in the target project.
|
|
147
148
|
|
|
148
149
|
Follow this structure:
|
|
149
150
|
|
|
@@ -239,45 +240,32 @@ ruleTester.run("{rule-name}", rule, {
|
|
|
239
240
|
});
|
|
240
241
|
```
|
|
241
242
|
|
|
242
|
-
### Step 5:
|
|
243
|
+
### Step 5: Configure ESLint to Use the Rule
|
|
243
244
|
|
|
244
|
-
|
|
245
|
+
The rule will be automatically configured in your `eslint.config.{js,ts,mjs,cjs}` file. The installer creates a custom plugin that references your local rules:
|
|
245
246
|
|
|
246
|
-
```
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
type: "select" | "text" | "boolean" | "number",
|
|
259
|
-
defaultValue: "default",
|
|
260
|
-
options: [{ value: "x", label: "X" }], // for select
|
|
261
|
-
description: "Help text",
|
|
247
|
+
```javascript
|
|
248
|
+
import { createRule } from "uilint-eslint";
|
|
249
|
+
import yourRuleName from "./.uilint/rules/your-rule-name.js";
|
|
250
|
+
|
|
251
|
+
export default [
|
|
252
|
+
// ... existing config
|
|
253
|
+
{
|
|
254
|
+
plugins: {
|
|
255
|
+
"uilint-custom": {
|
|
256
|
+
rules: {
|
|
257
|
+
"your-rule-name": yourRuleName,
|
|
258
|
+
},
|
|
262
259
|
},
|
|
263
|
-
|
|
260
|
+
},
|
|
261
|
+
rules: {
|
|
262
|
+
"uilint-custom/your-rule-name": "error",
|
|
263
|
+
},
|
|
264
264
|
},
|
|
265
|
-
|
|
266
|
-
},
|
|
265
|
+
];
|
|
267
266
|
```
|
|
268
267
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
# Regenerate the index file
|
|
273
|
-
pnpm -C packages/uilint-eslint generate:index
|
|
274
|
-
|
|
275
|
-
# Run the tests
|
|
276
|
-
pnpm -C packages/uilint-eslint test
|
|
277
|
-
|
|
278
|
-
# Build to verify
|
|
279
|
-
pnpm -C packages/uilint-eslint build
|
|
280
|
-
```
|
|
268
|
+
If you're creating the rule manually (not via the installer), you'll need to add the import and configure it in your ESLint config.
|
|
281
269
|
|
|
282
270
|
## Common AST Patterns
|
|
283
271
|
|
|
@@ -401,6 +389,7 @@ import { getComponentLibrary, clearCache } from "../utils/import-graph.js";
|
|
|
401
389
|
3. Use placeholders for dynamic content
|
|
402
390
|
|
|
403
391
|
Good:
|
|
392
|
+
|
|
404
393
|
```typescript
|
|
405
394
|
messages: {
|
|
406
395
|
useDesignSystem:
|
|
@@ -409,6 +398,7 @@ messages: {
|
|
|
409
398
|
```
|
|
410
399
|
|
|
411
400
|
Bad:
|
|
401
|
+
|
|
412
402
|
```typescript
|
|
413
403
|
messages: {
|
|
414
404
|
error: "Invalid element", // Too vague
|
|
@@ -435,11 +425,11 @@ See the following files for complete working examples:
|
|
|
435
425
|
|
|
436
426
|
Before finishing, verify:
|
|
437
427
|
|
|
438
|
-
- [ ] Rule file created at
|
|
439
|
-
- [ ] Test file created at
|
|
440
|
-
- [ ] Rule
|
|
441
|
-
- [ ]
|
|
442
|
-
- [ ]
|
|
443
|
-
- [ ] Build succeeds with `pnpm -C packages/uilint-eslint build`
|
|
428
|
+
- [ ] Rule file created at `.uilint/rules/{name}.ts`
|
|
429
|
+
- [ ] Test file created at `.uilint/rules/{name}.test.ts` (if applicable)
|
|
430
|
+
- [ ] Rule imports `createRule` from `"uilint-eslint"`
|
|
431
|
+
- [ ] ESLint config updated to import and use the rule from `.uilint/rules/`
|
|
432
|
+
- [ ] Rule configured in ESLint with appropriate severity
|
|
444
433
|
- [ ] Error messages are clear and actionable
|
|
445
434
|
- [ ] Configuration options are documented in schema
|
|
435
|
+
- [ ] Rule works correctly when ESLint runs
|