Blame view

node_modules/eslint/lib/rules/no-octal.js 598 Bytes
c39994410   Ryan Glover   wip converting to...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  /**
   * @fileoverview Rule to flag when initializing octal literal
   * @author Ilya Volodin
   */
  
  "use strict";
  
  //------------------------------------------------------------------------------
  // Rule Definition
  //------------------------------------------------------------------------------
  
  module.exports = function(context) {
  
      return {
  
          "Literal": function(node) {
              if (typeof node.value === "number" && /^0[0-7]/.test(node.raw)) {
                  context.report(node, "Octal literals should not be used.");
              }
          }
      };
  
  };
  
  module.exports.schema = [];