Skip to content

Instantly share code, notes, and snippets.

@ezy
Last active March 21, 2018 00:29
Show Gist options
  • Save ezy/316a365235b1c6583787b108769c0b09 to your computer and use it in GitHub Desktop.
Save ezy/316a365235b1c6583787b108769c0b09 to your computer and use it in GitHub Desktop.
Eslint for sails.js
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"extends": "eslint:recommended",
"env": {
"node": true
},
"rules": {
"no-console": 0,
"callback-return": 2, // enforce return after a callback
"global-require": 0, // enforce require() on top-level module scope
"handle-callback-err": 2, // enforce error handling in callbacks
"no-mixed-requires": 2, // disallow mixing regular variable and require declarations
"no-new-require": 2, // disallow use of new operator with the require function
"no-path-concat": 2, // disallow string concatenation with __dirname and __filename
"no-process-exit": 2, // disallow process.exit()
"no-restricted-imports": 0, // restrict usage of specified node imports
"no-restricted-modules": 0, // restrict usage of specified node modules
"no-sync": 1, // disallow use of synchronous methods
//Stylistic Issues
"array-bracket-spacing": [2, "never"], // enforce spacing inside array brackets
"block-spacing": 0, // disallow or enforce spaces inside of single line blocks
"brace-style": 2, // enforce one true brace style
"camelcase": 1, // require camel case names
"comma-spacing": [
2,
{
"before": false,
"after": true
}
], // enforce spacing before and after comma
"comma-style": 2, // enforce one true comma style
"computed-property-spacing": 2, // require or disallow padding inside computed properties
"consistent-this": 2, // enforce consistent naming when capturing the current execution context
"eol-last": 2, // enforce newline at the end of file, with no multiple empty lines
"func-names": 0, // require function expressions to have a name
"func-style": 0, // enforce use of function declarations or expressions
"id-blacklist": 0, // blacklist certain identifiers to prevent them being used
"id-length": 0, // this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
"id-match": 0, // require identifiers to match the provided regular expression
"indent": ["error", 2], // specify tab or space width for your code
"jsx-quotes": 0, // specify whether double or single quotes should be used in JSX attributes
"key-spacing": 2, // enforce spacing between keys and values in object literal properties
"keyword-spacing": [2, {
"before": true,
"after": true,
"overrides": {
"if": {"after": false},
"for": {"after": false},
"while": {"after": false},
"catch": {"after": false}
}
}], // enforce spacing before and after keywords
"linebreak-style": 2, // disallow mixed 'LF' and 'CRLF' as linebreaks
"lines-around-comment": 0, // enforce empty lines around comments
"max-depth": 1, // specify the maximum depth that blocks can be nested
"max-len": [1, 200], // specify the maximum length of a line in your program
"max-lines": 0, // enforce a maximum file length
"max-nested-callbacks": 2, // specify the maximum depth callbacks can be nested
"max-params": 0, // limits the number of parameters that can be used in the function declaration.
"max-statements": 0, // specify the maximum number of statement allowed in a function
"max-statements-per-line": 0, // enforce a maximum number of statements allowed per line
"new-cap": 0, // require a capital letter for constructors
"new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments
"newline-after-var": 0, // require or disallow an empty newline after variable declarations
"newline-before-return": 0, // require newline before return statement
"newline-per-chained-call": [
"error",
{"ignoreChainWithDepth": 2}
], // enforce newline after each call when chaining the calls
"no-array-constructor": 2, // disallow use of the Array constructor
"no-bitwise": 0, // disallow use of bitwise operators
"no-continue": 0, // disallow use of the continue statement
"no-inline-comments": 0, // disallow comments inline after code
"no-lonely-if": 2, // disallow if as the only statement in an else block
"no-mixed-operators": 0, // disallow mixes of different operators
"no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
"no-multiple-empty-lines": 2, // disallow multiple empty lines
"no-negated-condition": 0, // disallow negated conditions
"no-nested-ternary": 0, // disallow nested ternary expressions
"no-new-object": 2, // disallow the use of the Object constructor
"no-plusplus": 0, // disallow use of unary operators, ++ and --
"no-restricted-syntax": 0, // disallow use of certain syntax in code
"no-spaced-func": 2, // disallow space between function identifier and application
"no-ternary": 0, // disallow the use of ternary operators
"no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
"no-unneeded-ternary": 2, // disallow the use of ternary operators when a simpler alternative exists
"no-whitespace-before-property": 2, // disallow whitespace before properties
"object-curly-newline": 0, // enforce consistent line breaks inside braces
"object-curly-spacing": 0, // require or disallow padding inside curly braces
"object-property-newline": 0, // enforce placing object properties on separate lines
"one-var": [2, "never"], // require or disallow one variable declaration per function
"one-var-declaration-per-line": 2, // require or disallow an newline around variable declarations
"operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely
"operator-linebreak": [1, "before"], // enforce operators to be placed before or after line breaks
"padded-blocks": [2, "never"], // enforce padding within blocks
"quote-props": [2, "as-needed"], // require quotes around object literal property names
"quotes": [2, "single"], // specify whether backticks, double or single quotes should be used
"require-jsdoc": 0, // Require JSDoc comment
"semi-spacing": 2, // enforce spacing before and after semicolons
"sort-imports": 0, // sort import declarations within module
"semi": 2, // require or disallow use of semicolons instead of ASI
"sort-vars": 0, // sort variables within the same declaration block
"space-before-blocks": 2, // require or disallow a space before blocks
"space-before-function-paren": [
2,
"never"
], // require or disallow a space before function opening parenthesis
"space-in-parens": 2, // require or disallow spaces inside parentheses
"space-infix-ops": 2, // require spaces around operators
"space-unary-ops": 2, // require or disallow spaces before/after unary operators
"spaced-comment": 0, // require or disallow a space immediately following the // or /* in a comment
"unicode-bom": 0, // require or disallow the Unicode BOM
"wrap-regex": 0, // require regex literals to be wrapped in parentheses
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment