Skip to content

Instantly share code, notes, and snippets.

@coopermaruyama
Last active November 21, 2015 22:18
Show Gist options
  • Save coopermaruyama/57d3ac2d547c2c99536c to your computer and use it in GitHub Desktop.
Save coopermaruyama/57d3ac2d547c2c99536c to your computer and use it in GitHub Desktop.
UI Team ESLint (+ Miguel's suggestions)
{
"root": true,
"env": {
"es6": true,
"browser": true
},
"rules": {
"indent": [2, "tab"],
"strict": [2, "global"],
"no-use-before-define": 0,
"curly": 2,
"complexity": 2,
"eqeqeq": [2, "smart"],
"no-lone-blocks": 2,
"no-magic-numbers": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-unused-expressions": 2,
"no-useless-call": 2,
"vars-on-top": 2,
"wrap-iife": [2, "outside"],
"callback-return": 2,
"array-bracket-spacing": [2, "never"],
"block-spacing": [2, "always"],
"brace-style": [2, "1tbs", {
"allowSingleLine": true
}],
"camelcase": 2,
"comma-spacing": [2, {
"before": false,
"after": true
}],
"no-mixed-spaces-and-tabs": 0,
"comma-style": [2, "last"],
"computed-property-spacing": [2, "never"],
"consistent-this": [2, "self"],
"func-names": 2,
"func-style": [2, "declaration", {
"allowArrowFunctions": true
}],
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}],
"lines-around-comment": [2, {
"beforeBlockComment": true,
"beforeLineComment": true,
"afterLineComment": false
}
],
"max-nested-callbacks": [2, 2],
"new-cap": 2,
"newline-after-var": [1, "always"],
"no-inline-comments": 1,
"no-lonely-if": 0,
"padded-blocks": [0, "always"],
"one-var": [1, "never"],
"operator-assignment": [1, "never"],
"operator-linebreak": [1, "after"],
"quote-props": [1, "consistent-as-needed", {
"keywords": true
}],
"quotes": [1, "single", "avoid-escape"],
"space-after-keywords": [1, "always"],
"space-before-blocks": 2,
"space-before-function-paren": [1, {
"anonymous": "always",
"named": "never"
}],
"space-in-parens": [0, "always"],
"space-before-keywords": [1, "always"],
"spaced-comment": [1, "always", {
"exceptions": ["-"]
}],
"object-curly-spacing": [1, "always", {
"objectsInObjects": false,
"arraysInObjects": false
}],
"max-len": [2, 80, 4]
},
"globals": {
"angular": false
}
}
@miguelmota
Copy link

Sweet, looks good.

Here's my feedback:

Aways use strict mode. If using ES6 modules then set it global, otherwise function scoped.

"strict": [2, "global”]

Not sure why we need spaces in inside parenthesis. Seems to go against JavaScript conventions. I’d set it to none.

space-in-parens": [0, "always"]

Space before function paren should be none if named function. Only need a space after function keyword; according to all the popular JavaScript style guides.

 ”space-before-function-paren”: [1, {
      "anonymous": "always",
      "named": "never"
   }],

Set es6 flag to true if using babel otherwise it'll complain about es6 features.

  "env": {
    "es6": true,
    "browser": true
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment