gulp-stylelint
gulp-stylelint copied to clipboard
Error "ruleMetadata" when using "verbose" or "github" formatter (reporters)
First of all, I made sure that the error wasn't caused by Stylelint itself : the command npx stylelint **/*.scss --formatter verbose
works without error.
The error I get while launching a task using gulp-stylelint :
node:events:505
throw er; // Unhandled 'error' event
^
PluginError [TypeError]: Cannot read properties of undefined (reading 'ruleMetadata')
at printProblems (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/stylelint/lib/formatters/verboseFormatter.js:72:33)
at verboseFormatter (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/stylelint/lib/formatters/verboseFormatter.js:86:3)
at Object.apply (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/import-lazy/index.js:16:20)
at reporter (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/@ronilaukkarinen/gulp-stylelint/src/reporter-factory.js:45:27)
at /home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/@ronilaukkarinen/gulp-stylelint/src/index.js:132:38
at Array.map (<anonymous>)
at passLintResultsThroughReporters (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/@ronilaukkarinen/gulp-stylelint/src/index.js:132:22)
Emitted 'error' event on Domain instance at:
at Transform.emit (node:domain:525:12)
at Transform.onerror (/home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/readable-stream/lib/_stream_readable.js:640:52)
at Transform.emit (node:events:527:28)
at Transform.emit (node:domain:475:12)
at /home/mah/Documents/www/drupal-starterkit-mah.localhost/node_modules/@ronilaukkarinen/gulp-stylelint/src/index.js:170:16
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
__safety: undefined,
_stack: undefined,
plugin: 'gulp-stylelint',
showProperties: true,
showStack: true,
domainEmitter: Transform {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] { prefinish: [Function: prefinish] },
_eventsCount: 1,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_transform: [Function: onFile],
_flush: [Function: onStreamEnd],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
domainThrown: false
}
The error is the same when using "github" formatter, but when using other formatters (ex : "string") everything works well.
It seems that it's linked to some new functionalities of Stylelint : https://github.com/stylelint/stylelint/pull/6166 So using an older version of Stylelint (ex : 14.9) is OK, but it breaks from 14.10.
In my error you can see that I'm actually already using a fork of gulp-stylelint (@ronilaukkarinen/gulp-stylelint) that is supposed to be more "up to date", but the error is the same when using one package or the other. It seems neither is accounting for this new "metadata" functionality of Stylelint.
I have a similar error
TypeError in plugin "gulp-stylelint"
Message:
Cannot read properties of undefined (reading 'ruleMetadata')
Details:
domainEmitter: [object Object]
domainThrown: false