diff --git a/.changeset/red-fans-wait.md b/.changeset/red-fans-wait.md new file mode 100644 index 0000000000..908f4671fb --- /dev/null +++ b/.changeset/red-fans-wait.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `report()` for `index`/`endIndex` zero values diff --git a/lib/utils/report.cjs b/lib/utils/report.cjs index 01c14f6786..b11881cd95 100644 --- a/lib/utils/report.cjs +++ b/lib/utils/report.cjs @@ -106,13 +106,13 @@ function report(problem) { if (problem.start) { warningProperties.start = problem.start; - } else if (index) { + } else if (typeof index === 'number') { warningProperties.index = index; } if (problem.end) { warningProperties.end = problem.end; - } else if (endIndex) { + } else if (typeof endIndex === 'number') { warningProperties.endIndex = endIndex; } diff --git a/lib/utils/report.mjs b/lib/utils/report.mjs index 3555b42e58..899855034a 100644 --- a/lib/utils/report.mjs +++ b/lib/utils/report.mjs @@ -102,13 +102,13 @@ export default function report(problem) { if (problem.start) { warningProperties.start = problem.start; - } else if (index) { + } else if (typeof index === 'number') { warningProperties.index = index; } if (problem.end) { warningProperties.end = problem.end; - } else if (endIndex) { + } else if (typeof endIndex === 'number') { warningProperties.endIndex = endIndex; } diff --git a/package-lock.json b/package-lock.json index 61e7965df6..364ede8d91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "micromatch": "^4.0.5", "normalize-path": "^3.0.0", "picocolors": "^1.0.0", - "postcss": "^8.4.35", + "postcss": "^8.4.38", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^7.0.0", "postcss-selector-parser": "^6.0.16", @@ -14786,9 +14786,9 @@ } }, "node_modules/postcss": { - "version": "8.4.35", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", - "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", "funding": [ { "type": "opencollective", @@ -14806,7 +14806,7 @@ "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "source-map-js": "^1.2.0" }, "engines": { "node": "^10 || ^12 || >=14" @@ -17832,9 +17832,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "engines": { "node": ">=0.10.0" } diff --git a/package.json b/package.json index f03848af88..dabeb8c407 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,7 @@ "micromatch": "^4.0.5", "normalize-path": "^3.0.0", "picocolors": "^1.0.0", - "postcss": "^8.4.35", + "postcss": "^8.4.38", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^7.0.0", "postcss-selector-parser": "^6.0.16",