TimKam / atomic-vale

a vale linter plugin for Atom
MIT License
6 stars 2 forks source link

Uncaught SyntaxError: Unexpected token I in JSON at position 0 #8

Closed jdkato closed 7 years ago

jdkato commented 7 years ago

This exception is thrown whenever I open this file in Atom. It's possible that this is an issue with Vale, but I can't reproduce it outside of Atom (it works fine from the CLI and in Sublime Text). The JSON output (see below) also appears to be valid.

Let me know if I can provide anymore information.

Thanks!

JSON
{
  "conscious-style.md":[
    {
      "Check":"18F.Contractions",
      "Description":"",
      "Line":4,
      "Link":"",
      "Message":"Use 'we're' instead of 'we are.'",
      "Severity":"error",
      "Span":[
        80,
        85
      ]
    },
    {
      "Check":"18F.Terms",
      "Description":"",
      "Line":12,
      "Link":"",
      "Message":"Prefer 'people' or 'The public' over of 'citizen.'",
      "Severity":"warning",
      "Span":[
        14,
        20
      ]
    },
    {
      "Check":"18F.Contractions",
      "Description":"",
      "Line":23,
      "Link":"",
      "Message":"Use 'who's' instead of 'who is.'",
      "Severity":"error",
      "Span":[
        90,
        95
      ]
    },
    {
      "Check":"vale.Wordiness",
      "Description":"",
      "Line":25,
      "Link":"",
      "Message":"Consider using 'usually' instead of 'In most cases'",
      "Severity":"warning",
      "Span":[
        194,
        206
      ]
    }
  ]
}

Atom: 1.16.0 x64 Electron: 1.3.13 OS: Mac OS X 10.12.4 Thrown From: atomic-vale package 1.4.0

Stack Trace

Uncaught SyntaxError: Unexpected token I in JSON at position 0

At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html:1

SyntaxError: Unexpected token I in JSON at position 0
    at Object.parse (native)
    at /packages/atomic-vale/lib/init.coffee:100:29)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:543:20)

Commands

  2x -0:26.2.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-syntax.theme-one-dark-ui)

Non-Core Packages


atom-beautify 0.29.22 
atomic-vale 1.4.0 
busy-signal 1.3.0 
clang-format 1.28.0 
cucumber 0.6.0 
file-icons 2.1.3 
git-plus 7.5.0 
go-plus 5.4.0 
intentions 1.1.2 
language-latex 1.0.0 
language-lua 0.9.11 
language-protobuf 0.7.1 
latex 0.43.0 
linter 2.1.4 
linter-clang 4.1.1 
linter-flake8 2.1.5 
linter-js-standard 3.9.0 
linter-ui-default 1.2.3 
markdown-table-formatter 2.9.0 
minimap 4.27.1 
project-plus 0.9.0 
sort-lines 0.14.0 
tool-bar 1.1.0 
tool-bar-main 0.0.10 
vim-mode-plus 0.90.2 
TimKam commented 7 years ago

Thanks a lot for reporting this. Looks like vale is interpreting the text input as a flag, because it starts with --.

TimKam commented 7 years ago

Wrapping the text input in single quotes fixes this issue. The vale README uses single quotes (instead of only the text input) in its examples, so we can assume my implementation didn't comply with vale's API.