@goflag/cli 0.2.7 → 0.2.9

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/rules.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "counts": {
3
- "page": 11,
4
- "site": 3,
3
+ "page": 23,
4
+ "site": 4,
5
5
  "prose": 4
6
6
  },
7
7
  "sources": {
8
+ "apple-web-apps": {
9
+ "id": "apple-web-apps",
10
+ "publisher": "Apple",
11
+ "title": "Configuring web applications (Safari Web Content Guide)",
12
+ "rigor": "vendor-spec",
13
+ "url": "https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html"
14
+ },
8
15
  "bing-webmaster-guidelines": {
9
16
  "id": "bing-webmaster-guidelines",
10
17
  "publisher": "Microsoft",
@@ -19,6 +26,13 @@
19
26
  "rigor": "vendor-spec",
20
27
  "url": "https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls"
21
28
  },
29
+ "google-hreflang": {
30
+ "id": "google-hreflang",
31
+ "publisher": "Google",
32
+ "title": "Localized versions of your pages (hreflang)",
33
+ "rigor": "vendor-spec",
34
+ "url": "https://developers.google.com/search/docs/specialty/international/localized-versions"
35
+ },
22
36
  "google-robots-meta": {
23
37
  "id": "google-robots-meta",
24
38
  "publisher": "Google",
@@ -47,6 +61,13 @@
47
61
  "rigor": "normative",
48
62
  "url": "https://www.rfc-editor.org/rfc/rfc6596"
49
63
  },
64
+ "mdn-link-rel": {
65
+ "id": "mdn-link-rel",
66
+ "publisher": "MDN / Mozilla",
67
+ "title": "MDN — rel attribute values",
68
+ "rigor": "guideline",
69
+ "url": "https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel"
70
+ },
50
71
  "mdn-viewport": {
51
72
  "id": "mdn-viewport",
52
73
  "publisher": "MDN / Mozilla",
@@ -82,6 +103,13 @@
82
103
  "rigor": "vendor-spec",
83
104
  "url": "https://ogp.me/"
84
105
  },
106
+ "w3c-appmanifest": {
107
+ "id": "w3c-appmanifest",
108
+ "publisher": "W3C",
109
+ "title": "Web Application Manifest",
110
+ "rigor": "normative",
111
+ "url": "https://www.w3.org/TR/appmanifest/"
112
+ },
85
113
  "w3c-i18n-language-tags": {
86
114
  "id": "w3c-i18n-language-tags",
87
115
  "publisher": "W3C",
@@ -96,6 +124,13 @@
96
124
  "rigor": "normative",
97
125
  "url": "https://html.spec.whatwg.org/multipage/dom.html"
98
126
  },
127
+ "whatwg-html-link-types": {
128
+ "id": "whatwg-html-link-types",
129
+ "publisher": "WHATWG",
130
+ "title": "HTML Living Standard — link types",
131
+ "rigor": "normative",
132
+ "url": "https://html.spec.whatwg.org/multipage/links.html"
133
+ },
99
134
  "whatwg-html-standard-metadata-names": {
100
135
  "id": "whatwg-html-standard-metadata-names",
101
136
  "publisher": "WHATWG",
@@ -116,6 +151,13 @@
116
151
  "title": "URL Standard",
117
152
  "rigor": "normative",
118
153
  "url": "https://url.spec.whatwg.org/"
154
+ },
155
+ "x-cards": {
156
+ "id": "x-cards",
157
+ "publisher": "X (Twitter)",
158
+ "title": "X Cards — about cards markup",
159
+ "rigor": "vendor-spec",
160
+ "url": "https://developer.x.com/en/docs/twitter-for-websites/cards/overview/abouts-cards"
119
161
  }
120
162
  },
121
163
  "rules": [
@@ -267,6 +309,135 @@
267
309
  "rigor": null,
268
310
  "sources": []
269
311
  },
312
+ {
313
+ "id": "icons.apple-touch.missing",
314
+ "scope": "page",
315
+ "category": "icons",
316
+ "severity": "info",
317
+ "kind": "boolean",
318
+ "summary": "Declare an `apple-touch-icon` for the iOS home screen",
319
+ "why": "iOS does not read `rel=\"icon\"` for a home-screen shortcut. With no `apple-touch-icon` it screenshots the page instead, so what someone saved is a thumbnail of whatever was on screen when they saved it.",
320
+ "rigor": "vendor-spec",
321
+ "sources": [
322
+ "apple-web-apps",
323
+ "whatwg-html-link-types"
324
+ ],
325
+ "reads": [
326
+ "links.icons",
327
+ "links.manifest"
328
+ ],
329
+ "relates": [
330
+ "icons.missing"
331
+ ],
332
+ "expected": "a `<link rel=\"apple-touch-icon\">`"
333
+ },
334
+ {
335
+ "id": "icons.ico.missing",
336
+ "scope": "site",
337
+ "severity": "info",
338
+ "kind": "boolean",
339
+ "summary": "Serve a `/favicon.ico` at the root for the clients that ask blind",
340
+ "rigor": "guideline",
341
+ "sources": [
342
+ "whatwg-html-link-types",
343
+ "mdn-link-rel"
344
+ ]
345
+ },
346
+ {
347
+ "id": "icons.manifest-mismatch",
348
+ "scope": "page",
349
+ "category": "icons",
350
+ "severity": "info",
351
+ "kind": "boolean",
352
+ "summary": "The manifest and the `<head>` must not disagree about the same icon",
353
+ "why": "Two files declare the icons, maintained by different hands, and nothing compares them. The failure worth naming is not that the two lists differ — they legitimately do, since an apple-touch-icon is not a manifest icon — but that they describe the *same file* differently, or that the icons exist only in the manifest, where a browser tab never looks.",
354
+ "rigor": "guideline",
355
+ "sources": [
356
+ "w3c-appmanifest",
357
+ "whatwg-html-link-types"
358
+ ],
359
+ "reads": [
360
+ "links.icons",
361
+ "links.manifest"
362
+ ],
363
+ "relates": [
364
+ "icons.missing"
365
+ ],
366
+ "expected": "the same size and type wherever an icon is declared twice"
367
+ },
368
+ {
369
+ "id": "icons.missing",
370
+ "scope": "page",
371
+ "category": "icons",
372
+ "severity": "warning",
373
+ "kind": "boolean",
374
+ "summary": "Declare an icon — the tab, the bookmark and the share sheet all read one",
375
+ "why": "No specification requires an icon, which is exactly why nothing complains and every consumer improvises. A browser falls back to `/favicon.ico` at the root, a feed reader or a link unfurler often falls back to nothing, and a bookmark to a site with no icon is a grey square among fifty.",
376
+ "rigor": "guideline",
377
+ "sources": [
378
+ "whatwg-html-link-types",
379
+ "mdn-link-rel"
380
+ ],
381
+ "reads": [
382
+ "links.icons",
383
+ "links.manifest"
384
+ ],
385
+ "relates": [
386
+ "icons.apple-touch.missing",
387
+ "icons.manifest-mismatch"
388
+ ],
389
+ "expected": "at least one `<link rel=\"icon\">`, or icons declared by a manifest",
390
+ "fix": {
391
+ "title": "Let the file convention declare it",
392
+ "snippet": "// app/icon.svg (or icon.png) — Next emits the <link rel=\"icon\"> itself.\n// app/apple-icon.png likewise emits rel=\"apple-touch-icon\".\n// A /favicon.ico at the root is a separate matter: see icons.ico.missing.",
393
+ "language": "tsx"
394
+ }
395
+ },
396
+ {
397
+ "id": "icons.sizes-mismatch",
398
+ "scope": "page",
399
+ "category": "icons",
400
+ "severity": "info",
401
+ "kind": "boolean",
402
+ "summary": "A `sizes` attribute must describe the file it points at",
403
+ "why": "`sizes` is how a client picks one icon out of several without fetching them all, so a wrong value costs exactly what the attribute was there to save: the client downloads the file it was told to prefer and gets the wrong resolution. A half-true declaration is the common shape — a `.ico` carrying 16, 32 and 48 declared as `48x48` advertises one third of itself.",
404
+ "rigor": "guideline",
405
+ "sources": [
406
+ "whatwg-html-link-types",
407
+ "mdn-link-rel"
408
+ ],
409
+ "reads": [
410
+ "links.icons",
411
+ "assets"
412
+ ],
413
+ "relates": [
414
+ "icons.unreachable"
415
+ ],
416
+ "expected": "`sizes` listing what the file actually contains"
417
+ },
418
+ {
419
+ "id": "icons.unreachable",
420
+ "scope": "page",
421
+ "category": "icons",
422
+ "severity": "warning",
423
+ "kind": "boolean",
424
+ "summary": "A declared icon has to answer with an image",
425
+ "why": "An icon that 404s is worse than one never declared: the client asks, gets nothing, and has already skipped the `/favicon.ico` it would have fallen back to. The declaration is what took the fallback away.",
426
+ "rigor": "vendor-spec",
427
+ "sources": [
428
+ "whatwg-html-link-types",
429
+ "mdn-link-rel"
430
+ ],
431
+ "reads": [
432
+ "links.icons",
433
+ "assets"
434
+ ],
435
+ "relates": [
436
+ "icons.missing",
437
+ "icons.ico.missing"
438
+ ],
439
+ "expected": "a 2xx image at every declared icon URL"
440
+ },
270
441
  {
271
442
  "id": "lang.matches-content",
272
443
  "scope": "prose",
@@ -312,6 +483,85 @@
312
483
  ],
313
484
  "expected": "an `og:description` alongside the other `og:*` tags"
314
485
  },
486
+ {
487
+ "id": "og.image.absolute",
488
+ "scope": "page",
489
+ "category": "opengraph",
490
+ "severity": "warning",
491
+ "kind": "boolean",
492
+ "summary": "`og:image` must be an absolute URL",
493
+ "why": "Unlike a browser, the crawler that builds the preview has no document to resolve a relative path against — it reads the tag, not the page. A relative `og:image` is therefore not a smaller mistake than a missing one: the unfurl is identical, and the tag makes it look handled.",
494
+ "rigor": "vendor-spec",
495
+ "sources": [
496
+ "ogp",
497
+ "meta-og-sharing"
498
+ ],
499
+ "reads": [
500
+ "openGraph.images"
501
+ ],
502
+ "relates": [
503
+ "og.image.missing",
504
+ "canonical.absolute"
505
+ ],
506
+ "expected": "every `og:image` URL absolute, scheme included",
507
+ "fix": {
508
+ "title": "Give Next a metadataBase, or write the origin in",
509
+ "snippet": "// app/layout.tsx — every relative metadata URL resolves against this.\nexport const metadata = {\n metadataBase: new URL(process.env.SITE_ORIGIN!),\n openGraph: { images: [\"/og.png\"] }, // emitted absolute\n};",
510
+ "language": "tsx"
511
+ }
512
+ },
513
+ {
514
+ "id": "og.image.alt",
515
+ "scope": "page",
516
+ "category": "opengraph",
517
+ "severity": "warning",
518
+ "kind": "boolean",
519
+ "summary": "Describe the shared image with `og:image:alt`",
520
+ "why": "The protocol defines `og:image:alt` as a description of what is in the image, and a generated card usually carries the page's title as pixels. Omitting it leaves that text sighted-only, in the one place a link is seen before anybody has opened the page. Optional in the vocabulary, which is why this is a guideline and not a spec violation.",
521
+ "rigor": "guideline",
522
+ "sources": [
523
+ "ogp"
524
+ ],
525
+ "reads": [
526
+ "openGraph.images"
527
+ ],
528
+ "relates": [
529
+ "og.image.missing"
530
+ ],
531
+ "expected": "an `og:image:alt` beside every `og:image`",
532
+ "fix": {
533
+ "title": "Carry the alt per image, not as a constant",
534
+ "snippet": "// app/…/opengraph-image.tsx — `export const alt` is one fixed string, so a\n// translated or data-derived description has to go through the metadata fn.\nexport async function generateImageMetadata({ params }) {\n const t = await getTranslations({ locale: params.locale });\n return [{ id: \"og\", size, contentType, alt: t(\"og.alt\") }];\n}",
535
+ "language": "tsx"
536
+ }
537
+ },
538
+ {
539
+ "id": "og.image.dimensions",
540
+ "scope": "page",
541
+ "category": "opengraph",
542
+ "severity": "warning",
543
+ "kind": "boolean",
544
+ "summary": "Declare `og:image:width` and `og:image:height`",
545
+ "why": "A crawler that does not know the size cannot lay the card out until it has fetched the image, so the first share of a URL renders without it — the one share that matters most. The dimensions are the fix, and they cost two tags.",
546
+ "rigor": "vendor-spec",
547
+ "sources": [
548
+ "ogp",
549
+ "meta-og-sharing"
550
+ ],
551
+ "reads": [
552
+ "openGraph.images"
553
+ ],
554
+ "relates": [
555
+ "og.image.missing",
556
+ "og.image.ratio"
557
+ ],
558
+ "expected": "both `og:image:width` and `og:image:height` on every image",
559
+ "fix": {
560
+ "title": "Declare the size alongside the URL",
561
+ "snippet": "// app/…/page.tsx\nexport const metadata = {\n openGraph: { images: [{ url: \"/og.png\", width: 1200, height: 630 }] },\n};\n// The file convention emits both from `export const size` for free.",
562
+ "language": "tsx"
563
+ }
564
+ },
315
565
  {
316
566
  "id": "og.image.missing",
317
567
  "scope": "page",
@@ -338,6 +588,64 @@
338
588
  "language": "tsx"
339
589
  }
340
590
  },
591
+ {
592
+ "id": "og.image.ratio",
593
+ "scope": "page",
594
+ "category": "opengraph",
595
+ "severity": "info",
596
+ "kind": "scored",
597
+ "summary": "Keep the shared image near the 1.91:1 the card is laid out for",
598
+ "why": "Meta's recommended 1200×630 is a shape before it is a size. An image far from it is not rejected — it is cropped to fit, and the crop is chosen by the consumer rather than by you.",
599
+ "rigor": "vendor-spec",
600
+ "sources": [
601
+ "meta-og-sharing",
602
+ "x-cards"
603
+ ],
604
+ "reads": [
605
+ "openGraph.images"
606
+ ],
607
+ "relates": [
608
+ "og.image.dimensions"
609
+ ],
610
+ "expected": "a width ÷ height between 1.7 and 2.1 (1.91:1 is 1.9)",
611
+ "bands": {
612
+ "ideal": [
613
+ 1.7,
614
+ 2.1
615
+ ],
616
+ "acceptable": [
617
+ 1,
618
+ 3
619
+ ]
620
+ },
621
+ "severityByBand": {
622
+ "acceptable": "info",
623
+ "poor": "warning"
624
+ }
625
+ },
626
+ {
627
+ "id": "og.image.reachable",
628
+ "scope": "page",
629
+ "category": "opengraph",
630
+ "severity": "error",
631
+ "kind": "boolean",
632
+ "summary": "The URL in `og:image` has to answer with an image",
633
+ "why": "Every other check on a preview image judges the tag. This one judges the file, and it is the only one that can catch the failure with no symptom: a URL that is present, well-formed, absolute — and dead. The card renders empty and nothing in the page says why. Found on this project's own documentation, where eleven pages pointed at a route a redirect had been swallowing since the day it was written.",
634
+ "rigor": "vendor-spec",
635
+ "sources": [
636
+ "ogp",
637
+ "meta-og-sharing"
638
+ ],
639
+ "reads": [
640
+ "openGraph.images",
641
+ "assets"
642
+ ],
643
+ "relates": [
644
+ "og.image.missing",
645
+ "og.image.absolute"
646
+ ],
647
+ "expected": "a 2xx image at every `og:image` URL"
648
+ },
341
649
  {
342
650
  "id": "og.image.representative",
343
651
  "scope": "prose",
@@ -359,6 +667,62 @@
359
667
  ],
360
668
  "prose": "Does the og:image represent what this page is about, rather than being a site-wide default, and does its subject survive being cropped to the 1.91:1 aspect ratio consumers render?"
361
669
  },
670
+ {
671
+ "id": "og.locale.alternates",
672
+ "scope": "page",
673
+ "category": "opengraph",
674
+ "severity": "warning",
675
+ "kind": "boolean",
676
+ "summary": "`og:locale:alternate` and the hreflang cluster must name the same locales",
677
+ "why": "Two vocabularies describe the same fact — this page exists in these languages — and nothing in a build keeps them in step, so they drift silently. Whichever one is short is the one telling a consumer that a translation it could have linked to does not exist.",
678
+ "rigor": "vendor-spec",
679
+ "sources": [
680
+ "ogp",
681
+ "google-hreflang"
682
+ ],
683
+ "reads": [
684
+ "openGraph.locale",
685
+ "openGraph.localeAlternates",
686
+ "links.hreflang"
687
+ ],
688
+ "relates": [
689
+ "og.locale.missing",
690
+ "hreflang.missing"
691
+ ],
692
+ "expected": "one `og:locale:alternate` per hreflang locale other than this page's own",
693
+ "fix": {
694
+ "title": "Derive both lists from the same cluster",
695
+ "snippet": "// The hreflang map and the OG locales are one fact stated twice.\nopenGraph: {\n locale: ogLocale(locale),\n alternateLocale: cluster.filter((l) => l !== locale).map(ogLocale),\n},\nalternates: { languages: cluster },",
696
+ "language": "ts"
697
+ }
698
+ },
699
+ {
700
+ "id": "og.locale.missing",
701
+ "scope": "page",
702
+ "category": "opengraph",
703
+ "severity": "warning",
704
+ "kind": "boolean",
705
+ "summary": "A translated page has to say which locale it is in",
706
+ "why": "`og:locale` defaults to `en_US` in the protocol itself — so a page that omits it does not decline to answer, it answers wrongly. On a site whose whole point is that the same page exists in several languages, every translation claims to be American English.",
707
+ "rigor": "vendor-spec",
708
+ "sources": [
709
+ "ogp"
710
+ ],
711
+ "reads": [
712
+ "openGraph.locale",
713
+ "links.hreflang"
714
+ ],
715
+ "relates": [
716
+ "og.locale.alternates",
717
+ "hreflang.missing"
718
+ ],
719
+ "expected": "an `og:locale` on any page that declares hreflang alternates",
720
+ "fix": {
721
+ "title": "Emit the locale in the page's own metadata",
722
+ "snippet": "// app/[locale]/…/page.tsx\nexport const metadata = {\n openGraph: { locale: \"fr_FR\", alternateLocale: [\"en_US\", \"es_ES\"] },\n};",
723
+ "language": "tsx"
724
+ }
725
+ },
362
726
  {
363
727
  "id": "og.title.missing",
364
728
  "scope": "page",