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.

VSCode error "Unexpected token # in JSON"

See original GitHub issue

Hi, for a few days I’ve been getting this error in VSCode:

Screen Shot 2022-02-18 at 11 46 36

As text:

[9:56:22 AM] ERROR: Exception while linting with markdownlint-cli2:
Error: Unable to parse '/Users/borekb/dev/shoptet/sofa/docs/docs/.markdownlint.jsonc'; Parser 0: Unexpected token # in JSON at position 0; Parser 1: A collection cannot be both a mapping and a sequence
    at /Users/borekb/.vscode/extensions/davidanson.vscode-markdownlint-0.46.0/bundle.js:33:29570
    at /Users/borekb/.vscode/extensions/davidanson.vscode-markdownlint-0.46.0/bundle.js:1:2260

In the terminal, all works fine:

$ yarn markdownlint-cli2 '**/*.md'
markdownlint-cli2 v0.1.3 (markdownlint v0.23.1)
Finding: **/*.md !**/node_modules/** !**/.next/** !**/dist/**
Linting: 80 file(s)
Summary: 0 error(s)

Also strange is that the VSCode error mentions a file /Users/borekb/dev/shoptet/sofa/docs/docs/.markdownlint.jsonc which doesn’t exist on my disk and I’m not sure where it’s coming from.

The only markdownlint config we have in the repo is repo-root-level .markdownlint-cli2.js with this content:

require('./.pnp.cjs').setup();

const path = require('path');

module.exports = {
  config: {
    MD007: {
      indent: 4,
    },
    MD013: false,
    MD014: false,
    MD040: false,
    MD029: false,
    MD033: false,
    MD026: false,
    MD009: { br_spaces: 0 },
    MD031: { list_items: false },
    'graphql-examples': {
      schema: path.join(__dirname, 'packages/graphql/schema.graphql'),
      globs: [`${__dirname}/docs/docs/**/*.md{,x}`],
    },
  },
  ignores: ['**/node_modules/**', '**/.next/**', '**/dist/**'],
  customRules: ['@shoptet-private/markdownlint-graphql-examples'],
};

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidAnsoncommented, Mar 28, 2022

(I may still need an allow list for schemes for cases when a workspace is not open.)

0reactions
borekbcommented, Apr 2, 2022

I’ve tested the problematic scenario and all’s OK – that’s great! 🎉 Thanks a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token # in JSON at position 0 when opening ...
I've tried your code in my project and nothing wrong. everything looks fine. Check the Jupyter Server network, try to restart vscode and ......
Read more >
Unexpected token in JSON at position 262140 when ... - GitHub
Close all instances of VS Code. Go to, %USERPROFILE%/.vscode/extensions (on windows) or ~/.vscode/extensions on Linux/Mac.
Read more >
Unexpected Token Error in VS Code - InterSystems community
I've checked the JSON settings file that VS Code uses, and they're fine and formatted properly. All of the settings I've entered are...
Read more >
SyntaxError:Unexpected token < in JSON at position 4
SyntaxError :Unexpected token < in JSON at position 4.. AGAnonymized GDPR ... Visual Studio has persistent instabilities and malfunctions with that error.
Read more >
How to Fix SyntaxError: Unexpected token < in JSON at ...
Usually this error is caused when your server returns HTML (which typically begins with <DOCTYPE html> or <html> ) instead of JSON. Valid...
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