Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

How do I change to ES6 so far as this is concerned? #237

Closed
excenter opened this issue Mar 21, 2016 · 16 comments
Closed

How do I change to ES6 so far as this is concerned? #237

excenter opened this issue Mar 21, 2016 · 16 comments

Comments

@excenter
Copy link

I've been using this for a while, but where I'm at we use ES6, and have a gulp task to write an ES5 version until there's enough browser support.
I have 2 parallel requests:

  • A basic explanation on how to permanently change it to ES6 support
  • A setting in the preference pane (or the atom config file) that changes the ES version to 6.

I've read #202 and it doesn't help, it just shrugs off the setting to somewhere else and doesn't explain where it goes to.

@Arcanemagus
Copy link
Member

You need to properly configure your jshint for this (through the .jshintrc file), all this package does is run jshint on the open file and report the results.

If you have jshint properly configured, and jshint from the CLI is reporting different results from what you are seeing inside Atom, then that is a bug that needs to be looked into.

@excenter
Copy link
Author

where is this file!? Looking through my computer, there are over 40 files named .jshintrc.

@excenter
Copy link
Author

excenter commented Mar 21, 2016

what words do I put in what file? If I had it properly configured, I wouldn't be here asking questions.
This package owns whatever version of jshint is throwing the error.
What changes do I put in which version of jshintrc? in the /.atom/packages/linter-jshint/ folder has two of them, and adding "esversion":6 to both of them does nothing.

@Arcanemagus
Copy link
Member

@excenter You should start by reading the Configuration section of the jshint documentation. This will provide a basic idea of how configuring jshint works.

In general you place a .jshintrc file in the root of your project, this file is read whenever you run the linter on your project. This project, linter-jshint is only a translator between the output of running jshint on a file, and what the linter Atom package is expecting in order to display the issues within the Atom editor.

Neither of the .jshintrc files in this packages folders should ever have a effect on your project, as they are only for testing this package's internal functionality.

Hopefully that helps lead you in the right direction, but it isn't the goal of this package to be a tutorial on jshint itself (If I was writing that I would tell you to use eslint as it is a much better linter in my opinion...), you should familiarize yourself with jshint using any of the resources that can be found from a quick Google search.

@excenter
Copy link
Author

Thank you! @Arcanemagus
The solution was to make a .jshintrc file at my root developer folder, where the contents are just
{ "esversion":6 }
/*jshint esversion: 6 */ will throw an error when atom boots up because it's not JSON formatted correctly.

@BenGitsCode
Copy link

@excenter when you say root developer folder, do you mean your individual project root every time? I'm still getting the W104 error in atom after that.

@excenter
Copy link
Author

excenter commented Aug 31, 2016

@BenGitsCode

In a folder parent to the working directory (the starred ones)
Developer *
\ Category *
\Project []
In my Developer folder, I created a file called .jshintrc that contained { "esversion":6 } among other options.
It's really not intuitive

@BenGitsCode
Copy link

Not intuitive at all, but it worked. At least now I can stop wrapping every javascript file in that hideous function form of use strict.

@ghost
Copy link

ghost commented Sep 24, 2016

just put /*jshint esversion: 6 */ at the top of your js file

@revintec
Copy link

revintec commented Jun 5, 2017

@broros Your solution works great, don't know why this is downvoted, I upvoted it.
I don't want change es6 settings globally, but rather only on certain files.

@fabianclain
Copy link

fabianclain commented Jun 9, 2017

This worked for me, without adding "/*jshint esversion: 6 */ " on top of each JS file.

{
  "jasmine": true,
  "mocha": true,
  **"esversion":6,**
  "globals": {
    **"esversion": 6,**
    "angular": false,
    "browser": false,
    "inject": false,
    "_": false,
    "driver": false,
    "protractor": false,
    "$": false,
    "$$": false,
    "element": false,
    "by": false,
    "list": false
  }
}

@IAmNatch
Copy link

@1greenapplee which file did you write this in^

@fabianclain
Copy link

.jshintrc
Are you using webstorm for this? in this case, you will need to load the config file.

@IAmNatch
Copy link

I've added esversion and global esversion to the .jshintrc and I'm still getting linted for using const. Any ideas? I really don't want to create a new config file for every project I want to lint properly...

@fabianclain
Copy link

If you are using webstorm, or jetbrains products, this is where the config is being set.

01

@tkshehan
Copy link

tkshehan commented Mar 25, 2018

I added this in my User Settings/Workplace Settings in Visual Studio Code.

"jshint.options" : {"esversion": 6}

capture

@AtomLinter AtomLinter locked as resolved and limited conversation to collaborators Mar 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants