Skip to content

ES6 jsconfig.json error #54

Closed
Closed

Description

I am incorrectly getting the following error, "This can only be used with ES6. Make sure to have a jsconfig.json-file which sets the target to ES6".

Furthermore, I think I may have stumbled upon a weird case where if the start of the file name is "temp" as in "temp.js", "temporary.js", or "temp123.js" it will cause this error.

To reproduce:
Create a file called temp.js with some ES6 code, such as:

let x = 10

The above error is now showing. To fix it, create the jsconfig.json file which sets the target to ES6:

{
    "compilerOptions": {
        "target": "ES6"
    }
}

The error is still showing, now incorrectly.

If I rename "temp.js" to "test.js" (or anything that doesn't start with 'temp') the error goes away. Or, if I create a files array in jsconfig.json which lists "temp.js", the error goes away:

{
    "compilerOptions": {
        "target": "ES6"
    },
    "files": [
        "temp.js"
    ]
}

I don't want to have to do this for every file in my project.

I'm running on Windows 7, 64-bit.

Thanks

Activity

  1. lllama commented on Nov 18, 2015

    @lllama

    I'm seeing a similar thing when editing Vue files (http://vuejs.org/guide/application.html#Single_File_Components). These are HTML-like and will have a script tag that contains JS.
    image

    I have the following jsconfig.json file:
    { "compilerOptions": { "target": "ES6", "module": "system" }, "files": [ "Editor.vue" ] }

    (with Editor.vue being my file). I'm manually setting the filetype to HTML as well.

  2. warpdesign commented on Nov 18, 2015

    @warpdesign
    Contributor

    +1
    @ron-wade noticed that as well. Ended up using jshint instead.

  3. garethfentimen commented on Nov 18, 2015

    @garethfentimen

    +1
    I am using: export default angular.module('thingsModule', []);
    [Just installed latest update - looks like its resolved... impressive]

  4. r25s commented on Nov 18, 2015

    @r25s
    Author

    Gareth (@garethfentimen) might be a different problem you were having, as I am the issue with the latest release: 0.10.1.

  5. gigafied commented on Nov 19, 2015

    @gigafied

    I am having related issues to this, and wasn't really sure how to fix it. It seems to happen a lot for new files, but if I save the file, close VS Code and reopen it, the errors go away. Editing jsconfig.json and saving it seems to correct the issue as well, doesn't seem to matter what changes I made the jsconfig, just that it did change.

  6. garethfentimen commented on Nov 19, 2015

    @garethfentimen

    Taka Kojima (@gigafied) what naming convention were you using for your files when you had the errors. I also found that restarting in conjunction with dropping my myfile.controller.js convention for a more straight forward myfileController.s seemed to clear the es6 messages. So like you say it is possible that it is just a new file thing.

  7. gigafied commented on Nov 19, 2015

    @gigafied

    I get it even if I rename an existing file, from Something.js to SomethingElse.js, but indeed, if i just edit jsconfig.json and add a insignificant space somewhere, then hit save, everything starts working again.

  8. fxOne commented on Nov 19, 2015

    @fxOne

    +1
    It's wired for me, in some files in my project it's work in others not. I'm using a the jsconfig.jscon without a file configuration. Sometimes it works for a few hours and then the "This can only be used with ES6. Make sure to have a jsconfig.json-file which sets the target to ES6" error comes back.

  9. kuashe commented on Nov 19, 2015

    @kuashe

    +1 Having the same issue

  10. sbrinkmann commented on Nov 19, 2015

    @sbrinkmann

    +1

  11. jrieken commented on Dec 4, 2015

    @jrieken
    Contributor

    Making this a duplicate of #703. There are a few things off when it comes to jsconfig.json and I trying to tackle them for Dec15

  12. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions