Page MenuHomePhabricator

stylelint is just outputting dots and number of errors, making it impossible to fix
Closed, ResolvedPublic

Assigned To
Authored By
Daimona
Mar 19 2018, 4:48 PM
Referenced Files
F15909178: Screenshot_20180320_093154.png
Mar 20 2018, 8:52 AM
F15887719: Screenshot_20180319_220001.png
Mar 19 2018, 9:01 PM
Tokens
"100" token, awarded by Liuxinyu970226."100" token, awarded by StjnVMF."Like" token, awarded by mmodell."Burninate" token, awarded by zeljkofilipin.

Description

While submitting this commit (PS 17) and this one (PS 40, the last one), jenkins downvoted them due to a stylelint failure. Examinating the console output, it turns out to be highly cryptic about the problem: it only shows some dots. @Huji informed stylelint creators on their github, but it sounds like the problem here comes from our grunt task. Sometimes it may be a nasty problem when you aren't able to test it on a local machine, since it doesn't give any clue about the error.

Screenshot_20180319_220001.png (210×451 px, 8 KB)

Repro case

mkdir bar
cd bar && git init
git fetch https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter refs/changes/29/410129/40
git checkout FETCH_HEAD
npm install
./node_modules/.bin/stylelint modules/ext.abuseFilter.css  # OK
./node_modules/.bin/grunt stylelint  # mangled output

Event Timeline

hashar renamed this task from Wrong output for stylelint to stylelint issue on Abusefilter are meaningless. Just show dots and "1 problem".Mar 19 2018, 9:01 PM
hashar added a project: AbuseFilter.
hashar updated the task description. (Show Details)

The CI infrastructure basically runs npm install && npm test. We surely added some basic configuration to all MediaWiki extensions but I don't think we added stylelint everywhere.

One should be able to tweak the output by following https://stylelint.io/user-guide/configuration/ or maybe the repository uses a Grunt task.

Surely contributors of https://github.com/wikimedia/stylelint-config-wikimedia know better how to tweak stylelint output on failures. I have subscribed them to this task :]

@hashar Eurgh, we've got reports upstream about this, you're the first one in our environment though (which might make it easier to test solutions against it):
https://github.com/wikimedia/grunt-stylelint/issues/49

stylelint doesn't show the issue (running it via .node_modules/.bin/stylelint)

grunt-stylelint invokes styleLint.lint with the options:

{ failOnError: true,
  files: [ 'modules/ext.abuseFilter.css' ],
  formatter: 'string' }

And from stylelint it gets:

{ errored: true,
  output: '\n\u001b[4mmodules/ext.abuseFilter.css\u001b[24m\n .. ..  .  ...                             ...        \n  . .   .                                             \n        .\n\n',
  results: 
   [ { source: '/home/hashar/projects/mediawiki/extensions/AbuseFilter/modules/ext.abuseFilter.css',
       deprecations: [],
       invalidOptionWarnings: [],
       parseErrors: [],
       errored: true,
       warnings: [Object],
       ignored: undefined,
       _postcssResult: [Object] } ] }

The issue seems to be in stylelint stringFormatter. It passes a list of messages to table@4.0.2 and that screw it up. The messages being passed:

[ [ 74,
    20,
    '\u001b[31m\u001b[31m✖\u001b[31m\u001b[39m',
    'Unexpected named color "gray" ',
    '\u001b[2mcolor-named\u001b[22m' ] ]

And table returns the space/dots.

Side note: running grunt with --verbose gives show the proper output as well as the mangled one using spaces/dots:

Screenshot_20180320_093154.png (338×587 px, 24 KB)

Also seen in https://gerrit.wikimedia.org/r/c/420929/ for ContentTranslation. I can see the errors locally, but they make no sense. There are no } on those lines.

So I assume some dependency that is not specified with exact version got updated and broke things.

Diffing work and failing build for CX:

-│ │ │ └── electron-to-chromium@1.3.39
-│ │ ├── caniuse-lite@1.0.30000815
+│ │ │ └── electron-to-chromium@1.3.40
+│ │ ├── caniuse-lite@1.0.30000817


-│ ├─┬ postcss-less@1.1.3
+│ ├─┬ postcss-less@1.1.4

And indeed downgrading postcss-less to 1.13 makes those two errors go away. But I think this is a separate issue and does not relate to the display issue, so I leave this task at this.

FWIW: On my Ubuntu server (over ssh) with node v7.0.0 and npm 3.10.8 I don't observe the "dots" issue, but locally with Debian and node v9.8.0 and npm 5.6.0 I do see it.

<snip>

-│ ├─┬ postcss-less@1.1.3
+│ ├─┬ postcss-less@1.1.4

And indeed downgrading postcss-less to 1.13 makes those two errors go away. But I think this is a separate issue and does not relate to the display issue, so I leave this task at this.

That one got filled as T190269: Warning: Task "stylelint:src" failed due to postcss-less@1.1.4.

That is a different issue unrelated to the postcss-less one :D

Legoktm triaged this task as Unbreak Now! priority.Apr 3 2018, 4:09 AM
Legoktm subscribed.

This is a bit ridiculous...

Running "stylelint:all" (stylelint) task

resources/screen-mobile.less
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .                                                                     
 ... ..  .  ...                            ...                                 
     .   .                                                                     
         .

✖ 8 problems

Warning: Task "stylelint:all" failed. Use --force to continue.

I guess the real issue tracking this is https://github.com/wikimedia/grunt-stylelint/issues/49 ?

Legoktm renamed this task from stylelint issue on Abusefilter are meaningless. Just show dots and "1 problem" to stylelint is just outputting dots and number of errors, making it impossible to fix.Apr 3 2018, 4:09 AM

Workaround: ./node_modules/.bin/stylelint resources/*.less appears to work.

Jdforrester-WMF claimed this task.

AbuseFilter fix is https://gerrit.wikimedia.org/r/424175 as an example. We'll need to do a general all-repo upgrade to fix this for everyone, but for now I'm deeming this Resolved.

Seems not to help on GettingStarted:
https://integration.wikimedia.org/ci/job/mwgate-npm-node-6-docker/33663/console
trigged by https://gerrit.wikimedia.org/r/#/c/424729/

00:39:47 Running "stylelint:all" (stylelint) task
00:39:50 
00:39:50 resources/lightbulb/lightbulb.flyout.less
00:39:50  .. .  .  ...                              ...        
00:39:50   . .  .                                              
00:39:50     .  .                                              
00:39:50  .. .  .  ...                              ...        
00:39:50   . .  .                                              
00:39:50     .  .
00:39:50 
00:39:50 ✖ 2 problems
00:39:50 
00:39:50 Warning: Task "stylelint:all" failed. Use --force to continue.
00:39:50

Doesn't fix the issue on Kartographer, either.

Doesn't fix the issue on Kartographer, either.

I see no failure on the project's patch sets

I see no failure on the project's patch sets

See PS1 of https://gerrit.wikimedia.org/r/#/c/426019/. I pulled down this version and ran stylelint with libraries updated as in https://gerrit.wikimedia.org/r/424175 and saw no improvement.

Based on above reports, upgrading doesn't seem to help.

StjnVMF set Security to Software security bug.May 18 2018, 5:19 PM
StjnVMF added a project: acl*security.
StjnVMF changed the visibility from "Public (No Login Required)" to "Custom Policy".
StjnVMF awarded a token.
StjnVMF subscribed.
StjnVMF unsubscribed.
Jdforrester-WMF removed a project: acl*security.
Jdforrester-WMF changed the visibility from "Custom Policy" to "Public (No Login Required)".

This was fixed through fixes upstream in grunt. If you run into issues, a clear out of your node_modules directory should fix things.