fix: react-doctor small categories 68→72 (a11y+perf+style, 21 fixes)
- no-outline-none (2): add focus-visible outline to inline-styled inputs - no-redundant-roles (2): drop role="list" on <ul> - click-events-have-key-events (2): convert div backdrops to buttons - no-static-element-interactions (2): add role+tabIndex+onKeyDown to clickable divs - rendering-svg-precision (2): round SVG path decimals - no-tiny-text (2): 11px → 12px on CommandPalette hints - js-set-map-lookups (4→1): Sets for visibleItems, regex for keyword match - no-gray-on-colored-background (4): use color-matched text instead of stone-400/900 - no-transition-all (4): list specific properties in transition shorthand
This commit is contained in:
@@ -258,11 +258,16 @@ function fallbackParse(
|
||||
stops: stopKeywords,
|
||||
};
|
||||
|
||||
const escapeRegex = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const keywordPatterns: Record<string, RegExp> = {};
|
||||
for (const [etype, kws] of Object.entries(keywordMaps)) {
|
||||
keywordPatterns[etype] = new RegExp(kws.map(escapeRegex).join("|"));
|
||||
}
|
||||
|
||||
for (const header of h) {
|
||||
for (const [etype, keywords] of Object.entries(keywordMaps)) {
|
||||
for (const kw of keywords) {
|
||||
if (header.includes(kw)) typeScores[etype] = (typeScores[etype] ?? 0) + 1;
|
||||
}
|
||||
for (const [etype, pattern] of Object.entries(keywordPatterns)) {
|
||||
const matches = header.match(pattern);
|
||||
if (matches) typeScores[etype] = (typeScores[etype] ?? 0) + matches.length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,10 +314,15 @@ function fallbackParse(
|
||||
notes: ["notes", "note", "special_instructions", "comments", "memo", "instruction"],
|
||||
};
|
||||
|
||||
const semanticPatterns: Record<string, RegExp> = {};
|
||||
for (const [field, kws] of Object.entries(semanticMap)) {
|
||||
semanticPatterns[field] = new RegExp(kws.map(escapeRegex).join("|"));
|
||||
}
|
||||
|
||||
for (let i = 0; i < h.length; i++) {
|
||||
const header = h[i];
|
||||
for (const [field, keywords] of Object.entries(semanticMap)) {
|
||||
if (keywords.some((kw) => header.includes(kw))) {
|
||||
for (const [field, pattern] of Object.entries(semanticPatterns)) {
|
||||
if (pattern.test(header)) {
|
||||
columnMappings[headers[i]] = field;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user