Skip to content

Commit

Permalink
Fix report() for index/endIndex zero values (#7565)
Browse files Browse the repository at this point in the history
* Fix end positions for CSS entities with a length of 1 at the start of a stylesheet

* also check index and update postcss

* Create red-fans-wait.md
  • Loading branch information
romainmenke committed Mar 21, 2024
1 parent a02e4dd commit dba9a6e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-fans-wait.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `report()` for `index`/`endIndex` zero values
4 changes: 2 additions & 2 deletions lib/utils/report.cjs
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/utils/report.mjs
Expand Up @@ -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;
}

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down

0 comments on commit dba9a6e

Please sign in to comment.