Page MenuHomePhabricator

stylelint reports invalid line numbers
Closed, InvalidPublic

Description

E.g. for c13959 / 565721, https://integration.wikimedia.org/ci/job/mwgate-node10-docker/71325/console says

22:00:58 modules/homepage/suggestededits/ext.growthExperiments.Homepage.SuggestedEdits.less
22:00:58  177✖  Unexpected empty line before closing brace   block-closing-brace-empty-line-before

which is a bit hard to interpret, but refers to line 177, column 2 (based on eslint errors which are similarly garbled but have correct line numbers).
Related: T243115: Output of npm Jenkins tests is garbled

But the line actually violating the stylelint rule is line 407.

Observation (@Demian): stylelint's line counter is often unreliable. At one time it seemed to me comment lines might not be counted, but I didn't verify this idea.
Additionally, some lint rules match inside comments...
Related: T245957: [Development tooling] grunt stylelint gives false positives inside comments, attributed to the wrong line number (tracking upstream reports)

Event Timeline

A bug got filled later on with a bit more details and references to Upstream issues: T245957 That looks very similar?

This was not a false positive (unless there's a false positive and a false negative in the same file). The line number problem seems like the same issue, but the upstream reports are not about that.

A bug got filled later on with a bit more details and references to Upstream issues: T245957 That looks very similar?

For the record: https://github.com/stylelint/stylelint/issues/4616 + 2 more

Those are all false positives inside comments, therefore a different issue, but while encountering that issue I've also noticed that stylelint's reported line numbers are very often unreliable. With generic error messages sometimes it's impossible to determine the problem location and I had to do many trial-and-error runs to find that "4.0" inside a comment was parsed as a number and rejected... Quotes within comments also tripped stylelint. Troublesome, but a separate bug from this.

I don't quite know who is in charge of stylelint or can assist on it. Maybe that can instead by reported to https://github.com/wikimedia/stylelint-config-wikimedia/issues , or we need a dedicated Phabricator projects with maintainers. Meanwhile I am reallocating the task to the generic ci-test-error , there is not much we can do on the CI config or infrastructure side.