impeccable 2.1.6 → 2.1.7
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/package.json
CHANGED
|
@@ -516,7 +516,7 @@ function checkColors(opts) {
|
|
|
516
516
|
// Tailwind class checks
|
|
517
517
|
if (classList) {
|
|
518
518
|
const classStr = typeof classList === 'string' ? classList : Array.from(classList).join(' ');
|
|
519
|
-
if (/\bbg-black\b/.test(classStr)) {
|
|
519
|
+
if (/\bbg-black\b(?!\/)/.test(classStr)) {
|
|
520
520
|
findings.push({ id: 'pure-black-white', snippet: 'bg-black' });
|
|
521
521
|
}
|
|
522
522
|
|
|
@@ -822,9 +822,11 @@ function resolveBackground(el, win) {
|
|
|
822
822
|
while (current && current.nodeType === 1) {
|
|
823
823
|
const style = IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
|
|
824
824
|
|
|
825
|
-
// If this element has a gradient
|
|
825
|
+
// If this element has a background-image (gradient or url), it's visually
|
|
826
|
+
// opaque but we can't determine the effective color — bail out so callers
|
|
827
|
+
// don't get a false solid-color answer.
|
|
826
828
|
const bgImage = style.backgroundImage || '';
|
|
827
|
-
if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
|
|
829
|
+
if (bgImage && bgImage !== 'none' && (/gradient/i.test(bgImage) || /url\s*\(/i.test(bgImage))) {
|
|
828
830
|
return null;
|
|
829
831
|
}
|
|
830
832
|
|
|
@@ -834,8 +836,8 @@ function resolveBackground(el, win) {
|
|
|
834
836
|
const rawStyle = current.getAttribute?.('style') || '';
|
|
835
837
|
const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
|
|
836
838
|
const inlineBg = bgMatch ? bgMatch[1].trim() : '';
|
|
837
|
-
// Check for gradient in inline style too
|
|
838
|
-
if (/gradient/i.test(inlineBg)) return null;
|
|
839
|
+
// Check for gradient or url() image in inline style too
|
|
840
|
+
if (/gradient/i.test(inlineBg) || /url\s*\(/i.test(inlineBg)) return null;
|
|
839
841
|
bg = parseRgb(inlineBg);
|
|
840
842
|
if (!bg && inlineBg) {
|
|
841
843
|
const hexMatch = inlineBg.match(/#([0-9a-f]{6}|[0-9a-f]{3})\b/i);
|
|
@@ -511,7 +511,7 @@ function checkColors(opts) {
|
|
|
511
511
|
// Tailwind class checks
|
|
512
512
|
if (classList) {
|
|
513
513
|
const classStr = typeof classList === 'string' ? classList : Array.from(classList).join(' ');
|
|
514
|
-
if (/\bbg-black\b/.test(classStr)) {
|
|
514
|
+
if (/\bbg-black\b(?!\/)/.test(classStr)) {
|
|
515
515
|
findings.push({ id: 'pure-black-white', snippet: 'bg-black' });
|
|
516
516
|
}
|
|
517
517
|
|
|
@@ -817,9 +817,11 @@ function resolveBackground(el, win) {
|
|
|
817
817
|
while (current && current.nodeType === 1) {
|
|
818
818
|
const style = IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
|
|
819
819
|
|
|
820
|
-
// If this element has a gradient
|
|
820
|
+
// If this element has a background-image (gradient or url), it's visually
|
|
821
|
+
// opaque but we can't determine the effective color — bail out so callers
|
|
822
|
+
// don't get a false solid-color answer.
|
|
821
823
|
const bgImage = style.backgroundImage || '';
|
|
822
|
-
if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
|
|
824
|
+
if (bgImage && bgImage !== 'none' && (/gradient/i.test(bgImage) || /url\s*\(/i.test(bgImage))) {
|
|
823
825
|
return null;
|
|
824
826
|
}
|
|
825
827
|
|
|
@@ -829,8 +831,8 @@ function resolveBackground(el, win) {
|
|
|
829
831
|
const rawStyle = current.getAttribute?.('style') || '';
|
|
830
832
|
const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
|
|
831
833
|
const inlineBg = bgMatch ? bgMatch[1].trim() : '';
|
|
832
|
-
// Check for gradient in inline style too
|
|
833
|
-
if (/gradient/i.test(inlineBg)) return null;
|
|
834
|
+
// Check for gradient or url() image in inline style too
|
|
835
|
+
if (/gradient/i.test(inlineBg) || /url\s*\(/i.test(inlineBg)) return null;
|
|
834
836
|
bg = parseRgb(inlineBg);
|
|
835
837
|
if (!bg && inlineBg) {
|
|
836
838
|
const hexMatch = inlineBg.match(/#([0-9a-f]{6}|[0-9a-f]{3})\b/i);
|