What linter do you use (if any) with ES2015?


#1

@awatson1978 recommended atom-jshint in her meteor-api pkg write-up (thanks for the awesome pkg and info), but both atom-jshint and jshint seem to be dormant and looking for maintainers.

The original authors of those pkgs both said they were moving on in favor of ESLint…ok, so I checked out the eslint atom package and of course, abandoned long ago and doesn’t even install to the current atom 1.3.1.

Seems like jshint works just fine but boy do I hate those errors I get for every single missing semi-colon!

What do you use (if anything) to lint your ES2015?


#2

We’re going to recommend a standard es2015 eslint config based on the Airbnb style guide soon. Unfortunately it will still complain about semicolons, but you can turn that off in the configuration.

While it is nice to run the linter from your editor, you could also use it as a command line tool. we should look into how best to integrate with atom.


#3

Awesome, good to know! Thanks for the speedy and concise reply.

I’m currently doing linting through the command line and just this morning decided to move it all into atom after installing awatson’s awesome pkg and reading through her notes. As if using stylus already doesn’t make me lazy enough…now I barely have to type anything! :stuck_out_tongue:


#4
  • 1 for eslint. I’m using the airbnb style guide with a few overrides. eshint will complain about new syntax with ES6.

Seems like jshint works just fine but boy do I hate those errors I get for every single missing semi-colon!

I would try and either use them all the time or not at all so that it’s consistent. I wonder if Babel inserts those for you at compile time?


#5

I wrote up how to set up linting with eslint for Sublime, Atom, and Webstorm a couple of months ago. That info should still be valid, though you should keep an eye out for the forthcoming standard .eslintrc file that Sashko mentioned. As others have said, one of the great virtues of eslint is that it is so configurable. You can literally turn off any rule. You can also easily adopt a standard .eslintrc file and just override rules for things like semicolons or single vs. double quotes.


#6

I personally prefer to always use them, but working on the same repository as someone who tries to never use them is where the problem occurs. That’s why I think I’ll just stop using them and override the syntax alert, best solution I guess?

I thought that it was a completely optional thing w/ES6, but I guess there are lexical conditions that determine if they are required…makes sense.


#7

Yea you can always setup an override and set the value to 0 to ignore it.


#8

I really like xo https://github.com/sindresorhus/xo#rules, which is built on eslint. But I also really like AVA, the concurrent test framework put out by the same guy. I have a script that calls xo src/**/*.js --plugin=react --esnext --space --fix and it fixes stupid things like missing semicolons automatically & lists out all trickier errors.

No dotfiles, no mess.


#9

You guys with your fancy new fangled linters. In my day we did everything with jslint and were happy dammit!
– Douglas Crockford

P.S. --> Get off my lawn.


#10

Ah. So latest news in the land of Atom linting:

Based on Robert and Sashko’s excellent write ups a few months ago, I’ve been testing using .eslintrc in Atom using the linter-eslint package, and it’s been going swimmingly.

https://atom.io/packages/linter-eslint

In fact, it’s quickly become obvious it’s basically the best linter around. So use that. If you’re not on es2015 yet, I’d also highly recommend the jsformat tool, and you can get both linting and autoformatting for the existing Meteor Style Guide (one of the reasons we’ll be waiting on upgrading to es2015 for a bit yet; since there’s not a good formatting tool yet).

https://atom.io/packages/jsformat

Regardless, both of these packages should be listed in the Atom package readme. Suffice it to say that the Atom Package Manager is sorta wonky and brittle, and my Atom account has been broken for a few months, and I’m waiting for a DB admin at Github to reset the account so I can publish again. I should follow up with them and try to get an Atom release published this week…


#11

For those interested, here are the quick steps needed to get eslint setup in Atom with Airbnb’s config:

  1. Install “linter-eslint” via the Atom package manager.

  2. Run the following (or similar if you don’t want these installed globally):
    npm install -g eslint-config-airbnb eslint-plugin-react eslint

  3. Create an .eslintrc file in your project root with the following contents:
    { "extends": "airbnb" }

  4. Within Atom preferences, under “linter-eslint” settings, check “Use global ESLint installation”.

  5. If you get an error stating there’s a problem with your $PATH, install the atom-fix-path package and restart Atom.


Linting for Meteor
#12

I’m using jsformat with ES6 without any problems so far.


#13

Does anyone have a good sample .eslintrc file to be used with React and Atom? I saw an old article that points to this file, is it still the latest?
https://github.com/meteor/meteor/blob/devel/scripts/admin/eslint/.eslintrc


#14

@hwillson, I tried to install by you (global), but don’t work with global path.
And then I tried to install atom-fix-path, still don’t work.
(npm get prefix: /usr/local in ubuntu)


#15

@sashko Any news on this? I couldn’t find it in the 1.3 Guide.


#16

The 1.3 Guide reference app (Todos) is configured to use eslint. Check the package.json for the eslintConfig specifics.


#17

eslint with babel-eslint. using foross standard config and eslint-plugin-react


#18

found it:


#19

Hi newbie here. I am following the guide to install eslint with airbnb style.

When I do $npm install --save-dev eslint eslint-plugin-react eslint-plugin-meteor eslint-config-airbnb

I got the following error:

npm WARN peerDependencies The peer dependency eslint-plugin-react@^4.3.0 included from eslint-config-airbnb will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 15.3.0
npm ERR! argv “node” “/usr/local/bin/npm” “install” “–save-dev” “eslint” “eslint-plugin-react” “eslint-plugin-meteor” "eslint-config-airbnb"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package eslint-plugin-react does not satisfy its siblings’ peerDependencies requirements!
npm ERR! peerinvalid Peer eslint-config-airbnb@7.0.0 wants eslint-plugin-react@^4.3.0


#20

Peer eslint-config-airbnb@7.0.0 wants eslint-plugin-react@^4.3.0

do npm install --save-dev eslint-plugin-react@^4.3.0

The error is due to the latest version being 5.0.1 which doesn’t satisfy ^4.3.0