canicode 0.4.0 → 0.4.1
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 +3 -29
- package/dist/cli/index.js +1 -3
- package/dist/cli/index.js.map +1 -1
- package/docs/CUSTOMIZATION.md +0 -74
- package/package.json +1 -1
package/docs/CUSTOMIZATION.md
CHANGED
|
@@ -197,80 +197,6 @@ Override score, severity, or enable/disable individual rules:
|
|
|
197
197
|
}
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Custom Rules
|
|
203
|
-
|
|
204
|
-
Add project-specific checks that don't exist in the built-in 39 rules.
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
canicode analyze <url> --custom-rules ./my-rules.json
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Schema
|
|
211
|
-
|
|
212
|
-
```json
|
|
213
|
-
[
|
|
214
|
-
{
|
|
215
|
-
"id": "my-rule-id",
|
|
216
|
-
"category": "component",
|
|
217
|
-
"severity": "blocking",
|
|
218
|
-
"score": -10,
|
|
219
|
-
"prompt": "Describe what to check on this Figma node...",
|
|
220
|
-
"why": "Why this matters for developers.",
|
|
221
|
-
"impact": "What happens if this issue is not fixed.",
|
|
222
|
-
"fix": "How to fix it in Figma."
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
| Field | Required | Description |
|
|
228
|
-
|-------|----------|-------------|
|
|
229
|
-
| `id` | Yes | Unique rule identifier (kebab-case) |
|
|
230
|
-
| `category` | Yes | `layout`, `token`, `component`, `naming`, `ai-readability`, or `handoff-risk` |
|
|
231
|
-
| `severity` | Yes | `blocking`, `risk`, `missing-info`, or `suggestion` |
|
|
232
|
-
| `score` | Yes | Penalty score (negative integer) |
|
|
233
|
-
| `prompt` | Yes | What to check — describes the condition for this rule |
|
|
234
|
-
| `why` | Yes | Why this rule matters (shown in reports) |
|
|
235
|
-
| `impact` | Yes | Developer impact if not fixed (shown in reports) |
|
|
236
|
-
| `fix` | Yes | How to fix it in Figma (shown in reports) |
|
|
237
|
-
|
|
238
|
-
### Example Custom Rules
|
|
239
|
-
|
|
240
|
-
```json
|
|
241
|
-
[
|
|
242
|
-
{
|
|
243
|
-
"id": "icon-missing-component",
|
|
244
|
-
"category": "component",
|
|
245
|
-
"severity": "blocking",
|
|
246
|
-
"score": -10,
|
|
247
|
-
"prompt": "Check if this node is an icon (small size, vector children, no text) and is not a component or instance.",
|
|
248
|
-
"why": "Icon nodes that are not components cannot be reused consistently.",
|
|
249
|
-
"impact": "Developers will hardcode icons instead of using a shared component.",
|
|
250
|
-
"fix": "Convert to a component and publish to the library."
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
"id": "missing-dark-mode-token",
|
|
254
|
-
"category": "token",
|
|
255
|
-
"severity": "risk",
|
|
256
|
-
"score": -7,
|
|
257
|
-
"prompt": "Check if this node uses color fills that are not bound to a Figma variable.",
|
|
258
|
-
"why": "Hardcoded colors cannot be swapped for dark mode variants.",
|
|
259
|
-
"impact": "Dark mode requires manual overrides for every affected node.",
|
|
260
|
-
"fix": "Replace hardcoded colors with Figma variables that support mode switching."
|
|
261
|
-
}
|
|
262
|
-
]
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### Combining Config + Custom Rules
|
|
266
|
-
|
|
267
|
-
Both flags work together:
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
canicode analyze <url> --config ./config.json --custom-rules ./rules.json
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
The config adjusts built-in rules, while custom rules add new checks on top.
|
|
274
200
|
|
|
275
201
|
---
|
|
276
202
|
|
package/package.json
CHANGED