So now that Meteor 1.3 has been out for a long time, what ESLint would you recommend?

There’s Mantra’s ESLint file: https://github.com/mantrajs/mantra-sample-blog-app/blob/master/.eslintrc

But I think that includes some stuff that a normal Meteor react app doesn’t use.

Which eslint file would you recommend for a vanilla Meteor, React, ReactRouter application?

What the Meteor Guide recommends

2 Likes

I keep taking the guide for granted - keep forgetting it has useful information now. :stuck_out_tongue:

We are using AirBnB style guide, but with a few style changes that we like better.

'rules': {

    // The total number of characters allowed on each line of code including indentation
    // http://eslint.org/docs/rules/max-len
    'max-len': [2, 120, 2, {'ignoreUrls': true, 'ignoreComments': false}],

    // Require Constructors to Use Initial Caps
    // http://eslint.org/docs/rules/new-cap
    'new-cap': [2, {'capIsNewExceptions': ['Match', 'Match.ObjectIncluding']}],

    // Require a space after unary operator ! and not before new
    // http://eslint.org/docs/rules/space-unary-ops
    'space-unary-ops': [2, {
      'words': true,
      'nonwords': false,
      'overrides': {
        'new': false,
        '!': true
      }
    }],

    // Disallow Reassignment of Function Parameters, but allow modifying the properties of parameters
    // http://eslint.org/docs/rules/no-param-reassign
    'no-param-reassign': [2, {'props': false}],

    // Dangling commas on multiple lines are not required
    // http://eslint.org/docs/rules/comma-dangle
    'comma-dangle': [2, 'only-multiline'],

    // Allow quoting properties as needed
    // http://eslint.org/docs/rules/quote-props
    'quote-props': [2, 'as-needed', {'keywords': true, 'unnecessary': false, 'numbers': false}],

    // Wrap the function expression for immediately-invoked function expressions (IIFE)
    // http://eslint.org/docs/rules/wrap-iife
    'wrap-iife': [2, 'inside'],

    // No space after or before a curly brace wrapping an object or import
    // http://eslint.org/docs/rules/object-curly-spacing.html
    'object-curly-spacing': [2, 'never'],

    // Put a blank space before line comments except at beginning of object or block
    // http://eslint.org/docs/rules/lines-around-comment
    'lines-around-comment': [2, { 'beforeLineComment': true, 'allowObjectStart': true, 'allowBlockStart': true }],
  }

so if I want to use it in my atom editor, what linter are you guys using, if any ?

ALbeit no t a linter, this is a snippets package from our own @hharnisc. Has airbnb style snippets.

And this is another linter package that claims to have airbnb style linter for es6.

If there was a standard for linter and eslint packages for atom it would be these two:

“linter” and “linter-eslint”

I use them pretty much every day for a number of different projects which include ES6, ES6 (Babel) and React JSX files. The trick is getting the right .eslintrc configuration.

Here: an example for an ES6 configuration that follows all of airbnbs rules:

You can omit the env entries for jasmine and jest (this project uses jest for testing).