--- env: node: true rules: # Trivia: stroustrup is the designer and original implementor of C++. # Disallows: `else`, `elseif` and `catch` and the same line as the closing }. brace-style: - 2 - "stroustrup" # Disallows: `var fn = function() {};` # Allows: `function fn() {}` and `internals.fn = function() {};` func-style: - 2 - "declaration" # Disallows: `for-in` loops without `hasOwnProperty` guard-for-in: 2 # Disallows: `var num = .5;` `var num = 2.;` `var num = -.7;` no-floating-decimal: 2 # Disallows: `var foo = bar ? baz : qux === quxx ? bing : bam;` no-nested-ternary: 2 # Require use of the second argument for parseInt() i.e a radix. radix: 2 # Disallow: # var x = "Line 1 \ # Line 2"; no-multi-str: 2 # Warn about "todo" and "fixme" comments. no-warning-comments: - 1 - terms: - "todo" - "fixme" location: "anywhere" # Line length should have a maximum. max-len: - 2 # Count this as an error. - 100 # 100 characters long lines. - 2 # Each tab counts as two characters. # Warn if the jsdoc is invalid valid-jsdoc: - 1 - requireReturn: false # prefer: # return: "return" # Require immediate function invocation to be wrapped in parentheses. wrap-iife: 2 # Allows the use of `this_is_a_variable_name` camelcase: 0 # Enforce single quotes quotes: - 2 - "single" - "avoid-escape" # Disallow use of variables before they are defined no-use-before-define: 0 # Allow Dangling Underscores in Identifiers. e.g `var _foo = 1; # Since MongoDB has the property `_id` which raises this error. no-underscore-dangle: 0 # Enforces error handling in callbacks handle-callback-err: 2 # Err if string is concatenated with __dirname or __filename. Use path module. no-path-concat: 2 # Require Just One var Statement Per Scope: OFF one-var: 0 # Disallow Mixed Requires # TODO: Make this an error in the future. no-mixed-requires: - 1 - true # Grouping of requires # Generates warnings when variables are used outside of the block in which they were defined. block-scoped-var: 2 # Require Variable Declarations to be at the Top # NOTE: This rule breaks when using 'use strict'; at the top of the files vars-on-top: 0 # Require Spaces Around Infix Operators e.g. `a+b` will raise an error, `a + b` will not. space-infix-ops: 2 # Disallow declaration of variables that are not used in the code no-unused-vars: - 2 - vars: "all" # checks all variables for usage, including those in the global scope args: "none" # do not check arguments # Allow use of process.exit() # This would be turned on for module. no-process-exit: 0 # Error if "use strict" is omitted strict: 2 # Disallow unnecessary use of "use strict"; when already in strict mode no-extra-strict: 2 # Allow global strict in node projects since each file has its own function scope no-global-strict: 0 # Disallow use of new operator with the require function no-new-require: 2 # Enforce newline at the end of file, with no multiple empty lines eol-last: 2 # Require a capital letter for constructors new-cap: 2 # Disallow Spaces in Function Calls no-spaced-func: 2 # Disallow Spaces Before Semicolon no-space-before-semi: 2 # Disallow trailing spaces at the end of lines no-trailing-spaces: 2 # Require spaces following keywords space-after-keywords: 2 # Require spaces following return, throw, and case space-return-throw-case: 2 # Disallow spaces inside of parentheses # space-in-parens: # - 2 # - "never" # Disallow mixed spaces and tabs for indentation no-mixed-spaces-and-tabs: 2 # Enforce Semicolons semi: - 2 - "always" # Require Default Case in Switch Statements default-case: 2 # Require Following Curly Brace Conventions curly: 2 # Require use of dot notation whenever possible dot-notation: 2 # Require the use of === and !== eqeqeq: 2 # Disallow use of eval() no-eval: 2 # Disallow adding to native types no-extend-native: 1 # Warn Case Statement Fallthrough no-fallthrough: 1 # Disallow Implied eval() # Example: # setTimeout("alert('Hi!');", 100); no-implied-eval: 2 # Disallow Reassignment of Native Objects # Example: # String = "hello world"; # var String; no-native-reassign: 2 # Disallow use of new operator when not part of the assignment or comparison # Example # new Thing(); // Error # var thing = new Thing(); // OK no-new: 2 # Disallow Redeclaring Variables # Example: # var a = 3; # var a = 10; no-redeclare: 2 # Disallow use of void operator. no-void: 2 # No with Statements no-with: 2 # Ensures that the results of typeof are compared against a valid string. valid-typeof: 2 # Disallow Yoda Conditions # Example: # if ("red" === color) {} yoda: - 2 - "never" # Disallow Self Compare # Example: # if (x === x) {} no-self-compare: 2 # Disallow Empty Block Statements # Example: # if (foo) { # } no-empty: 2 # Disallow Extra Semicolons # Example: # var x = 5;; no-extra-semi: 2 # Disallow Duplicate Keys # Example: # var foo = { # bar: "baz", # bar: "qux" # }; no-dupe-keys: 2 # Disallow Dangling Commas # Example: # var foo = { # bar: "baz", # qux: "quux", # }; no-comma-dangle: 2 # Disallow Assignment in Conditional Expressions # Example: # if (c = "f") { # // ... # } no-cond-assign: 2 # Warn about Extra Boolean Casts no-extra-boolean-cast: 1 # Disallow Unreachable Code # Example: # function fn() { # x = 1; # return x; # x = 3; // this will never execute # } no-unreachable: 2