question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Unexpected token :" for JSON-LD (ld+json).

See original GitHub issue

If I place a JSON-LD script element in an HTML file, ESLint throws an error of “Unexpected token :”.

Google doc: https://developers.google.com/search/docs/guides/intro-structured-data

    <script type="application/ld+json">
        {
            "@context": "http://schema.org",
            "@type": "Organization",
            "url": "http://www.example.com",
            "name": "Unlimited Ball Bearings Corp.",
            "contactPoint": {
                "@type": "ContactPoint",
                "telephone": "+1-401-555-1212",
                "contactType": "Customer service"
            }
        }
    </script>

Disabling ESLint in Sublime Text menubar’s “Toggle” command removes the error.

Adding /* eslint-disable unexpected-token */ doesn’t remove the error.

Should this be reported here or at SublimeLinter-eslint?

Can this be prevented, please?

  • ESLint 4.17.0
  • SublimeLinter 3.10.10
  • Sublime Text 3.0
  • macOS 10.13.3 High Sierra

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
eslint-deprecated[bot]commented, Feb 16, 2018

Hi @jaepage, thanks for the issue. It looks like there’s not enough information for us to know how to help you.

If you’re reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

Requesting a rule change? Please see Proposing a Rule Change for instructions.

If it’s something else, please just provide as much additional information as possible. Thanks!

0reactions
ilyavolodincommented, Jul 26, 2018

I think we should close this issue. I’m still not sure what exactly was the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is JSON and How to Handle an “Unexpected Token” Error
In this article you will learn what JSON is and how you can deal with errors occurring when parsing JSON data, such as...
Read more >
jquery - Dynamic Script tag causing "unexpected token illegal"
1 Answer 1 · What would be the best way to accomplish generating a dynamic script tag filled with JSON content? – user2916134....
Read more >
How to fix Unexpected Token in JSON error (for ... - YouTube
Not a programmer? Read this! ** - If you get this error in an app you didn't make, and/or you're not a web...
Read more >
JSON-LD 1.1 Framing - W3C on GitHub
1.5 Syntax Tokens and Keywords. This specification adds a number of keywords ( framing keywords ) to the ones defined in the JSON-LD...
Read more >
JSON-LD 1.1 - W3C
A blank node identifier is a string that can be used as an identifier for a blank node within the scope of a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found