0

I'm trying to use StandardJS to lint my code, but it gives me this unexpected parsing error when I run standard --fix:

standard: Use JavaScript Standard Style (https://standardjs.com)
  C:\Users\<path>\index.js:7:11: Parsing error: Unexpected token =

Here is the part of my code it's referring to (indicating the 7th line, there is a '>' symbol):

export class DiscordEmbed {
    constructor () {
    }

    title = null;
    description = null;
>   url = null;
    color = null;
    fields= [ ];
    thumbnail = { url: null };
    image = { url: null };
    author = { name: null, url: null, icon_url: null };
    footer = { text: null, icon_url: null };

...

I expected StandardJS to lint my code without any difficulties, as my code is working as intended, I've tested it multiple times. This makes me believe that this is a StandardJS-specific problem.

kennedy
  • 1
  • 2
  • Is your linter configured to parse class field syntax? – Bergi Apr 04 '22 at 14:01
  • 1
    It's weird though that the error appears on the `url` line, not on the `title` one. – Bergi Apr 04 '22 at 14:01
  • the StandardJS linter doesn't require and configuration, that's what it's about. yeah. it's odd that it only appears on the third instance of a new value. – kennedy Apr 04 '22 at 14:08
  • [It actually does](https://standardjs.com/index.html#how-do-i-use-experimental-javascript-es-next-features), but I suppose you're not using that. While class fields are stage 4 and will be released this year with ES2022, maybe [standardjs wasn't updated yet](https://github.com/standard/vscode-standard/issues/91)? – Bergi Apr 04 '22 at 14:15
  • that might be the issue, I'll look it up – kennedy Apr 04 '22 at 14:27

0 Answers0