├── Procfile ├── .travis.yml ├── index.js ├── .gitattributes ├── package.json ├── README.md ├── LICENSE.md ├── test └── test.js ├── lib └── hashcode.js ├── .gitignore ├── .jshintrc └── .eslintrc /Procfile: -------------------------------------------------------------------------------- 1 | web: node index.js 2 | 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '4' 4 | - '6' 5 | - '7' 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | module.exports = { 5 | hashcode: require("./lib/hashcode") 6 | }; 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hashcode", 3 | "version": "1.0.0", 4 | "description": "Hashcode.js is a simple JavaScript module for generating hashcodes (integer representations) of objects.", 5 | "main": "index.js", 6 | "files": [ 7 | "lib", 8 | "index.js", 9 | "LICENSE" 10 | ], 11 | "scripts": { 12 | }, 13 | "dependencies": { 14 | }, 15 | "engines": { 16 | "node": ">=4.4.0" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/m3talstorm/hashcode" 21 | }, 22 | "bugs": { 23 | "url": "https://github.com/m3talstorm/hashcode/issues" 24 | }, 25 | "keywords": [ 26 | "hash", 27 | "hashcode", 28 | "hashing", 29 | "node", 30 | "nodejs" 31 | ], 32 | "author": "Stuart Bannerman", 33 | "contributors": [ 34 | ], 35 | "license": "MIT" 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hashcode 2 | 3 | [![Build Status](https://travis-ci.org/m3talstorm/hashcode.svg?branch=master)](https://travis-ci.org/m3talstorm/hashcode) [![Downloads](https://img.shields.io/npm/dm/hashcode.svg?style=flat)](https://www.npmjs.org/package/hashcode) [![Npm Version](https://img.shields.io/npm/v/hashcode.svg?style=flat)](https://www.npmjs.org/package/hashcode) [![Node Version](https://img.shields.io/node/v/hashcode.svg?style=flat)](https://www.npmjs.org/package/hashcode) [![Issues](https://img.shields.io/github/issues/m3talstorm/hashcode.svg?style=flat)](https://github.com/m3talstorm/hashcode/issues) 4 | 5 | Hashcode is a simple javascript module for generating hashcodes (integer representations) of objects. 6 | 7 | 8 | ## Install 9 | 10 | #### Node 11 | 12 | ~~~ bash 13 | npm install hashcode --save 14 | ~~~ 15 | 16 | ## Usage 17 | 18 | #### Node 19 | 20 | ~~~ javascript 21 | 22 | const Hashcode = require('hashcode') 23 | 24 | const obj = { 25 | 'foo' : 42, 26 | 'bar' : "hello world", 27 | 'baz' : false, 28 | } 29 | 30 | const hash = Hashcode.value(obj) 31 | 32 | console.log(hash) 33 | 34 | 35 | ~~~ 36 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Stuart Bannerman 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const Hashcode = require('../lib/hashcode') 4 | 5 | 6 | // Simple example of a list of types and the hashes the produce. 7 | // For each one it generate a hash and displays it in the development console. 8 | var types = 9 | { 10 | 'undefined' : undefined, 11 | 'null' : null, 12 | 'NaN' : NaN, 13 | 14 | 'stringEmpty' : '', 15 | 'stringFilled' : 'a', 16 | 'stringNumber' : '1', 17 | 18 | 'numberMax' : Number.MAX_VALUE, 19 | 'numberMin' : Number.MIN_VALUE, 20 | 'numberPInfinity' : Number.POSITIVE_INFINITY, 21 | 'numberNInfinity' : Number.NEGATIVE_INFINITY, 22 | 'numberNegative' : -1, 23 | 'numberZero' : 0, 24 | 'numberPositive' : 1, 25 | 26 | // produces the same hash as 0 27 | 'decimanlZero' : 0.0, 28 | // produces the same hash as 1 29 | 'decimanlOne' : 1.0, 30 | 'decimalNotOne' : 1.5, 31 | 32 | 'objectEmpty' : {}, 33 | 'objectNotEmpty' : { a : 5 }, 34 | 35 | 'booleanTrue' : true, 36 | 'booleanFalse' : false, 37 | 38 | 'functionEmpty' : function() {}, 39 | 'functionNotEmpty' : function(a, b) { return a + b }, 40 | }; 41 | 42 | for(let type in types) 43 | { 44 | const hash = Hashcode.value(types[type]) 45 | 46 | console.log(type, types[type], hash) 47 | } 48 | -------------------------------------------------------------------------------- /lib/hashcode.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // Used to check objects for own properties 4 | const hasOwnProperty = Object.prototype.hasOwnProperty 5 | 6 | // Hashes a string 7 | const hash = (string) => { 8 | 9 | let hash = 0 10 | 11 | string = string.toString() 12 | 13 | for(let i = 0; i < string.length; i++) 14 | { 15 | hash = (((hash << 5) - hash) + string.charCodeAt(i)) & 0xFFFFFFFF 16 | } 17 | 18 | return hash 19 | } 20 | 21 | // Deep hashes an object 22 | const object = (obj) => { 23 | // 24 | if(typeof obj.getTime == 'function') 25 | { 26 | return obj.getTime() 27 | } 28 | 29 | let result = 0 30 | 31 | for(let property in obj) 32 | { 33 | if(hasOwnProperty.call(obj, property)) 34 | { 35 | result += hash(property + value(obj[property])) 36 | } 37 | } 38 | 39 | return result 40 | } 41 | 42 | const value = (value) => { 43 | 44 | const type = value == undefined ? undefined : typeof value 45 | // Does a type check on the passed in value and calls the appropriate hash method 46 | return MAPPER[type] ? MAPPER[type](value) + hash(type) : 0 47 | } 48 | 49 | const MAPPER = 50 | { 51 | string: hash, 52 | number: hash, 53 | boolean: hash, 54 | object: object 55 | // functions are excluded because they are not representative of the state of an object 56 | // types 'undefined' or 'null' will have a hash of 0 57 | } 58 | 59 | module.exports = { 60 | 61 | value: value, 62 | } 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | .remote-sync.json 165 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | // JSHint Default Configuration File (as on JSHint website) 3 | // See http://jshint.com/docs/ for more details 4 | 5 | "maxerr" : 500, // {int} Maximum error before stopping 6 | 7 | // Enforcing 8 | "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) 9 | "camelcase" : false, // true: Identifiers must be in camelCase 10 | "curly" : true, // true: Require {} for every new block or scope 11 | "eqeqeq" : false, // true: Require triple equals (===) for comparison 12 | "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() 13 | "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. 14 | "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` 15 | "latedef" : false, // true: Require variables/functions to be defined before being used 16 | "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()` 17 | "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` 18 | "noempty" : true, // true: Prohibit use of empty blocks 19 | "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. 20 | "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) 21 | "plusplus" : false, // true: Prohibit use of `++` and `--` 22 | "quotmark" : false, // Quotation mark consistency: 23 | // false : do nothing (default) 24 | // true : ensure whatever is used is consistent 25 | // "single" : require single quotes 26 | // "double" : require double quotes 27 | "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) 28 | "unused" : false, // Unused variables: 29 | // true : all variables, last function parameter 30 | // "vars" : all variables only 31 | // "strict" : all variables, all function parameters 32 | "strict" : false, // true: Requires all functions run in ES5 Strict Mode 33 | "maxparams" : false, // {int} Max number of formal params allowed per function 34 | "maxdepth" : false, // {int} Max depth of nested blocks (within functions) 35 | "maxstatements" : false, // {int} Max number statements per function 36 | "maxcomplexity" : false, // {int} Max cyclomatic complexity per function 37 | "maxlen" : false, // {int} Max number of characters per line 38 | "varstmt" : false, // true: Disallow any var statements. Only `let` and `const` are allowed. 39 | 40 | // Relaxing 41 | "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) 42 | "boss" : false, // true: Tolerate assignments where comparisons would be expected 43 | "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. 44 | "eqnull" : true, // true: Tolerate use of `== null` 45 | "esversion" : 5, // {int} Specify the ECMAScript version to which the code must adhere. 46 | "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) 47 | // (ex: `for each`, multiple try/catch, function expression…) 48 | "evil" : false, // true: Tolerate use of `eval` and `new Function()` 49 | "expr" : false, // true: Tolerate `ExpressionStatement` as Programs 50 | "funcscope" : false, // true: Tolerate defining variables inside control statements 51 | "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') 52 | "iterator" : false, // true: Tolerate using the `__iterator__` property 53 | "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block 54 | "laxbreak" : false, // true: Tolerate possibly unsafe line breakings 55 | "laxcomma" : false, // true: Tolerate comma-first style coding 56 | "loopfunc" : false, // true: Tolerate functions being defined in loops 57 | "multistr" : false, // true: Tolerate multi-line strings 58 | "noyield" : false, // true: Tolerate generator functions with no yield statement in them. 59 | "notypeof" : false, // true: Tolerate invalid typeof operator values 60 | "proto" : false, // true: Tolerate using the `__proto__` property 61 | "scripturl" : false, // true: Tolerate script-targeted URLs 62 | "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` 63 | "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation 64 | "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` 65 | "validthis" : false, // true: Tolerate using this in a non-constructor function 66 | 67 | // Environments 68 | "browser" : true, // Web Browser (window, document, etc) 69 | "browserify" : false, // Browserify (node.js code in the browser) 70 | "couch" : false, // CouchDB 71 | "devel" : true, // Development/debugging (alert, confirm, etc) 72 | "dojo" : false, // Dojo Toolkit 73 | "jasmine" : false, // Jasmine 74 | "jquery" : true, // jQuery 75 | "mocha" : true, // Mocha 76 | "mootools" : false, // MooTools 77 | "node" : true, // Node.js 78 | "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) 79 | "phantom" : false, // PhantomJS 80 | "prototypejs" : false, // Prototype and Scriptaculous 81 | "qunit" : false, // QUnit 82 | "rhino" : false, // Rhino 83 | "shelljs" : false, // ShellJS 84 | "typed" : false, // Globals for typed array constructions 85 | "worker" : false, // Web Workers 86 | "wsh" : false, // Windows Scripting Host 87 | "yui" : false, // Yahoo User Interface 88 | 89 | // Errors by Code 90 | "-W032" : false, // Unnecessary semicolon 91 | "-W067" : false, // Bad invocation 92 | "-W030" : false, // Expected an assignment or function call and instead saw an expression 93 | "-W041" : false, // Use '!==' to compare with 'undefined' and Use '===' to compare with '0' 94 | "-W093" : false, // Did you mean to return a conditional instead of an assignment? 95 | 96 | // Custom Globals - additional predefined global variables 97 | "globals" : { 98 | 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | // http://eslint.org/docs/rules/ 3 | 4 | "ecmaFeatures": { 5 | "binaryLiterals": false, // enable binary literals 6 | "blockBindings": false, // enable let and const (aka block bindings) 7 | "defaultParams": false, // enable default function parameters 8 | "forOf": false, // enable for-of loops 9 | "generators": false, // enable generators 10 | "objectLiteralComputedProperties": false, // enable computed object literal property names 11 | "objectLiteralDuplicateProperties": false, // enable duplicate object literal properties in strict mode 12 | "objectLiteralShorthandMethods": false, // enable object literal shorthand methods 13 | "objectLiteralShorthandProperties": false, // enable object literal shorthand properties 14 | "octalLiterals": false, // enable octal literals 15 | "regexUFlag": false, // enable the regular expression u flag 16 | "regexYFlag": false, // enable the regular expression y flag 17 | "templateStrings": false, // enable template strings 18 | "unicodeCodePointEscapes": false, // enable code point escapes 19 | "jsx": false // enable JSX 20 | }, 21 | 22 | "env": { 23 | "browser": false, // browser global variables. 24 | "node": true, // Node.js global variables and Node.js-specific rules. 25 | "amd": false, // defines require() and define() as global variables as per the amd spec. 26 | "mocha": false, // adds all of the Mocha testing global variables. 27 | "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0. 28 | "phantomjs": false, // phantomjs global variables. 29 | "jquery": false, // jquery global variables. 30 | "prototypejs": false, // prototypejs global variables. 31 | "shelljs": false, // shelljs global variables. 32 | }, 33 | 34 | "globals": { 35 | // e.g. "angular": true 36 | }, 37 | 38 | "plugins": [ 39 | // e.g. "react" (must run `npm install eslint-plugin-react` first) 40 | ], 41 | 42 | "rules": { 43 | ////////// Possible Errors ////////// 44 | 45 | "no-comma-dangle": 0, // disallow trailing commas in object literals 46 | "no-cond-assign": 0, // disallow assignment in conditional expressions 47 | "no-console": 0, // disallow use of console (off by default in the node environment) 48 | "no-constant-condition": 0, // disallow use of constant expressions in conditions 49 | "no-control-regex": 0, // disallow control characters in regular expressions 50 | "no-debugger": 0, // disallow use of debugger 51 | "no-dupe-keys": 0, // disallow duplicate keys when creating object literals 52 | "no-empty": 0, // disallow empty statements 53 | "no-empty-class": 0, // disallow the use of empty character classes in regular expressions 54 | "no-ex-assign": 0, // disallow assigning to the exception in a catch block 55 | "no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context 56 | "no-extra-parens": 0, // disallow unnecessary parentheses (off by default) 57 | "no-extra-semi": 0, // disallow unnecessary semicolons 58 | "no-func-assign": 0, // disallow overwriting functions written as function declarations 59 | "no-inner-declarations": 0, // disallow function or variable declarations in nested blocks 60 | "no-invalid-regexp": 0, // disallow invalid regular expression strings in the RegExp constructor 61 | "no-irregular-whitespace": 0, // disallow irregular whitespace outside of strings and comments 62 | "no-negated-in-lhs": 0, // disallow negation of the left operand of an in expression 63 | "no-obj-calls": 0, // disallow the use of object properties of the global object (Math and JSON) as functions 64 | "no-regex-spaces": 0, // disallow multiple spaces in a regular expression literal 65 | "no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default) 66 | "no-sparse-arrays": 0, // disallow sparse arrays 67 | "no-unreachable": 0, // disallow unreachable statements after a return, throw, continue, or break statement 68 | "use-isnan": 0, // disallow comparisons with the value NaN 69 | "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default) 70 | "valid-typeof": 0, // Ensure that the results of typeof are compared against a valid string 71 | 72 | 73 | ////////// Best Practices ////////// 74 | 75 | "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) 76 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) 77 | "consistent-return": 0, // require return statements to either always or never specify values 78 | "curly": 0, // specify curly brace conventions for all control statements 79 | "default-case": 0, // require default case in switch statements (off by default) 80 | "dot-notation": 0, // encourages use of dot notation whenever possible 81 | "eqeqeq": 0, // require the use of === and !== 82 | "guard-for-in": 0, // make sure for-in loops have an if statement (off by default) 83 | "no-alert": 0, // disallow the use of alert, confirm, and prompt 84 | "no-caller": 0, // disallow use of arguments.caller or arguments.callee 85 | "no-div-regex": 0, // disallow division operators explicitly at beginning of regular expression (off by default) 86 | "no-else-return": 0, // disallow else after a return in an if (off by default) 87 | "no-empty-label": 0, // disallow use of labels for anything other then loops and switches 88 | "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default) 89 | "no-eval": 0, // disallow use of eval() 90 | "no-extend-native": 0, // disallow adding to native types 91 | "no-extra-bind": 0, // disallow unnecessary function binding 92 | "no-fallthrough": 0, // disallow fallthrough of case statements 93 | "no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default) 94 | "no-implied-eval": 0, // disallow use of eval()-like methods 95 | "no-iterator": 0, // disallow usage of __iterator__ property 96 | "no-labels": 0, // disallow use of labeled statements 97 | "no-lone-blocks": 0, // disallow unnecessary nested blocks 98 | "no-loop-func": 0, // disallow creation of functions within loops 99 | "no-multi-spaces": 0, // disallow use of multiple spaces 100 | "no-multi-str": 0, // disallow use of multiline strings 101 | "no-native-reassign": 0, // disallow reassignments of native objects 102 | "no-new": 0, // disallow use of new operator when not part of the assignment or comparison 103 | "no-new-func": 0, // disallow use of new operator for Function object 104 | "no-new-wrappers": 0, // disallows creating new instances of String, Number, and Boolean 105 | "no-octal": 0, // disallow use of octal literals 106 | "no-octal-escape": 0, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; 107 | "no-process-env": 0, // disallow use of process.env (off by default) 108 | "no-proto": 0, // disallow usage of __proto__ property 109 | "no-redeclare": 0, // disallow declaring the same variable more then once 110 | "no-return-assign": 0, // disallow use of assignment in return statement 111 | "no-script-url": 0, // disallow use of javascript: urls. 112 | "no-self-compare": 0, // disallow comparisons where both sides are exactly the same (off by default) 113 | "no-sequences": 0, // disallow use of comma operator 114 | "no-unused-expressions": 0, // disallow usage of expressions in statement position 115 | "no-void": 0, // disallow use of void operator (off by default) 116 | "no-warning-comments": 0, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default) 117 | "no-with": 0, // disallow use of the with statement 118 | "radix": 0, // require use of the second argument for parseInt() (off by default) 119 | "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default) 120 | "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default) 121 | "yoda": 0, // require or disallow Yoda conditions 122 | 123 | 124 | ////////// Strict Mode ////////// 125 | 126 | "global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (off by default in the node environment) 127 | "no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode 128 | "strict": 0, // controls location of Use Strict Directives 129 | 130 | 131 | ////////// Variables ////////// 132 | 133 | "no-catch-shadow": 0, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) 134 | "no-delete-var": 0, // disallow deletion of variables 135 | "no-label-var": 0, // disallow labels that share a name with a variable 136 | "no-shadow": 0, // disallow declaration of variables already declared in the outer scope 137 | "no-shadow-restricted-names": 0, // disallow shadowing of names such as arguments 138 | "no-undef": 0, // disallow use of undeclared variables unless mentioned in a /*global */ block 139 | "no-undef-init": 0, // disallow use of undefined when initializing variables 140 | "no-undefined": 0, // disallow use of undefined variable (off by default) 141 | "no-unused-vars": 0, // disallow declaration of variables that are not used in the code 142 | "no-use-before-define": 0, // disallow use of variables before they are defined 143 | 144 | 145 | ////////// Node.js ////////// 146 | 147 | "handle-callback-err": 0, // enforces error handling in callbacks (off by default) (on by default in the node environment) 148 | "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) 149 | "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment) 150 | "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) 151 | "no-process-exit": 0, // disallow process.exit() (on by default in the node environment) 152 | "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) 153 | "no-sync": 0, // disallow use of synchronous methods (off by default) 154 | 155 | 156 | ////////// Stylistic Issues ////////// 157 | 158 | "brace-style": 0, // enforce one true brace style (off by default) 159 | "camelcase": 0, // require camel case names 160 | "comma-spacing": 0, // enforce spacing before and after comma 161 | "comma-style": 0, // enforce one true comma style (off by default) 162 | "consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default) 163 | "eol-last": 0, // enforce newline at the end of file, with no multiple empty lines 164 | "func-names": 0, // require function expressions to have a name (off by default) 165 | "func-style": 0, // enforces use of function declarations or expressions (off by default) 166 | "key-spacing": 0, // enforces spacing between keys and values in object literal properties 167 | "max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default) 168 | "new-cap": 0, // require a capital letter for constructors 169 | "new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments 170 | "no-array-constructor": 0, // disallow use of the Array constructor 171 | "no-inline-comments": 0, // disallow comments inline after code (off by default) 172 | "no-lonely-if": 0, // disallow if as the only statement in an else block (off by default) 173 | "no-mixed-spaces-and-tabs": 0, // disallow mixed spaces and tabs for indentation 174 | "no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default) 175 | "no-nested-ternary": 0, // disallow nested ternary expressions (off by default) 176 | "no-new-object": 0, // disallow use of the Object constructor 177 | "no-space-before-semi": 0, // disallow space before semicolon 178 | "no-spaced-func": 0, // disallow space between function identifier and application 179 | "no-ternary": 0, // disallow the use of ternary operators (off by default) 180 | "no-trailing-spaces": 0, // disallow trailing whitespace at the end of lines 181 | "no-underscore-dangle": 0, // disallow dangling underscores in identifiers 182 | "no-wrap-func": 0, // disallow wrapping of non-IIFE statements in parens 183 | "one-var": 0, // allow just one var statement per function (off by default) 184 | "operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default) 185 | "padded-blocks": 0, // enforce padding within blocks (off by default) 186 | "quote-props": 0, // require quotes around object literal property names (off by default) 187 | "quotes": 0, // specify whether double or single quotes should be used 188 | "semi": 0, // require or disallow use of semicolons instead of ASI 189 | "sort-vars": 0, // sort variables within the same declaration block (off by default) 190 | "space-after-function-name": 0, // require a space after function names (off by default) 191 | "space-after-keywords": 0, // require a space after certain keywords (off by default) 192 | "space-before-blocks": 0, // require or disallow space before blocks (off by default) 193 | "space-in-brackets": 0, // require or disallow spaces inside brackets (off by default) 194 | "space-in-parens": 0, // require or disallow spaces inside parentheses (off by default) 195 | "space-infix-ops": 0, // require spaces around operators 196 | "space-return-throw-case": 0, // require a space after return, throw, and case 197 | "space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 198 | "spaced-line-comment": 0, // require or disallow a space immediately following the // in a line comment (off by default) 199 | "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) 200 | 201 | 202 | ////////// ECMAScript 6 ////////// 203 | 204 | "no-var": 0, // require let or const instead of var (off by default) 205 | "generator-star": 0, // enforce the position of the * in generator functions (off by default) 206 | 207 | 208 | ////////// Legacy ////////// 209 | 210 | "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default) 211 | "max-len": 0, // specify the maximum length of a line in your program (off by default) 212 | "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default) 213 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) 214 | "no-bitwise": 0, // disallow use of bitwise operators (off by default) 215 | "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default) 216 | } 217 | } 218 | --------------------------------------------------------------------------------