content-filter
Version:
A simple but powerful content-filter. Also provides protection against NoSQL (like MongoDB) injection attacks on Node.js
179 lines (163 loc) • 8.44 kB
Plain Text
/***************************************************************************************
* *
* The file contains rules which are thought that they would be used in the project. *
* *
* http://eslint.org/docs/rules/ *
* *
***************************************************************************************/
{
"parser": "babel-eslint",
"env": {
"es6": true,
"browser": true,
},
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"restParams": true, // Indicated by three dots (...). That named parameter becomes an Array containing the rest of the parameters passed to the function.
"superInFunctions": true,
"templateStrings": true, // Used inside of `` type quotes.
"jsx": true,
},
// Map from global var to bool specifying if it can be redefined
"globals": {
"__dirname": false,
"cancelAnimationFrame": false,
"clearImmediate": true,
"clearInterval": false,
"clearTimeout": false,
"console": false,
"document": false,
"escape": false,
"exports": false,
"fetch": false,
"global": false,
"jest": false,
"Map": true,
"module": false,
"navigator": false,
"process": false,
"Promise": true,
"requestAnimationFrame": true,
"require": false,
"Set": true,
"setImmediate": true,
"setInterval": false,
"setTimeout": false,
"window": false,
"XMLHttpRequest": false,
"pit": false
},
"rules": {
/* Possible Errors */
"comma-dangle": 0,
"no-console": 1,
"no-debugger": 1,
"no-dupe-keys": 2,
"no-dupe-args": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 1,
"no-extra-parens": 0,
"no-extra-semi": 1,
"no-invalid-regexp": 1,
"no-negated-in-lhs": 1,
"no-obj-calls": 1,
"no-regex-spaces": 1,
"no-reserved-keys": 0,
"no-sparse-arrays": 1,
"no-unreachable": 1,
"use-isnan": 1,
"valid-jsdoc": 0,
"valid-typeof": 1,
/* Best Practices */
"accessor-pairs": [1, {"getWithoutSet": true}], // Enforces getter/setter pairs in objects
"block-scoped-var": 0, // treat var statements as if they were block scoped (off by default)
"complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
"consistent-return": 0, // require return statements to either always or never specify values
"curly": 1, // specify curly brace conventions for all control statements
"default-case": 0, // require default case in switch statements (off by default)
"dot-location": [1, "property"], // enforces consistent newlines before or after dots
"dot-notation": 1, // encourages use of dot notation whenever possible
"eqeqeq": [1, "smart"], // require the use of === and !==
"guard-for-in": 0, // make sure for-in loops have an if statement (off by default)
"no-alert": 1, // disallow the use of alert, confirm and prompt
"no-caller": 1, // disallow use of arguments.caller or arguments.callee
"no-case-declarations": 1, // disallow lexical declarations in case clauses
"no-div-regex": 1, // disallow division operators explicitly at beginning of regular expression (off by default)
"no-else-return": 0, // disallow else after a return in an if (off by default)
"no-empty-label": 1, // disallow use of labels for anything other then loops and switches
"no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default)
"no-eval": 1, // disallow use of eval()
"no-extend-native": 1, // disallow adding to native types
"no-extra-bind": 1, // disallow unnecessary function binding
"no-fallthrough": 1, // disallow fallthrough of case statements
"no-floating-decimal": 1, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
"no-implicit-coercion": 1, // disallow the type conversions with shorter notations
"no-implied-eval": 1, // disallow use of eval()-like methods
"no-invalid-this": 1, // disallow this keywords outside of classes or class-like objects
"no-iterator": 1, // disallow usage of __iterator__ property
"no-labels": 1, // disallow use of labeled statements
"no-lone-blocks": 1, // disallow unnecessary nested blocks
"no-loop-func": 0, // disallow creation of functions within loops
"no-magic-numbers": 0, // disallow the use of magic numbers
"no-multi-spaces": 1, // disallow use of multiple spaces (fixable)
"no-multi-str": 0, // disallow use of multiline strings
"no-native-reassign": 0, // disallow reassignments of native objects
"no-new-func": 1, // disallow use of new operator for Function object
"no-new-wrappers": 1, // disallows creating new instances of String,Number, and Boolean
"no-new": 1, // disallow use of new operator when not part of the assignment or comparison
"no-octal-escape": 1, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
"no-octal": 1, // disallow use of octal literals
"no-param-reassign": 0, // disallow reassignment of function parameters
"no-process-env": 0, // disallow use of process.env in Node.js
"no-proto": 1, // disallow usage of __proto__ property
"no-redeclare": 0, // disallow declaring the same variable more then once
"no-return-assign": 1, // disallow use of assignment in return statement
"no-script-url": 1, // disallow use of javascript: urls.
"no-self-compare": 1, // disallow comparisons where both sides are exactly the same (off by default)
"no-sequences": 1, // disallow use of comma operator
"no-throw-literal": 1, // restrict what can be thrown as an exception
"no-unused-expressions": 0, // disallow usage of expressions in statement position
"no-useless-call": 1, // disallow unnecessary .call() and .apply()
"no-useless-concat": 1, // disallow unnecessary concatenation of literals or template literals
"no-void": 1, // disallow use of void operator (off by default)
"no-warning-comments": 0, // disallow usage of configurable warning terms in comments": 1, // e.g. TODO or FIXME (off by default)
"no-with": 1, // disallow use of the with statement
"radix": 1, // require use of the second argument for parseInt() (off by default)
"vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
"wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default)
"yoda": 1, // require or disallow Yoda conditions
/* Strict Mode */
"strict": [2, "global"],
/* Variables */
"no-undef": 2,
"no-undef-init": 1,
"no-unused-vars": [1, {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code
"no-shadow-restricted-names": 1,
/* Stylistic Issues */
"camelcase": [1, {"properties": "never"}],
"eol-last": 1,
"indent": [1, "tab"],
"quotes": [1, "single", "avoid-escape"],
"linebreak-style": [2, "unix"],
"new-parens": 1,
"no-trailing-spaces": 1,
"semi": [1, "always"],
"semi-spacing": 1, // require a space after a semi-colon
"space-after-keywords": 1,
"space-infix-ops": 1,
"space-return-throw-case": 1,
/* ECMAScript 6 */
"no-class-assign": 2,
"object-shorthand": 0,
}
}