mjmlio / atom-linter-mjml

MJML plugin for Atom Linter
https://atom.io/packages/linter-mjml
MIT License
8 stars 1 forks source link

Error: [MJMLError] ParseError: Error while parsing the file #3

Closed JeffCleverley closed 7 years ago

JeffCleverley commented 7 years ago

MJML Linter is showing that there are no issues (green tick), when there are.

Then when I go to save the file I get this error:

Error: [MJMLError] ParseError: Error while parsing the file

Error: [MJMLError] ParseError: Error while parsing the file
    at MJMLError.Error (native)
    at new MJMLError (/Users/Jeff/.atom/packages/linter-mjml/node_modules/mjml-core/lib/Error.js:26:110)
    at documentParser (/Users/Jeff/.atom/packages/linter-mjml/node_modules/mjml-core/lib/parsers/document.js:145:11)
    at documentParser (/Users/Jeff/.atom/packages/linter-mjml/node_modules/mjml-core/lib/index.js:58:10)
    at /Users/Jeff/.atom/packages/linter-mjml/index.js:24:32
    at Object.lint (/Users/Jeff/.atom/packages/linter-mjml/index.js:21:16)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/Jeff/.atom/packages/linter/lib/linter-registry.js:63:26)
    at /Users/Jeff/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (/Users/Jeff/.atom/packages/linter/lib/linter-registry.js:60:18)
    at /Users/Jeff/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at /Users/Jeff/.atom/packages/linter/lib/editor-linter.js:30:20
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1144:27)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1114:19)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:904:26)
    at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:738:18)
    at Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:3:59)
    at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:721:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:693:35)
    at atom-workspace.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/register-default-commands.js:225:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:259:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:587:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:382:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:106:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:59)

Any ideas?

ngarnier commented 7 years ago

Hi @JeffCleverley, can you please share your MJML code?

JeffCleverley commented 7 years ago

Sure:

Because I also have an error problem with the mjml preview package in Atom I was using the online editor. (No luck... maybe symptomatic of a deeper problem?)

But for some reason the online editor isn't showing the two columns of text under the image (3rd section down) and nothing was appearing in the online linter:

https://mjml.io/try-it-live/r15odffug

So I tried checking it in Atom Linter. It showed no errors. So I forced an obvious error to check to see if it was working. It still showed no errors. When I corrected the error and saved the file I got the above parse error.

<mjml>
  <mj-head>
    <mj-title>Zane Mellupe | [Date] Newsletter</mj-title>
    <mj-attributes>
      <mj-all font-family="Helvetica, Verdana, sans-serif" />
      <mj-all color="black" />
      <mj-all background-color="white" />
      <mj-class name="big" font-size="24px" />
      <mj-class name="biggish" font-size="15px" />
      <mj-class name="medium" font-size="13px" />
      <mj-class name="small" font-size="8px" />
      <mj-class name="alright" align="right" />
      <mj-class name="alleft" align="left" />
      <mj-class name="full" width="100%" />
      <mj-class name="head" padding-bottom="0px"/>
    </mj-attributes>
    <mj-style>
      .op3 {opacity:0.3;} .op5 {opacity:0.5;} .op7 {opacity:0.7;} .op8 {opacity:0.8;} .op9 {opacity:0.9;}
    </mj-style>
  </mj-head>
  <mj-body>
    <mj-container>
      <mj-section mj-class="head">
        <mj-column>
            <mj-image width="600px" src="https://zanemellupe.com/zanemellupenavbanner.png" href="https://zanemellupe.com"/>
            <mj-text mj-class="biggish">
              <span class="op8">News Release - [Date][Year]</span>
            </mj-text>
            <mj-text mj-class="big">
              <span class="op3">Beyond The Lights | Animal Farm <br/>ifa gallery</span>
            </mj-text>
        </mj-column>
      </mj-section>
      <mj-section>
        <mj-column>
          <mj-image width="600px" src="http://ezuconsulting.com/images/revisitinglandscapeandrevisitinglandscape1.jpg" href="https://zanemellupe.com/artwork/revisiting-landscape-and-revisiting-landscape/"/>
        </mj-column>
      </mj-section>
      <mj-section>
        <mj-column>
          <span color="black">For the exhibition "Beyond the lights", ifa gallery proposes a series of "luminous" works by varied artists such as Zane Mellupe or Christophe Demaître. 'Since the 1950s, natural or artificial light has become a privileged material for many contemporary artistic practices, whether they come from painting, sculpture or photography. For a long time, the light was a mystical or religious symbol materialising the divine and integrated by artists such as physical and natural. It has graduallly been introduced as immaterial, almost tangible, prevailing in art.</span>
        </mj-column>
        <mj-column>
          <span>For the exhibition "Beyond the lights", ifa gallery proposes a series of "luminous" works by varied artists such as Zane Mellupe or Christophe Demaître. 'Since the 1950s, natural or artificial light has become a privileged material for many contemporary artistic practices, whether they come from painting, sculpture or photography. For a long time, the light was a mystical or religious symbol materialising the divine and integrated by artists such as physical and natural. It has graduallly been introduced as immaterial, almost tangible, prevailing in art.</span>
        </mj-column>
      </mj-section>
      <mj-section>
        <mj-column width="50%">
          <mj-text mj-class="small alleft">
            <span class="op5">[View in Browser]</span>
          </mj-text>
        </mj-column>
        <mj-column width="50%">
          <mj-text mj-class="small alright">
            <span class="op5">[Unsubscribe]</span>
          </mj-text>
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
 </mjml>

Thanks

Jeff

JeffCleverley commented 7 years ago

I spotted my problem with displaying. Forgot <mj-text></mj-text>

Still that's beside the problem

ngarnier commented 7 years ago

hey @JeffCleverley, indeed there were 2 missing mj-text. However, when using the linter it does show me that you're using span elements where you shouldn't:

When I add the mj-text, I don't have any other issue. It also seems to be working fine with the preview package:

Because I can't reproduce, this will be tricky! What version of the linter are you using?

JeffCleverley commented 7 years ago

Yup, those <span>'s are gone now too. I found the mjml app here, so I am using that for preview at the moment. But lacks the linter, and prefer to keep everything under one roof if possible.

I appreciate the difficulty, and any help you can give.

linter 1.11.21 linter-mjml 1.0.0

I forced an error to illustrate <mj-styl>:

screen shot 2017-02-04 at 2 20 10 am

As mentioned, I also have a bug with the atom mjml preview package. Coincidence, or do you think perhaps they are connected? https://github.com/mjmlio/atom-mjml-preview/issues/1

Jeff

JeffCleverley commented 7 years ago

I took a nuclear option, uninstalled everything:

Atom and all packages. Node and npm and all packages installed via NPM.

I cleaned house entirely. Reinstalled Node and npm via homebrew. Reinstalled Atom. Only installed mjml-languages, mjml-linter and linter.

Error persists. haha.

vmatalon commented 7 years ago

I'm having the same error. I've been testing it out with the code examples from the documentation... No issues compiling to HTML but whenever I save in Atom this error message appears.

iRyusa commented 7 years ago

Thanks for reporting this !

Looks like an issue with MJML 3.2.X branch, I think it will be ok with MJML 3.3 I'll let you know about it

JeffCleverley commented 7 years ago

@iRyusa look forward to it.

ngarnier commented 7 years ago

Hello, I'm closing as this is fixed in the v1.1.0 of the plugin. Thanks for reporting @JeffCleverley!