thomasvantuycom/gulp-prettier

Syntax error: is it possible to get the file name where is it throwing?

Closed this issue · 1 comments

minuz commented

Hi,
I'm trying to improve an old library (at work) for emails and not sure which file is generating the error

[14:23:52] SyntaxError in plugin "gulp-prettier"
Message:
    Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (85:25)
  83 |                             </li>
  84 |                           </ol>
> 85 |                         </p>
     |                         ^
  86 |                         <table class="spacer"><tbody><tr><td height="16px" style="font-size:16px;line-height:16px;">&#xA0;</td></tr></tbody></table>
  87 |                         <center data-parsed>
  88 |                           <table class="button radius float-center"><tr><td><table><tr><td><a href="{%= FieldValues['ScreeningUrl'].Value %}">SCREEN NOW</a></td></tr></table></td></tr></table>
Details:
    loc: [object Object]
    codeFrame:   83 |                             </li>
  84 |                           </ol>
> 85 |                         </p>
     |                         ^
  86 |                         <table class="spacer"><tbody><tr><td height="16px" style="font-size:16px;line-height:16px;">&#xA0;</td></tr></tbody></table>
  87 |                         <center data-parsed>
  88 |                           <table class="button radius float-center"><tr><td><table><tr><td><a href="{%= FieldValues['ScreeningUrl'].Value %}">SCREEN NOW</a></td></tr></table></td></tr></table>
    domainEmitter: [object Object]
    domainThrown: false

[14:23:52] 'build' errored after 5.54 s
[14:23:52] 'default' errored after 5.54 s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

It tells me the line where it's throwing, but since it's an array of html files, I have no idea which file is actually broken.

function prettify() {
  const htmlPath = 'dist/pages';
  return gulp.src(htmlPath + '/*.html')
      .pipe($.prettier({ parser: 'html' }))
      .pipe(gulp.dest(htmlPath))
}

Is it possible to find which file is generating the error?

That is indeed a helpful addition. Fixed in 565f3d3. The error now contains a fileName line.