Skip to content

Instantly share code, notes, and snippets.

@suhas-karanth
Last active July 31, 2016 10:24
Show Gist options
  • Save suhas-karanth/77f589f4ee2e58a911abbe1c5572c4a0 to your computer and use it in GitHub Desktop.
Save suhas-karanth/77f589f4ee2e58a911abbe1c5572c4a0 to your computer and use it in GitHub Desktop.
My Eslint configuration for node v6.3
{
"env": {
"es6": true,
"node": true,
"builtin": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"arrowFunctions": true,
"experimentalObjectRestSpread": true
}
},
"globals": {},
"extends": "eslint:recommended",
"plugins": ["promise"],
"rules": {
//Possible Errors
"no-empty": ["error", {
"allowEmptyCatch": true
}],
"no-extra-parens": ["warn", "all", {
"nestedBinaryExpressions": false
}],
"no-irregular-whitespace": ["error", {
"skipComments": true,
"skipRegExps": true,
"skipTemplates": true
}],
"no-unsafe-finally": "error",
"valid-jsdoc": ["warn", {
"requireReturn": false,
"requireReturnType": false,
"requireParamDescription": false,
"requireReturnDescription": false
}],
"no-console": "off",
//Best Practices
"array-callback-return": "error",
"block-scoped-var": "error",
"curly": "error",
"dot-notation": ["error", {
"allowKeywords": true
}],
"eqeqeq": ["warn", "allow-null"],
"guard-for-in": "error",
"no-else-return": "error",
"no-empty-function": "error",
"no-eval": "error",
"no-extend-native": "warn",
"no-floating-decimal": "error",
"no-implicit-coercion": ["error", {
"string": false
}],
"no-loop-func": "error",
"no-multi-str": "error",
"no-proto": "error",
"no-sequences": "error",
"no-with": "error",
"wrap-iife": ["error", "any"],
"default-case": ["warn", {
"commentPattern": "^skip\\sdefault"
}],
"dot-location": ["error", "property"],
"no-alert": "error",
"no-caller": "error",
"no-extra-bind": "error",
"no-implied-eval": "error",
"no-invalid-this": "warn",
"no-iterator": "error",
"no-labels": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-escape": "error",
"no-void": "error",
"radix": "error",
"yoda": "error",
//Strict Mode
"strict": ["error", "global"],
//Variables
"no-shadow": ["error", {
"builtinGlobals": true
}],
"no-unused-vars": ["error", {
"varsIgnorePattern": "[iI]gnore",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^ignore"
}],
"no-use-before-define": ["error", {
"functions": false,
"classes": true
}],
"no-delete-var": "error",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-undefined": "error",
//Node.js and CommonJS
"no-path-concat": "error",
//Stylistic Issues
"block-spacing": "warn",
"camelcase": ["warn", {
"properties": "never"
}],
"comma-style": ["warn", "last"],
"eol-last": ["error", "unix"],
"indent": ["warn", 4, {
"VariableDeclarator": 1
}],
"linebreak-style": ["error", "unix"],
"max-len": ["warn", {
"code": 120,
"comments": 120,
"ignoreUrls": true
}],
"new-cap": ["warn", {
"capIsNew": true
}],
"no-bitwise": "error",
"no-lonely-if": "warn",
"no-multiple-empty-lines": ["error", {
"max": 2,
"maxEOF": 1
}],
"no-new": "error",
"quotes": ["warn", "single"],
"require-jsdoc": ["warn", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
}
}],
"semi": ["error", "always"],
"callback-return": "error",
"handle-callback-err": "error",
"no-mixed-requires": ["error", {
"grouping": true
}],
"no-new-require": "error",
"array-bracket-spacing": ["error", "never"],
"brace-style": "error",
"comma-dangle": ["error", "never"],
"comma-spacing": "warn",
"computed-property-spacing": ["error", "never"],
"consistent-this": ["error", "self"],
"func-names": "error",
"func-style": ["error", "declaration", {
"allowArrowFunctions": true
}],
"id-length": "warn",
"max-depth": ["error", 6],
"max-lines": ["error", {
"max": 300,
"skipBlankLines": true,
"skipComments": true
}],
"max-nested-callbacks": "error",
"max-params": ["error", 5],
"max-statements-per-line": "error",
"new-parens": "error",
"newline-per-chained-call": ["error", {
"ignoreChainWithDepth": 3
}],
"no-array-constructor": "error",
"no-mixed-operators": ["error", {
"allowSamePrecedence": true
}],
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"no-new-object": "error",
"no-spaced-func": "error",
"no-trailing-spaces": ["error", {
"skipBlankLines": true
}],
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"operator-assignment": ["error", "always"],
"quote-props": ["error", "as-needed", {
"keywords": true
}],
"space-unary-ops": "error",
"spaced-comment": ["error", "always", {
"exceptions": ["-+", "-", "*", "-+"]
}],
"wrap-regex": "error",
//ECMAScript 6
"arrow-body-style": ["error", "always"],
"arrow-parens": ["error", "always"],
"arrow-spacing": ["error", {
"before": true,
"after": true
}],
"generator-star-spacing": ["error", "after"],
"no-confusing-arrow": "error",
"no-duplicate-imports": ["error", {
"includeExports": true
}],
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-var": "warn",
"object-shorthand": ["error", "always", {
"ignoreConstructors": true
}],
"prefer-arrow-callback": "error",
"prefer-const": "warn",
"prefer-reflect": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"prefer-template": "error",
"require-yield": "error",
//Plugin - Promise
"promise/param-names": 2,
"promise/always-return": 2,
"promise/catch-or-return": 2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment