impeccable 3.3.1 → 3.5.0
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 +2 -2
- package/README.npm.md +2 -2
- package/README.repo.md +3 -3
- package/cli/bin/commands/skills.mjs +145 -13
- package/cli/engine/browser/injected/index.mjs +12 -4
- package/cli/engine/detect-antipatterns-browser.js +410 -111
- package/cli/engine/engines/browser/detect-url.mjs +35 -3
- package/cli/engine/engines/regex/detect-text.mjs +23 -24
- package/cli/engine/engines/static-html/css-cascade.mjs +27 -12
- package/cli/engine/engines/static-html/detect-html.mjs +23 -6
- package/cli/engine/node/file-system.mjs +16 -2
- package/cli/engine/registry/antipatterns.mjs +13 -15
- package/cli/engine/rules/checks.mjs +395 -97
- package/cli/lib/impeccable-config.mjs +3 -0
- package/package.json +3 -2
|
@@ -7,6 +7,38 @@ import { profileFindingsAsync, profileStep, profileStepAsync } from '../../profi
|
|
|
7
7
|
import { captureVisualContrastCandidate } from '../visual/screenshot-contrast.mjs';
|
|
8
8
|
import { checkContentHiddenAtRest } from '../../rules/checks.mjs';
|
|
9
9
|
|
|
10
|
+
// On Windows, puppeteer's bundled Chrome lives in a user-writable cache
|
|
11
|
+
// directory. Its GPU process can be denied (STATUS_ACCESS_DENIED) by security
|
|
12
|
+
// software or the GPU sandbox because it launches from an untrusted path.
|
|
13
|
+
// Chrome then crash-loops the GPU process, and each relaunch briefly flashes a
|
|
14
|
+
// compositor surface, the black window users report during `detect <url>`
|
|
15
|
+
// (issue #372). The system-installed Chrome runs from a trusted location with a
|
|
16
|
+
// healthy GPU, so channel:'chrome' avoids the crash entirely; both use hardware
|
|
17
|
+
// GPU, so contrast measurement is unaffected. Scope this to Windows only: other
|
|
18
|
+
// platforms do not have the bug, so they keep the pinned bundled build for
|
|
19
|
+
// consistent measurement across machines. Fall back to bundled when the switch
|
|
20
|
+
// fails (Chrome not installed, or channel resolution fails). If the bundled
|
|
21
|
+
// launch then also fails, surface the original system-Chrome error as the
|
|
22
|
+
// cause so the real failure is not lost.
|
|
23
|
+
async function launchBrowser(puppeteer, { headless = true, args = [] } = {}) {
|
|
24
|
+
let channelError;
|
|
25
|
+
if (process.platform === 'win32') {
|
|
26
|
+
try {
|
|
27
|
+
return await puppeteer.default.launch({ channel: 'chrome', headless, args });
|
|
28
|
+
} catch (err) {
|
|
29
|
+
// System Chrome unavailable or unlaunchable; fall through to the bundled
|
|
30
|
+
// browser, but keep the error in case the fallback fails too.
|
|
31
|
+
channelError = err;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return await puppeteer.default.launch({ headless, args });
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (channelError && err && err.cause === undefined) err.cause = channelError;
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
10
42
|
// Reveal sweep + invisible-text measurement for the content-hidden-at-rest
|
|
11
43
|
// rule. Scrolls through the document with instant jumps (bypasses CSS
|
|
12
44
|
// scroll-behavior: smooth) so IntersectionObserver / scroll reveal handlers
|
|
@@ -178,7 +210,7 @@ async function detectUrl(url, options = {}) {
|
|
|
178
210
|
phase: 'load',
|
|
179
211
|
ruleId: 'launch-browser',
|
|
180
212
|
target: url,
|
|
181
|
-
}, () => puppeteer
|
|
213
|
+
}, () => launchBrowser(puppeteer, { headless: options?.headless ?? true, args: launchArgs }));
|
|
182
214
|
const page = await profileStepAsync(profile, {
|
|
183
215
|
engine: 'browser',
|
|
184
216
|
phase: 'load',
|
|
@@ -312,7 +344,7 @@ async function createBrowserDetector(options = {}) {
|
|
|
312
344
|
throw new Error('puppeteer is required for URL scanning. Install: npm install puppeteer');
|
|
313
345
|
}
|
|
314
346
|
const launchArgs = options.launchArgs || (process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : []);
|
|
315
|
-
const browser = options.browser || await puppeteer
|
|
347
|
+
const browser = options.browser || await launchBrowser(puppeteer, {
|
|
316
348
|
headless: options.headless ?? true,
|
|
317
349
|
args: launchArgs,
|
|
318
350
|
});
|
|
@@ -337,4 +369,4 @@ async function createBrowserDetector(options = {}) {
|
|
|
337
369
|
};
|
|
338
370
|
}
|
|
339
371
|
|
|
340
|
-
export { runVisualContrastFallback, detectUrl, createBrowserDetector };
|
|
372
|
+
export { runVisualContrastFallback, detectUrl, createBrowserDetector, launchBrowser };
|
|
@@ -2,7 +2,7 @@ import { GENERIC_FONTS, OVERUSED_FONTS, EM_DASH_FLOOR, EM_DASH_CHARS_PER_DASH }
|
|
|
2
2
|
import { isNeutralColor } from '../../shared/color.mjs';
|
|
3
3
|
import { extractGoogleFontFamilies } from '../../shared/fonts.mjs';
|
|
4
4
|
import { checkSourceDesignSystem } from '../../design-system.mjs';
|
|
5
|
-
import { scanCssTextForGlow, scanCssTextForGridBackground, scanCssTextForMarquee, scanCssTextForRadialHalo } from '../../rules/checks.mjs';
|
|
5
|
+
import { scanCssTextForGlow, scanCssTextForGridBackground, scanCssTextForMarquee, scanCssTextForPseudoStripe, scanCssTextForRadialHalo } from '../../rules/checks.mjs';
|
|
6
6
|
import { isFullPage } from '../../shared/page.mjs';
|
|
7
7
|
import { applyInlineIgnores } from '../../shared/inline-ignores.mjs';
|
|
8
8
|
import { finding } from '../../findings.mjs';
|
|
@@ -12,7 +12,8 @@ import { profileFindings, profileStep } from '../../profile/profiler.mjs';
|
|
|
12
12
|
// Regex fallback (non-HTML files: CSS, JSX, TSX, etc.)
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
|
|
15
|
-
const hasRounded = (line) =>
|
|
15
|
+
const hasRounded = (line) =>
|
|
16
|
+
/\brounded(?:-\w+)?\b/.test(line.replace(/\brounded-none\b/g, ''));
|
|
16
17
|
const hasBorderRadius = (line) => /border-radius/i.test(line);
|
|
17
18
|
const isSafeElement = (line) => /<(?:blockquote|nav[\s>]|pre[\s>]|code[\s>]|a\s|input[\s>]|span[\s>])/i.test(line);
|
|
18
19
|
|
|
@@ -240,24 +241,6 @@ const REGEX_MATCHERS = [
|
|
|
240
241
|
];
|
|
241
242
|
|
|
242
243
|
const REGEX_ANALYZERS = [
|
|
243
|
-
// Single font
|
|
244
|
-
(content, filePath) => {
|
|
245
|
-
const fontFamilyRe = /font-family\s*:\s*([^;}]+)/gi;
|
|
246
|
-
const fonts = new Set();
|
|
247
|
-
let m;
|
|
248
|
-
while ((m = fontFamilyRe.exec(content)) !== null) {
|
|
249
|
-
for (const f of m[1].split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase())) {
|
|
250
|
-
if (f && !GENERIC_FONTS.has(f)) fonts.add(f);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
for (const f of extractGoogleFontFamilies(content)) fonts.add(f);
|
|
254
|
-
if (fonts.size !== 1 || content.split('\n').length < 20) return [];
|
|
255
|
-
const name = [...fonts][0];
|
|
256
|
-
const lines = content.split('\n');
|
|
257
|
-
let line = 1;
|
|
258
|
-
for (let i = 0; i < lines.length; i++) { if (lines[i].toLowerCase().includes(name)) { line = i + 1; break; } }
|
|
259
|
-
return [finding('single-font', filePath, `only font used is ${name}`, line)];
|
|
260
|
-
},
|
|
261
244
|
// Flat type hierarchy
|
|
262
245
|
(content, filePath) => {
|
|
263
246
|
const sizes = new Set();
|
|
@@ -625,10 +608,11 @@ const TEXT_CONTENT_ANALYZER_IDS = [
|
|
|
625
608
|
function runTextContentAnalyzers(content, filePath, options = {}) {
|
|
626
609
|
const profile = options?.profile;
|
|
627
610
|
if (!shouldRunPageAnalyzers(content, filePath)) return [];
|
|
628
|
-
// The 3 text-content analyzers are at indices
|
|
611
|
+
// The 3 text-content analyzers are at indices 2-4 in REGEX_ANALYZERS
|
|
612
|
+
// (single-font's removal on 2026-07-29 shifted every index down one).
|
|
629
613
|
const findings = [];
|
|
630
614
|
for (let i = 0; i < TEXT_CONTENT_ANALYZER_IDS.length; i++) {
|
|
631
|
-
const analyzer = REGEX_ANALYZERS[
|
|
615
|
+
const analyzer = REGEX_ANALYZERS[2 + i];
|
|
632
616
|
const ruleId = TEXT_CONTENT_ANALYZER_IDS[i];
|
|
633
617
|
findings.push(...profileFindings(profile, {
|
|
634
618
|
engine: 'regex',
|
|
@@ -653,7 +637,21 @@ function detectText(content, filePath, options = {}) {
|
|
|
653
637
|
profile,
|
|
654
638
|
phase: 'source',
|
|
655
639
|
}));
|
|
656
|
-
|
|
640
|
+
// Pseudo-element stripes (::before/::after absolute bars) carry the same
|
|
641
|
+
// side-tab silhouette without any border token, so the line matchers can't
|
|
642
|
+
// see them (issue #394). The shared scanner already runs on full HTML pages
|
|
643
|
+
// via checkHtmlPatterns; give standalone stylesheets, component style
|
|
644
|
+
// blocks, and CSS-in-JS templates the same coverage. Each hit carries the
|
|
645
|
+
// rule's source offset, so the finding gets a real line and line-scoped
|
|
646
|
+
// inline ignores keep working.
|
|
647
|
+
const pseudoStripeFindings = (text, lineOffset) =>
|
|
648
|
+
scanCssTextForPseudoStripe(text).map(hit =>
|
|
649
|
+
finding(hit.id, filePath, hit.snippet, lineOffset + text.slice(0, hit.index).split('\n').length));
|
|
650
|
+
|
|
651
|
+
if (cssLike.has(ext)) {
|
|
652
|
+
findings.push(...scanInsetStripeCss(content, filePath));
|
|
653
|
+
findings.push(...pseudoStripeFindings(content, 0));
|
|
654
|
+
}
|
|
657
655
|
|
|
658
656
|
// Block-level CSS checks that need multiple declarations must run over the
|
|
659
657
|
// complete source, not line-by-line. This covers standalone stylesheets,
|
|
@@ -690,6 +688,7 @@ function detectText(content, filePath, options = {}) {
|
|
|
690
688
|
// reported every selector one line low. runRegexMatchers keeps startLine - 1
|
|
691
689
|
// because it indexes its split lines from zero.
|
|
692
690
|
findings.push(...scanInsetStripeCss(block.content, filePath, block.startLine - 2));
|
|
691
|
+
findings.push(...pseudoStripeFindings(block.content, block.startLine - 2));
|
|
693
692
|
}
|
|
694
693
|
|
|
695
694
|
// Extract and scan CSS-in-JS template literals
|
|
@@ -708,6 +707,7 @@ function detectText(content, filePath, options = {}) {
|
|
|
708
707
|
phase: 'css-in-js',
|
|
709
708
|
}));
|
|
710
709
|
findings.push(...scanInsetStripeCss(block.content, filePath, block.startLine - 1));
|
|
710
|
+
findings.push(...pseudoStripeFindings(block.content, block.startLine - 1));
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
if (options?.designSystem) {
|
|
@@ -733,7 +733,6 @@ function detectText(content, filePath, options = {}) {
|
|
|
733
733
|
// Page-level analyzers only run on full pages
|
|
734
734
|
if (shouldRunPageAnalyzers(content, filePath)) {
|
|
735
735
|
const analyzerIds = [
|
|
736
|
-
'single-font',
|
|
737
736
|
'flat-type-hierarchy',
|
|
738
737
|
'monotonous-spacing',
|
|
739
738
|
'em-dash-overuse',
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import { profileStep, recordProfileEvent } from '../../profile/profiler.mjs';
|
|
5
|
-
import { collectCssCustomProps, cssLengthToPx, parseAnyColor, resolveLengthPx, resolveVarRefs } from '../../rules/checks.mjs';
|
|
5
|
+
import { CSS_NAMED_COLORS, collectCssCustomProps, cssLengthToPx, parseAnyColor, resolveLengthPx, resolveVarRefs } from '../../rules/checks.mjs';
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// jsdom CSS-variable border override map
|
|
@@ -223,7 +223,7 @@ function unwrapCssAtLayer(source) {
|
|
|
223
223
|
// ---------------------------------------------------------------------------
|
|
224
224
|
|
|
225
225
|
const STATIC_INHERITED_PROPS = new Set([
|
|
226
|
-
'color', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight',
|
|
226
|
+
'color', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'fontVariant',
|
|
227
227
|
'lineHeight', 'letterSpacing', 'textTransform', 'textAlign', 'hyphens',
|
|
228
228
|
'webkitHyphens',
|
|
229
229
|
]);
|
|
@@ -252,6 +252,7 @@ const STATIC_DEFAULT_STYLE = {
|
|
|
252
252
|
fontFamily: '',
|
|
253
253
|
fontSize: '16px',
|
|
254
254
|
fontStyle: 'normal',
|
|
255
|
+
fontVariant: 'normal',
|
|
255
256
|
fontWeight: '400',
|
|
256
257
|
lineHeight: 'normal',
|
|
257
258
|
letterSpacing: 'normal',
|
|
@@ -344,18 +345,29 @@ const STATIC_PROP_MAP = {
|
|
|
344
345
|
'overflow-y': 'overflowY',
|
|
345
346
|
};
|
|
346
347
|
|
|
348
|
+
// parseStaticColor tries parseAnyColor first, which already resolves every
|
|
349
|
+
// name in the shared CSS_NAMED_COLORS table. This fallback only carries the
|
|
350
|
+
// keywords parseAnyColor deliberately returns null for: the cascade needs
|
|
351
|
+
// `transparent` to read as an actual zero-alpha color.
|
|
347
352
|
const STATIC_NAMED_COLORS = {
|
|
348
|
-
black: { r: 0, g: 0, b: 0, a: 1 },
|
|
349
|
-
white: { r: 255, g: 255, b: 255, a: 1 },
|
|
350
353
|
transparent: { r: 0, g: 0, b: 0, a: 0 },
|
|
351
|
-
gray: { r: 128, g: 128, b: 128, a: 1 },
|
|
352
|
-
grey: { r: 128, g: 128, b: 128, a: 1 },
|
|
353
|
-
silver: { r: 192, g: 192, b: 192, a: 1 },
|
|
354
|
-
red: { r: 255, g: 0, b: 0, a: 1 },
|
|
355
|
-
green: { r: 0, g: 128, b: 0, a: 1 },
|
|
356
|
-
blue: { r: 0, g: 0, b: 255, a: 1 },
|
|
357
354
|
};
|
|
358
355
|
|
|
356
|
+
// Named-color alternation for plucking a color token out of shorthand values
|
|
357
|
+
// (issue #359: a hardcoded 9-name list here silently dropped `purple`,
|
|
358
|
+
// `crimson`, `teal`, ... from border shorthands, so the side defaulted to
|
|
359
|
+
// neutral black and side-tab never fired on .html files). Derived from the
|
|
360
|
+
// same table parseAnyColor resolves against, so extraction and parsing can't
|
|
361
|
+
// drift apart. Longest-first so names containing other names as substrings
|
|
362
|
+
// (rebeccapurple) are matched whole.
|
|
363
|
+
const NAMED_COLOR_TOKENS = [...Object.keys(CSS_NAMED_COLORS), ...Object.keys(STATIC_NAMED_COLORS)]
|
|
364
|
+
.sort((a, b) => b.length - a.length)
|
|
365
|
+
.join('|');
|
|
366
|
+
const STATIC_COLOR_TOKEN_RE = new RegExp(
|
|
367
|
+
`(?:rgba?\\([^)]+\\)|oklch\\([^)]+\\)|oklab\\([^)]+\\)|lch\\([^)]+\\)|lab\\([^)]+\\)|hsla?\\([^)]+\\)|hwb\\([^)]+\\)|#[0-9a-f]{3,8}\\b|\\b(?:${NAMED_COLOR_TOKENS})\\b)`,
|
|
368
|
+
'i'
|
|
369
|
+
);
|
|
370
|
+
|
|
359
371
|
function splitCssList(value) {
|
|
360
372
|
const parts = [];
|
|
361
373
|
let depth = 0, quote = '', start = 0;
|
|
@@ -441,7 +453,7 @@ function extractStaticColor(value) {
|
|
|
441
453
|
}
|
|
442
454
|
return '';
|
|
443
455
|
}
|
|
444
|
-
const colorLike = raw.match(
|
|
456
|
+
const colorLike = raw.match(STATIC_COLOR_TOKEN_RE);
|
|
445
457
|
if (!colorLike) return '';
|
|
446
458
|
return colorLike[0];
|
|
447
459
|
}
|
|
@@ -940,7 +952,10 @@ function collectStaticCssText(root, fileDir, profile, filePath, modules) {
|
|
|
940
952
|
const rel = link.attribs?.rel || '';
|
|
941
953
|
const href = link.attribs?.href || '';
|
|
942
954
|
if (!/\bstylesheet\b/i.test(rel) || !href || /^(https?:)?\/\//i.test(href)) continue;
|
|
943
|
-
|
|
955
|
+
// Cache-busting hrefs (styles.css?v=3) resolve to the file, not to a
|
|
956
|
+
// literal path with the query in it; a versioned link otherwise made the
|
|
957
|
+
// whole stylesheet invisible to every element-level check.
|
|
958
|
+
const cssPath = path.resolve(fileDir, href.split(/[?#]/)[0]);
|
|
944
959
|
try {
|
|
945
960
|
const css = profileStep(profile, {
|
|
946
961
|
engine: 'static-html',
|
|
@@ -24,13 +24,14 @@ import {
|
|
|
24
24
|
checkElementMotion,
|
|
25
25
|
checkElementOversizedH1,
|
|
26
26
|
checkElementQuality,
|
|
27
|
+
checkElementRadialSpotlight,
|
|
27
28
|
checkCreamPalette,
|
|
28
29
|
checkHtmlPatterns,
|
|
30
|
+
checkKickerAboveHeadingFromDoc,
|
|
29
31
|
checkNumberedSectionLabelsFromDoc,
|
|
30
32
|
checkPageLayout,
|
|
31
33
|
checkPageQualityFromDoc,
|
|
32
34
|
checkRepeatedContainerTextFromDoc,
|
|
33
|
-
checkRepeatedSectionKickersFromDoc,
|
|
34
35
|
resolveBackground,
|
|
35
36
|
resolveBorderRadiusPx,
|
|
36
37
|
} from '../../rules/checks.mjs';
|
|
@@ -59,9 +60,6 @@ function checkStaticPageTypography(document, window) {
|
|
|
59
60
|
for (const font of overusedFound) {
|
|
60
61
|
findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
|
|
61
62
|
}
|
|
62
|
-
if (fonts.size === 1 && document.querySelectorAll('*').length >= 20) {
|
|
63
|
-
findings.push({ id: 'single-font', snippet: `only font used is ${[...fonts][0]}` });
|
|
64
|
-
}
|
|
65
63
|
const sizes = new Set();
|
|
66
64
|
for (const el of document.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div')) {
|
|
67
65
|
const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
|
|
@@ -105,6 +103,7 @@ const STATIC_ELEMENT_RULES = [
|
|
|
105
103
|
{ id: 'oversized-h1', selector: 'h1', run: (el, tag, style, window) => checkElementOversizedH1(el, style, tag, window) },
|
|
106
104
|
{ id: 'clipped-overflow-container', selector: '*', run: (el, tag, style, window) => checkElementClippedOverflow(el, style, tag, window) },
|
|
107
105
|
{ id: 'gpt-thin-border-wide-shadow', selector: '*', run: (el, tag, style) => checkElementGptBorderShadow(el, style) },
|
|
106
|
+
{ id: 'radial-spotlight-glow', selector: '*', run: (el, tag, style, window) => checkElementRadialSpotlight(el, style, tag, window) },
|
|
108
107
|
];
|
|
109
108
|
|
|
110
109
|
async function detectHtml(filePath, options = {}) {
|
|
@@ -200,7 +199,7 @@ async function detectHtml(filePath, options = {}) {
|
|
|
200
199
|
for (const f of runPageCheck('typography-rules', () => checkStaticPageTypography(document, window))) {
|
|
201
200
|
findings.push(finding(f.id, filePath, f.snippet));
|
|
202
201
|
}
|
|
203
|
-
for (const f of runPageCheck('
|
|
202
|
+
for (const f of runPageCheck('kicker-above-heading', () => checkKickerAboveHeadingFromDoc(document, window))) {
|
|
204
203
|
findings.push(finding(f.id, filePath, f.snippet));
|
|
205
204
|
}
|
|
206
205
|
for (const f of runPageCheck('numbered-section-labels', () => checkNumberedSectionLabelsFromDoc(document, window))) {
|
|
@@ -218,7 +217,25 @@ async function detectHtml(filePath, options = {}) {
|
|
|
218
217
|
for (const f of runPageCheck('skipped-heading', () => checkPageQualityFromDoc(document))) {
|
|
219
218
|
findings.push(finding(f.id, filePath, f.snippet));
|
|
220
219
|
}
|
|
221
|
-
|
|
220
|
+
// Scoped corpora for the pattern checks (see buildHtmlPatternCorpora in
|
|
221
|
+
// rules/checks.mjs): CSS-property regexes must not fire on prose ABOUT
|
|
222
|
+
// css — `<code>background-clip: text</code>` in a changelog is
|
|
223
|
+
// documentation, not styling. cssText already carries the <style>
|
|
224
|
+
// blocks and any linked local stylesheets; style/class attributes come
|
|
225
|
+
// from the parsed document, so escaped code samples never contribute.
|
|
226
|
+
const styleAttrParts = [];
|
|
227
|
+
const classAttrParts = [];
|
|
228
|
+
for (const el of document.querySelectorAll('*')) {
|
|
229
|
+
const styleAttr = el.getAttribute('style');
|
|
230
|
+
if (styleAttr) styleAttrParts.push(`style="${styleAttr}"`);
|
|
231
|
+
const classAttr = el.getAttribute('class');
|
|
232
|
+
if (classAttr) classAttrParts.push(classAttr);
|
|
233
|
+
}
|
|
234
|
+
const patternCorpora = {
|
|
235
|
+
styleText: [cssText, ...styleAttrParts].join('\n'),
|
|
236
|
+
classText: classAttrParts.join('\n'),
|
|
237
|
+
};
|
|
238
|
+
for (const f of runPageCheck('html-patterns', () => checkHtmlPatterns(html, patternCorpora).filter(item =>
|
|
222
239
|
item.id !== 'bounce-easing' && item.id !== 'layout-transition'
|
|
223
240
|
))) {
|
|
224
241
|
const item = finding(f.id, filePath, f.snippet);
|
|
@@ -5,11 +5,24 @@ import path from 'node:path';
|
|
|
5
5
|
// File walker
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
+
// Hidden directories are skipped wholesale during recursion (below), which
|
|
9
|
+
// covers .git / .next / .nuxt / .svelte-kit / .turbo / .vercel and — the
|
|
10
|
+
// issue #303 class — every vendored AI-harness install (.claude, .cursor,
|
|
11
|
+
// .codex, .agents, .impeccable, ...) whose bundled detector source would
|
|
12
|
+
// otherwise be reported as findings on a root scan. Only the non-hidden
|
|
13
|
+
// build/dependency dirs need naming. An explicitly passed hidden target
|
|
14
|
+
// still scans: walkDir name-checks children, never the root it's given.
|
|
8
15
|
const SKIP_DIRS = new Set([
|
|
9
|
-
'node_modules', '
|
|
10
|
-
'.svelte-kit', '__pycache__', '.turbo', '.vercel',
|
|
16
|
+
'node_modules', 'dist', 'build', '__pycache__',
|
|
11
17
|
]);
|
|
12
18
|
|
|
19
|
+
// The exceptions to the hidden-dir rule: hidden directories that
|
|
20
|
+
// conventionally hold real UI source rather than tooling or vendored code.
|
|
21
|
+
// VitePress and VuePress keep custom theme components in
|
|
22
|
+
// .vitepress/theme/*.vue / .vuepress/theme/, and Storybook keeps preview
|
|
23
|
+
// decorators/styles in .storybook/.
|
|
24
|
+
const HIDDEN_SOURCE_DIRS = new Set(['.vitepress', '.vuepress', '.storybook']);
|
|
25
|
+
|
|
13
26
|
const SCANNABLE_EXTENSIONS = new Set([
|
|
14
27
|
'.html', '.htm', '.css', '.scss', '.sass', '.less',
|
|
15
28
|
'.jsx', '.tsx', '.js', '.ts',
|
|
@@ -24,6 +37,7 @@ function walkDir(dir) {
|
|
|
24
37
|
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return files; }
|
|
25
38
|
for (const entry of entries) {
|
|
26
39
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
40
|
+
if (entry.isDirectory() && entry.name.startsWith('.') && !HIDDEN_SOURCE_DIRS.has(entry.name)) continue;
|
|
27
41
|
const full = path.join(dir, entry.name);
|
|
28
42
|
if (entry.isDirectory()) files.push(...walkDir(full));
|
|
29
43
|
else if (SCANNABLE_EXTENSIONS.has(path.extname(entry.name).toLowerCase())) files.push(full);
|
|
@@ -28,16 +28,6 @@ const ANTIPATTERNS = [
|
|
|
28
28
|
skillSection: 'Typography',
|
|
29
29
|
skillGuideline: 'overused fonts like Inter',
|
|
30
30
|
},
|
|
31
|
-
{
|
|
32
|
-
id: 'single-font',
|
|
33
|
-
category: 'slop',
|
|
34
|
-
scopes: ['type'],
|
|
35
|
-
name: 'Single font without hierarchy',
|
|
36
|
-
description:
|
|
37
|
-
'Only one font family is used for the entire page. A single family can work when weight and size contrast carry the hierarchy; otherwise pair a distinctive display font with a refined body font.',
|
|
38
|
-
skillSection: 'Typography',
|
|
39
|
-
skillGuideline: 'only one font family for the entire page',
|
|
40
|
-
},
|
|
41
31
|
{
|
|
42
32
|
id: 'flat-type-hierarchy',
|
|
43
33
|
category: 'slop',
|
|
@@ -149,6 +139,15 @@ const ANTIPATTERNS = [
|
|
|
149
139
|
skillSection: 'Color & Contrast',
|
|
150
140
|
skillGuideline: 'dark mode with glowing accents',
|
|
151
141
|
},
|
|
142
|
+
{
|
|
143
|
+
id: 'radial-spotlight-glow',
|
|
144
|
+
category: 'slop',
|
|
145
|
+
name: 'Decorative radial spotlight glow',
|
|
146
|
+
description:
|
|
147
|
+
'A soft, low-opacity accent-colored radial gradient fading to transparent, dropped behind a hero or section as a "spotlight." It is a reflex AI decoration — the translucent cousin of the saturated radial halo. Let the surface stand on its own, or light the composition with a deliberate material accent rather than a floating colored haze.',
|
|
148
|
+
skillSection: 'Color & Contrast',
|
|
149
|
+
skillGuideline: 'dark mode with glowing accents',
|
|
150
|
+
},
|
|
152
151
|
{
|
|
153
152
|
id: 'marquee',
|
|
154
153
|
category: 'slop',
|
|
@@ -189,15 +188,14 @@ const ANTIPATTERNS = [
|
|
|
189
188
|
skillGuideline: 'tiny uppercase tracked label above the hero headline',
|
|
190
189
|
},
|
|
191
190
|
{
|
|
192
|
-
id: '
|
|
191
|
+
id: 'kicker-above-heading',
|
|
193
192
|
category: 'slop',
|
|
194
193
|
scopes: ['type'],
|
|
195
|
-
|
|
196
|
-
name: 'Repeated section kicker labels',
|
|
194
|
+
name: 'Kicker / eyebrow label above heading',
|
|
197
195
|
description:
|
|
198
|
-
'
|
|
196
|
+
'A tiny tracked uppercase or small-caps label sitting as its own block directly above a heading is banned outright, repeated or not. Generated kickers never earn their place: the heading carries its own weight. Delete the label and let the heading speak; if the words matter, work them into the heading or the body.',
|
|
199
197
|
skillSection: 'Typography',
|
|
200
|
-
skillGuideline: '
|
|
198
|
+
skillGuideline: 'kicker or eyebrow labels above headings',
|
|
201
199
|
},
|
|
202
200
|
{
|
|
203
201
|
id: 'numbered-section-labels',
|